This is very much a work in progress and I invite comments from others more skilled in internationalizing PHP.
I looked at the Moodle approach and decided to go with a more basic gettext style of internationalization as I think the tools today are far better than the tools were when Moodle was being developed.
I decided to separate the I18N for the modules from everything else (much like Moodle). I decided to follow some of the patterns from WordPress and add a few of my own _() variants
__("Message", ['textdomain']); _e("Message", ['textdomain']); _m("Message");
_e() echoes the message. My
is shortcut to lookup a message in the 'master' text domain.
The translation files for the 'master' text domain are in the 'locale' folder in the top directory. The translation files for each module are in a folder like 'mod/attend/locale' and the text domain for a module is its folder name within the 'mod' directory.
See the 'mod/attend' folder for the patterns on how to localize a module. Make sure to add all four keyword patterns: '_', '__', '_e' and '_m'
When starting a new translation, since poedit cannot exclude folders and any tool folders like 'mod' or 'samples' need to be handled separately, we must list all of the folders to scann explicitly in the catalog properties. So the settings for the properties for a master translation are:
Source path: ../../.. Paths: lib, admin, common, core and lti
Over time there may be more sub-directories to add to the list. Just make sure not to double scan the 'mod' or 'samples' subdirectories.
TODO: I still need to do plurals.
Chuck Tue Jun 10 08:53:25 EDT 2014