I have to create translations for the project I work on. The simplest solution was to change all stings to a functioncall(string)
so that I could get unique string hashes everytime.
My code has the following different t()
function uses:
<label for="anon"><?php echo t('anonymously? (20% extra)')?></label>
exit(t("Success! You made {amount} oranges out of it!", array('amount' => $oranges)));
echo t('You failed.');
My current regexp is:
$transMatches = preg_match_all('/[^a-z]t\([^)(]+/m', $contents, $matches);
The problem is that it fails on #1 example, matchin "anonymously?". What I really want to achieve is: "match t( then match either ' or " then match anything except what you matched for ' or " and )"
Idea: t\(['|"](.*?)[^'|"]\)?
I cannot make above regexp to work.
How could I do AND in regexp so that it matches "['|"] AND )" OR "['|"] AND, array"
Please help me on regexp and explain why it works.
Thank you!