Hi,
I am trying to implement a small tool in my site so i can search for all Yii::t and write them into the corresponding files in the messages folder. But I have some problems with my expression.
preg_match_all("/Yii[:]{2}t\(['|\"](.+?)['|\"],[\s]+['|\"](.+?)['|\"].*\)/im", $content, $matches, PREG_SET_ORDER);
It finds something like:
[font="monospace"]
Yii::t('User', 'User deleted')
[/font]
but here are my problems:
- It does not find [font=“Courier New”]Yii::t(‘User’, ‘add add[color="#ff0000"]"[/color]asdasd’)[/font][font=“Arial”] I don’t know how to exclude the quote which is not around the string. [/font][font="‘Courier New"]"/Yii[:]{2}t\([’(.+?)’|\"(.+?)\"],[\s]+[’(.+?)’|\"(.+?)\"].*\)/im"[/font][font=“Arial”] does not work…[/font]
- [font=“Arial”]It does not find the translations with parameters. For example [/font][font=“Courier New”]Yii::t(‘User’, ‘add {gbf}’, array(’{gbf}’ => 1))[/font][font=“Arial”].[/font]
[font="Arial"]
I think this would be a quite useful tool, but regular expressions are something i will never learn:(
Thanks[/font]