Hello, In the series of Joomla 4 Tutorials, last time we have discussed, how to enable Debug and Error reporting in Joomla 4 and today we will be working with language overrides in Joomla 4.
Joomla is all built around language localization and lets you change the language strings of any text on your website without having to modify a single line of code. That’s how a multilanguage site works as well where the same code is used to display a totally different language.
In this tutorial we will be looking at:
- Enabling language to debug in Joomla so we can see what strings are possible to translate.
- Overview of language overrides manages.
- Locating and translating a language string.
Create Language Overrides in Joomla 4
How to enable the language to debug?
Let’s go ahead and enable the language to debug real quick to see what strings are translated and can be changed using the language overrides manager.
From your Joomla backend Go to System >> Global Configuration
On the Global Configuration screen, turn the switch on for Debug Language and save the configuration.
After enabling the language debug, you should see all the Joomla languages strings enclosed with ** (stars) **.
Anything that’s enclosed with starts is a valid Joomla language string and can be translated.
You can see the enclosed ** (starts) ** on the backend too as language tags work in the Joomla backend and frontend the same way. Don’t worry about the enclosed starts too much as they will go away once we turn off language debug in the Global Configuration.
How to create Language Overrides
Let’s try changing the username/password fields real quick to something fancy and see how that works in the backend.
Language overrides can be managed in System >> Manage >> Language Overrides
On the language overrides screen, click the New button
Please note that since we are adding an override for English, we can continue as it as it’s the default language (in my case). You can, however, use the filter on the left to switch to another language and add overrides for the particular language.
Here we will search for a value (in our case username).
You will get a lot of results and based on the word username as it’s included in a few different placed. The constant we are looking for is MOD_LOGIN_VALUE_USERNAME.
Clicking the particular string from the search would automatically populate the language constant on the left of the screen along with the text and we can change the text to whatever we need:
Click the Save button.
Go back to the frontend and you can see the username fields name changed.
And that’s it. You can change other fields by creating more languages overrides in the overrides manager. Don’t forget to switch off the language debug in the Global Configuration.