I double- and triple-checked everything and I double- and triple-read the documentation, but my Joomla plugin refuses to read from the language files.
I have the xml file configured like this:
<files>
<filename plugin="fruits">fruits.php</filename>
<folder>language</folder>
</files>
<languages>
<language tag="en-GB">language/en-GB/en-GB.plg_fruits.ini</language>
<language tag="de-DE">language/de-DE/de-DE.plg_fruits.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="default_fruits"
type="integer"
default="An Integer"
label="JFIELD_PLG_FRUITS_DEFAULT_LABEL"
description="JFIELD_PLG_FRUITS_DEFAULT_DESC"
first="0"
last="10"
step="1"
/>
</fieldset>
</fields>
</config>
The version
attribute on the <extension>
is set to 3.6.
In the plugin directory I have a folder called "language" with two sub-folders ("de-DE" and "en-GB") and those folders hold the files de-DE.plg_fruits.ini
and en-GB.plg_fruits.ini
respectively.
Inside those files it respectively says: JFIELD_PLG_FRUITS_DEFAULT_LABEL="Apple" // "Apfel"
JFIELD_PLG_FRUITS_DEFAULT_DESC="Text" // "Text"
As I said, I can't find the mistake. When I turn on Joomla's language debugger it tells me:
**Not loaded** : JROOT/administrator/language/en-GB/en-GB.plg_fruits_fruits.ini
**Not loaded** : JROOT/plugins/age/age/language/en-GB/en-GB.plg_fruits_fruits.ini
I don't get a parsing error, but when I renamed the files to en-GB.plg_fruits_fruits.ini
it gave me a parse error for every line of the file, but at the same time tells me the files haven't been loaded.
I also tried protected $autoloadLanguage = true;
in the php file (that is otherwise empty apart for the basic Joomla setup) and it didn't affect anything.
Joomla Language files should be saved using the UTF-8 encoding
. You have to use a file editor that supports UTF-8 without BOM
e.g notepad++
(Free) or any other editor. PHP ini parser allows you to omit the double quotes around the value but in Joomla you cannot omit double quotes. It is mandatory. Avoid comments in the language files. This link will be a good reference for you https://docs.joomla.org/Creating_a_language_definition_file