translate icon indicating copy to clipboard operation
translate copied to clipboard

Does not detect strings inside `url()` function

Open nickdunn opened this issue 10 years ago • 1 comments

Not common practice, I know, but I've found this plugin won't detect the following:

{{ url('mystring'|t) }}

To achieve this I relaxed the rule that the translated string must be surrounded by {{ or {%, instead it must be surrounded by at least a space.

Regex:

'/(\s*.*?)\'(.*?)\'.*?\|.*?(t|translate)(\(.*?\)|).*?(\s)/',

Example:

url( 'mystring'|t )

Quite brittle and not the best approach, but it got me past a deadline!

nickdunn avatar Jan 11 '15 18:01 nickdunn

Thanks, this and one other issue have to be resolved by me creating a regex pattern that I'm working on, but is a though one.

boboldehampsink avatar Jan 19 '15 07:01 boboldehampsink