Source of the above codeĀ snippet


Note: this one requires an exception (hardwiring) in get_strings.php since img dir is excluded from scanning of strings by default

Chealer9 comments : That looks like a good solution...could you mention a default file to do that.

docekal: My suggestion to this temporary solution is to do it like sylvie suggested. Put the strings in
the file where they are generated just enclose them in an if (false) e.g.:
if (false) {
tra ('flagname1');
tra ('flagname2');
tra ('flagname3');
sylvie: The important point is to keep the constant and the translation call close to each other. My favorite solution (that needs a simple change in get_strings) is to introduce a special comment that get_strings can collect. The false need sometimes to be put in a loop - not very pretty.

Example: /*get_strings: flagname1 */ just near the place you have the flagname1 constant.

Prototype architecture for get_strings.php plugins

My suggestion to this problem is that code that generates strings on the fly should be able to take a parameter "get_strings" or perhapps have a function generate_strings and generate all the strings into the "same" fileapath as the original file with the only difference that its root will be different (e.g. dynamic_strings)

The generation of such files should be initiated by get_strings through a defined interface (e.g. support could be provided to actually generate the files only the data structures / variable names should be defined.

Also, the plugins needs to be registered. My suggestion is that this is done in an directory called get_strings_modules which contains files which include the corresponding .php-file and calls the correct functionality in that file.

Created by: Last Modification: Thursday 12 May 2011 14:28:10 GMT-0000 by Rodrigo Primo
List Slides