My question is basically the same as in Joomla 3 Article Modal form field in custom module. How ever the solution proposed in the answer of that question produces a problem with the translation in my module.
The "Select article" field is correctly included in the params section of my module backend, but the strings are not translate:
I have used the following code to include the form field:
<fields name="params" addfieldpath="administrator/components/com_content/models/fields">
<fieldset name="..." label="..." >
<field name="id" type="modal_article"
label="Select Article" description="Article Id" />
...
</fieldset>
</fields>
The only visible difference I see is that I use name="params"
instead of name="basic"
. But if I use basic then the whole form field section disappears.
I have already tried different ways to import the language file but none has work so far.
Update: I had originally use the language override of Joomla to resolve this issue, now I needed to make the module portable and so I added the translations directly into the module:
I have created the following folder structure inside my module:
|-- ...
|-- tmpl/
|-- language/
\-- en-GB/
\--en-GB.mod_mymodule.ini
Then I added the following code to my mod_mymodule.xml:
<languages folder="language">
<language tag="en-GB">en-GB/en-GB.mod_mymodule.ini</language>
</languages>
And in the ini file I have defined the following variables:
COM_CONTENT_SELECT_AN_ARTICLE="Select an article"
COM_CONTENT_CHANGE_ARTICLE_BUTTON="Select / Change"
This works but it seems that the file name must follow the convention: <lang>.<module name>.ini
, where <lang>
is for example en-GB
and <module_name>
is for example mod_mymodule
. If the name is slightly different it does not seem to work.