Article Index

Many admins are looking for a way to automatically have their module titles translated.
This to avoid creating duplicate modules for each language.

Creating a duplicate per language is the common advice. However there is another way. It does require a bit coding effort.

You do need to know how to work with language overrides in Joomla. Being aware on how template overrides work comes in handy too.

If your template has a file "templates/system/html/modules.php" you are ok. Else copy "modules.php" from "templates/system/html" to "templates/yourtemplate/html".

Open "modules.php" in "templates/yourtemplate/html" using your favourite editor or through the administrators template files editor.

Replace all




Attention! If you copied the system/html/modules.php you also need to rename all theĀ 

function modChrome_xxxx

to something else to avoid errors.

I myself named the functions

function modChrome_xxxx_alt

I used "_alt" as a suffix as I use it in a prefix later on.

Now save your altered "modules.php". Also make these changes to your template index.php file. Look for all styles and make the changes

<jdoc:include type="modules" name="left" style="html5_alt" />

In administrator go to "extensions -> modules".

Create or edit your module.

In "title" type the desired title in capitals and prefix it with "ALT_", spaces to become underscores. Example: "ALT_MY_TITLE_OF_CHOICE".

The ALT_ prefix is to ensure you can recognize it easy and also to ensure no other string can be picked up by the language overrides feature.

Save your module.

In administator go to "extensions -> languages -> Overrides".

In the filter select the language and instance "site", ie. "English (en-GB) - site".

Click New to create an override.

In "Language Constant" type your "ALT_MY_TITLE_OF_CHOICE" exact the way you did in your module title.

In 'Text" type you translation; "My title of choice".

Save and new (for each next language)

In the filter select the next language and instance, ie. "Nederlands (nl-NL) - Site".

In "Language Constant" type your "ALT_MY_TITLE_OF_CHOICE" exact the way you did in your module title.

In 'Text" type you translation; "Door mij gekozen titel".

Save and new (for each next language)... for as much languages you installed.

Now this module shows for all languages with a translated title.

Copyright © 2023 All Rights Reserved.