A PHP i18n handler
Dave Smith, Trinity College Dublin Web Design Office, 2012
Add this code to the top of a page/template
Note that $tms_i18n is a variable and therefore any variable can be used here. The rest of the documentation assumes the variable used is $tms_i18n.
In the above you'll see $languageSwitcherTCD['lang'] and $languageSwitcherTCD['defaultLang']. These are variables created by the Language Switcher app. The variable name may differ slightly to the above; as long as you use the same variable name as used by the Language Switcher app then all will work.
To show "You are here"
<?php echo $tms_i18n->text('you_are_here'); ?>
For a full list of what is available see the translation files in the Translation Library.
At a bare minimum the default language text needs to be included, for the most part English is the default language:
<?php echo $tms_i18n->text(array('en' => 'Pants')); ?>
For English and Irish:
<?php echo $tms_i18n->text(array('en' => 'Pants', 'ga' => 'Pantio')); ?>
By default the translations are stored in a folder called translations in the same directory as the i18n app. The location of the translations folder can be changed when calling the i18nAppTCD function.
Each language gets its own php file, which consists of an array of i18n code and the text that is generated.
This is a manual process but easy. Just edit each language file in the Translations Library folder.
View a report of English and Irish translations. The report can be manipulated to show different languages, for example a report of English and Russian translations of which there are currently no Russian translations.