Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Langage file for template ?
#4
didou038 Wrote:Hi all !
I've created a plugin for my template. While I configure it through the admin panel, language files work perfectly.
This plugin is displaying (or not) some information in the template like a sidebar and other things.

For example the sidebar is in template directory and called sidebar.php. I use some word like "Contact Us" directly in html. I added every translatable word in my plugin language file (in plugin/template-name/lang/fr-FR.php).
I don't know how to have the good translation in this component and in the template.

Since GetSimple 3.0 no language is set for the frontend (because of the multiuser capabilities).

The best way would be
  • to provide a language selection in your theme's administration
  • add the following code to your plugin in the index-pretemplate hook (make sure you don't call i18n_merge before):
Code:
if (function_exists('i18n_init')) { // I18N compatibility - you would need two-letter language files
  i18n_init();
  i18n_load_texts('mythemeplugin');
} else {
  global $LANG;
  $mythemesettings = ...; // read your theme plugin's settings
  $frontendlanguage = ...; // get language from settings
  $LANG = $frontendlanguage; // it's now available for all plugins
  i18n_merge('mythemeplugin'); // or i18n_merge('mythemeplugin',substr($LANG,0,2)); for two-letter language files
}
You could hide the language setting in your administration, if the I18N plugin is installed.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply


Messages In This Thread
Langage file for template ? - by didou038 - 2012-03-28, 07:24:12
Langage file for template ? - by didou038 - 2012-03-28, 07:40:03
Langage file for template ? - by Zegnåt - 2012-03-28, 16:38:18
Langage file for template ? - by mvlcek - 2012-03-28, 17:03:50
Langage file for template ? - by didou038 - 2012-03-28, 20:57:26



Users browsing this thread: 1 Guest(s)