Zusätzliche Sprachdateien laden
From Joomla! Documentation
Oftmals braucht man im Code zusätzliche Sprachdateien. Ein möglicher Fall wäre, wenn man Sprachdateien einer Komponente in ein zugehöriges Modul laden will. In diesem Beispiel wird eine einzelne Sprachdatei geladen und das Ergebnis an die bereits vorhandenen Sprachzeilen angehängt. Der folgende Code hilft dabei.
PHP Code
$lang = JFactory::getLanguage();
$extension = 'com_helloworld';
$base_dir = JPATH_SITE;
$language_tag = 'en-GB';
$reload = true;
$lang->load($extension, $base_dir, $language_tag, $reload);
Following is an explanation of the variables
1. $extension - This is the extension whose language file will be loaded
2. $base_dir - Should be JPATH_SITE in case you have language files stored elsewhere. Defaults to JPATH_BASE. [optional]
Note: Joomla will look in its /languages/ folder for a en-GB.com_helloworld.ini language file. If you put your component's language file in your own components language folder /components/com_helloworld/language/en-GB/en-GB.com_helloworld.ini, then you need to specify the path:
$base_dir = JPATH_SITE . '/components/com_helloworld'
3. $language_tag - This is the locale string. Language files for this locale will be loaded. Defaults to the one set in backend. [optional]
4. $reload - Flag that will force a language to be reloaded if set to true. [optional]