How to translate a single word in a Joomla module or Joomla component?
Joomla gives the possibility to use language overrides and translate each word of the module, plugin, component if the value (actual text) is placed in the code of an extension with a language string. And now we can go to the next step of 2 scenarios:
- You know what constant you want to translate or override its translation - it means that you are ready to jump here How to override translation in Joomla 3
- You do not know the constant is but you know the value to translate, however, when you are looking for the string in language overrides then you get tons of results and have no idea which one you should translate - the solution can be the Debug Language option in Joomla backend. Once you find out the constant you may override translation for the value of a constant using language overrides in Joomla.
What is Language CONSTANT and its VALUE in Joomla?
Language Constant in Joomla is the unchanging item of the string you want to override. It's implemented in the modules, templates, components, etc. core code to give you the simple possibility to translate text.
MOD_LOGIN_FORGOT_YOUR_USERNAME = "Forgot your username?", where:
- MOD_LOGIN_FORGOT_YOUR_USERNAME is a language constant
- Forgot your username? is a value of a language constant
How to debug language in Joomla?
The easiest way to find out the constant name of the value you want to translate is using Language debug option available in the Joomla configuration.
Go to Joomla backend and navigate System - Global configuration - System tab and set Debug Language to Yes in Debug Settings. Language display must pick the Constant option.
It will result in displaying all constants of its values at the backend and frontend. It may be a little bit hard to navigate at the backend now but usually, the language constant includes its logic name meaning after its prefix_ which can be helpful for recognizing "where you are" :)
To revert the action to the standard view with language values displayed click here as shown below and remember to save settings.
How to translate language constants values in Joomla?
Each constant that can be easily translated in Joomla overrides is placed between asterisks.
To override the constant default value go to Extensions - Languages - Overrides at the Joomla backend.
Select a Language and the client (site or administrator) you want to override from and click the New button. If you have more language installed on your Joomla website then they appear in the selector as well.
Then follow steps in the following order:
- Enter here the constant name of the value you want to modify
- Select Constant item
- Click search button
- Results will be displayed below, click on the item you want to modify
- Modify the text
- Click Save button
The overridden language value is now available on the overrides lists:
Do you find this article helpful? Rate us with the 5 stars, thanks!