I'm using a language string in my module's XML file for the description:


The first time I install the module, the string is NOT parsed:

Module description

If I re-install or update the extension, the complete text is loaded from the language file. How can I display the complete description also the first time the module is installed?

The language files are declared later in the XML file:

    <language tag="en-GB">en-GB.mod_mymodule.ini</language>
    <language tag="en-GB">en-GB.mod_mymodule.sys.ini</language>
    <language tag="es-ES">es-ES.mod_mymodule.ini</language>
    <language tag="es-ES">es-ES.mod_mymodule.sys.ini</language>

What am I missing?

  • Have you defined MOD_MYMODULE_DESC in both the .ini and sys.ini files? – Lodder Mar 13 '15 at 16:49
  • Yes, sys.ini defines only the name and the description (MOD_MYMODULE and MOD_MYMODULE_DESC), and the .ini file defines these and several other strings. – johanpw Mar 13 '15 at 16:53

You can use several functions when a extension it's installed if you define a script in your xml...

<!-- Installation / uninstallation script file -->

Then you can use the renderPostInstallation() function in this file to render text or anything you want, this method always works...

Check the Akeeba backup extension for example it uses this script.

| improve this answer | |
  • Thank you, that might be a better approach, I'll consider that. I'm still curious as to why the problem occurs, though. – johanpw Mar 13 '15 at 21:05

After some testing, it appears that this happens when the language files are placed directly under the extension's root directory, and not inside a /language/ folder.

If I move the language files to /language/en-GB/ and language/es-ES, and modify the XML manifest like this, it works:

<languages folder="language">
    <language tag="en-GB">en-GB/en-GB.mod_mymodule.ini</language>
    <language tag="en-GB">en-GB/en-GB.mod_mymodule.sys.ini</language>
    <language tag="es-ES">es-ES/es-ES.mod_mymodule.ini</language>
    <language tag="es-ES">es-ES/es-ES.mod_mymodule.sys.ini</language>

Now all strings are parsed, also on the initial installation.

| improve this answer | |
  • Would be nice to know if you did try to keep the language files in the extension directory and remove the <languages..> part from the xml file? – fruppel Jul 25 '15 at 11:22

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.