1

I have a a library inside \libraries\mylib\.

That library contains an include.php which uses following to load language files that are also inside a /language folder in the library:

$lang = JFactory::getLanguage();
// load english language file if some constants are not translated
$lang->load('mylib', JPATH_SITE . '/libraries/mylib', 'en-GB', true);
// load active language file
$lang->load('mylib', JPATH_SITE . '/libraries/mylib', null, true);

My site uses the two languages German and English. The folders inside the library look like this:

\libraries\mylib\language\de-DE\de-DE.mylib.ini
\libraries\mylib\language\en-GB\en-GB.mylib.ini

Now to the problem.

German is setup as the the standard language inside Joomla. So if I run the site in german, the language files in the library get loaded correctly, as shown by the language debugger:

**Loaded** : JROOT/libraries/mylib/language/en-GB/en-GB.mylib.ini
**Loaded** : JROOT/libraries/mylib/language/de-DE/de-DE.mylib.ini

If i switch the language to english the library languages don't get loaded anymore:

Not loaded : JROOT/language/en-GB/en-GB.mylib.ini

Looks like in english the whole library folder path gets lost...?

I checked everything like filenames, parsing errors, folders ans so on. No idea whats going on.

Maybe someone has an idea. Thanks!

0

Extension-specific language folder is an old and not recommended way of handling language files. Joomla! is moving towards the use of only global language folders. Whether or not your code should still work I can't tell, you might want to ask this on the Issue Tracker.

Until you receive a response there you can workaround the issue by loading your files later during onAfterRoute event or by moving to use the global language folders as well.

  • Well I have two extensions, that use their own language files but also a single language file from the library. Like described it works when on the default language, but not when switching the language. – Mike Dec 5 '19 at 10:58
  • Also not using extension-specific language folders. – Mike Dec 5 '19 at 11:09
  • By extension-specific I mean your language files are placed in your extension's directory and not in global (language or administrator/language) directory. – Sharky Dec 5 '19 at 12:28
  • Yes, that is not the case. Language files are placed in global folders and are getting loaded without problems. It's only about the language files in the library folder. – Mike Dec 5 '19 at 13:17
  • Yes, exactly. Language Filter plugin does not load language files from extension folders. – Sharky Dec 5 '19 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.