3

I'm writing a module for Joomla 3.4.3 and having issues with I18N.

My module directory structure:

+ mod_mymodname
  + tmpl
    - default.php
  + language
    + de-DE
      - de-DE.mod_mymodname.ini
      - de-DE.mod_mymodname.sys.ini
    + en-GB
      - en-GB.mod_mymodname.ini
      - en-GB.mod_mymodname.sys.ini
  - helper.php
  - mod_mymodname.php
  - mod_mymodname.xml

In my mod_mymodname.xml:

<extension type="module" version="3.1.0" client="site" method="upgrade">
    <name>MOD_MYMODNAME_XML_NAME</name>
    <description>MOD_MYMODNAME_XML_DESC</description>
    <files>
        <filename>mod_mymodname.xml</filename>
        <filename module="mod_mymodname">mod_mymodname.php</filename>
        <filename>helper.php</filename>
        <folder>tmpl</folder>
        <folder>language</folder>
    </files>
    <languages folder="language">
        <language tag="en-GB">en-GB/en-GB.mod_mymodname.ini</language>
        <language tag="en-GB">en-GB/en-GB.mod_mymodname.sys.ini</language>
        <language tag="de-DE">de-DE/de-DE.mod_mymodname.ini</language>
        <language tag="de-DE">de-DE/de-DE.mod_mymodname.sys.ini</language>
    </languages>
    <config>
        <fields name="params">
            <fieldset name="basic">
                <field name="myfieldname"
                       type="integer"
                       default="5"
                       label="MOD_MYMODNAME_FIELD_MYFIELDNAME_LABEL"
                       description="MOD_MYMODNAME_FIELD_MYFIELDNAME_DESC"
                       first="1"
                       last="10"
                       step="1"/>
            </fieldset>
        </fields>
    </config>
</extension>

In my en-GB.mod_mymod.ini (the .sys. ones are exactly the same):

MOD_MYMODNAME_XML_NAME="My Module Name"
MOD_MYMODNAME_XML_DESC="My Module Name is a sample module for Joomla! 3.x"
MOD_MYMODNAME_FIELD_MYFIELDNAME_LABEL="Set a number"
MOD_MYMODNAME_FIELD_MYFIELDNAME_DESC="My Module Name wants to have a number from you"

The de-DE version contains the German strings of course.

When I switch the complete Joomla system to de-DE (site, administrator, content) the administrative interface of Joomla is in German (as expected). Now I'm install (or even already have installed) my module via the extension installer (zip archive) and open the module settings. My module settings (config fields) are having the en-GB strings instead of the de-DE ones. The rest of the interface including the generic module settings are still in German.

What did I miss in order to create an I18N compatible Joomla 3.x module?

1

I'm not sure but your module definition/installation file should look more like this:

<extension type="module" version="3.1.0" client="site" method="upgrade">
    <name>mod_mymodname</name>
    <description>MOD_MYMODNAME_XML_DESC</description>
    <files>
        <folder>language</folder>
        <filename module="mod_mymodname">mod_mymodname.php</filename>
        <filename>mod_mymodname.xml</filename>
    </files>
    <languages folder="language">
        <language tag="en-GB">en-GB/en-GB.mod_mymodname.ini</language>
        <language tag="en-GB">en-GB/en-GB.mod_mymodname.sys.ini</language>
        <language tag="de-DE">de-DE/de-DE.mod_mymodname.ini</language>
        <language tag="de-DE">de-DE/de-DE.mod_mymodname.sys.ini</language>
    </languages>
    <config>
        <fields name="params">
            <fieldset name="basic">
                <field name="myfieldname"
                       type="integer"
                       default="5"
                       label="MOD_MYMODNAME_FIELD_MYFIELDNAME_LABEL"
                       description="MOD_MYMODNAME_FIELD_MYFIELDNAME_DESC"
                       first="1"
                       last="10"
                       step="1"/>
            </fieldset>
        </fields>
    </config>
</extension>

Here you can find full tutorial: https://docs.joomla.org/J3.x:Creating_a_simple_module/Introduction

  • I used that tutorial and sorry... I can't point any difference between your version an mine. Edit: I striped the most out of the manifest to have a minimal example. Now I see you have the module itself with files. I also do have it among other files in my original manifest. – burnersk Jul 13 '15 at 6:23
  • So add correct XML file and file structure to your question. Cause what you added in your question doesn't make sense. In file structure you added mod_mymodname but in xml file you have mod_mymodname , also you didn't declare module main file. You have to add all files of you module in XML declaration. – Artur Stępień Jul 13 '15 at 9:49
  • So I updated questions manifest – burnersk Jul 13 '15 at 10:23
  • I created a module (administration module) using your markup. Only created mod_mymodname.php file and language files. Here it is: filedropper.com/modmymodname_1 and it works like it should when I switch from Polish to English language. So it have to be something wrong with your files. Please add content of all your files. – Artur Stępień Jul 13 '15 at 10:48

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.