2011-03-16, 02:29:36
The problem is that each plugin has to handle translations itself.
Thus the GetSimple core should provide a function load_i18n($name, $language, $default_language),
This way the translations other than the default language do not need to be complete - the default language is used if a translation is missing.
Important are the language parameters for the load_i18n function as they are different whether the function is called for a admin or frontend functionality (e.g. load_i18n("i18n_search", $language, I18N_DEFAULT_LANGUAGE) when using the I18N plugin for the frontend)
E.g. file /plugins/lang/18n_navigation_de_DE.php:
when loaded with load_i18n("i18n_navigation") and then called with i18n_r("i18n_navigation/TOP") will yield "am Anfang".
Thus the GetSimple core should provide a function load_i18n($name, $language, $default_language),
- where $name is the plugin name, e.g. "i18n_navigation"
- where $language by default equals the global $LANG (administration language),
- where $default_language by default is en_US,
- and the function tries to load the translation from the full language file - if it exists - e.g. "/plugins/lang/i18n_navigation_de_DE.php" as "i18n_navigation/".key = value,
- loads all additional translations from the language only file - if it exists - e.g. "/plugins/lang/i18n_navigation_de.php"
- loads all additional translations from the full default language file, e.g. "/plugins/lang/i18n_navigation_en_US.php"
- the format of the language files is the same as for GetSimple itself (keys without plugin prefix)
- all translations can be accessed by the functions i18n and i18n_r, e.g. i18n_r("i18n_navigation/PAGES")
This way the translations other than the default language do not need to be complete - the default language is used if a translation is missing.
Important are the language parameters for the load_i18n function as they are different whether the function is called for a admin or frontend functionality (e.g. load_i18n("i18n_search", $language, I18N_DEFAULT_LANGUAGE) when using the I18N plugin for the frontend)
E.g. file /plugins/lang/18n_navigation_de_DE.php:
Code:
<?php
$i18n = array(
'NAVIGATION' => 'Navigationsstruktur bearbeiten (I18N)',
'TOP' => 'am Anfang',
'INSERT_AFTER' => 'einfügen nach'
);