2

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

...
<description>MOD_MYMODULE_DESC</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:

<languages>
    <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>
</languages>

What am I missing?

2
  • Have you defined MOD_MYMODULE_DESC in both the .ini and sys.ini files?
    – Lodder
    Mar 13, 2015 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, 2015 at 16:53

2 Answers 2

3

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

<!-- Installation / uninstallation script file -->
<scriptfile>script.php</scriptfile>

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.

1
  • 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, 2015 at 21:05
3

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>
</languages>

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

2
  • 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, 2015 at 11:22
  • I can confirm this behavior, the structure needs to be: "language/en-GB/en-GB.mod_mymodule.sys.ini" Same goes for plugins (thats why i was here). Where the "en-GB" Subfolder is NOT optional when you want to have a postInstallation message on a fresh install.
    – Marco
    Jul 28, 2021 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.