File Types
Language File Type |
Usage |
English_front.php |
The front-end of your plugin. |
English_admin.php |
The admin-area of your plugin |
English_global.php |
Used site-wide - for example, in plugin.xml , a xxxxx_menu.php or e_xxxxxx.php file. |
Defining Language Terms aka 'LANS'
Avoid duplicating terms, particularly in the admin area. If defining terms for admin, always search lan_admin.php
for existing LANs which may match what you require. Never use HTML or URLs inside LAN definitions. Use double quotes within the defines and use str_replace() for variables where needed. See the examples below:
Good:
define("LAN_XXX", "Thank you Firstname");
define("LAN_XXX", "Go to [x] to see the results."); // Good - replace [ and ] with <a href='...'> and </a> using str_replace()
define("LAN_XXX", "I want to [quote] here"); // Good - replace [ and ] with " " using str_replace()
Bad:
define("LAN_XXX", "Thank you <b>Firstname</b>"); //Bad contains HTML
define("LAN_XXX", "Thank you <a href='http://somewhere.com'>Firstname</a>"); //Bad contains HTML
define("LAN_XXX", "Thank you Firstname"); //Bad - allows translator to modify link.
Avoid short language strings for words such as 'and', 'to' and so on. There aren't always equivalents in other languages. If embedding values into a phrase, use substitution. Avoid using substitution terms which are real words or known bbcodes.
define("LAN_EXAMPLE_01", "Update results: [x] records changed, [y] errors, [z] not changed");
$repl = array($changed,$errors,$unchanged);
$text = $tp->lanVars(LAN_EXAMPLE_01,$repl);
Loading Language Files
To load a language file from a plugin folder:
e107::lan('faqs');
e107::lan('faqs',true);
e107::lan('faqs',false, true);
e107::lan('faqs',true, true);
Will include the following paths:
e107_plugins/faqs/languages/English_front.php
e107_plugins/faqs/languages/English_admin.php
e107_plugins/faqs/languages/English/English_front.php
e107_plugins/faqs/languages/English/English_admin.php
Friday 14 June 2013 - 00:00:00