I'm trying to break up my translation strings into several files and avoid parsing them all on every request. I know base language files are loaded at Joomla! application initialization. From the API docs, it seems like I should be able to load an arbitrary language file whenever I want, in a View constructor for instance. I'm using code like the following in such a view constructor:
$lang = JFactory::getLanguage(); $lang->load('custom', JROOT . DS . 'administrator' . DS . 'components' . DS . 'com_myextension', $lang->getTag(), true);
Using language debug, I get the following error:
**Not loaded** : JROOT/administrator/components/com_myextension/language/en-GB/en-GB.custom.ini
Directory/file permissions are correctly set. The file is definitely present. There is nothing in the ini file to cause a parse error. The same front-end page correctly loads the component's language file:
**Loaded** : JROOT/components/com_myextension/language/en-GB/en-GB.com_myextension.ini
I'm trying to load the custom language file from the backend, because the strings are shared backend/frontend. I've tried moving it to the frontend and loading it from there to no avail. I've carefully checked for spelling mistakes. It doesn't work from a controller constructor either. Can anyone help me understand why this isn't working?