Loading...
This tutorial will show how to modify and/or translate Joomla's language strings.
One of our students was wondering how to make the Terms of Service text into an active link when people registered on his site. So we created this tutorial for him and will use this Terms of Service example to show you how language overrides work in Joomla 1.7.
This tutorial was created in Joomla 1.7 but the same will apply for Joomla 2.5 (which has not been released at the time of this writing).
Get a context of what you're translating so that you know where to look. In this example, we will be modifying the text "Terms of Service" and making it linkable. We can make an educated guess that it's either in a Registration language file or a Profile language file. In order to enable the "Terms of Service" to appear in the Front-end, we had to use the "User - Profile" plugin in plugin Manager so that's another hint of where it's likely located.
Once you have a good context, the next step is to find the translatable string. Use your host's file manager (e.g. cPanel's or Plesk's File Manager) and the go to either your administrator/language/en-GB folder or your language/en-GB folder and open up the .ini file that you assume might hold your language string. If you make a wrong guess, don't worry, keep making educated guesses and you'll find it eventually.
For the "Terms of Service" text, I'm guessing that I'll find it in the en-GB.plg_user_profile.ini
Select utf-8 and click edit. If utf-8 without BOM is given as an option select it.
Search for your string by holding ctrl (for Macs hold command) and then clicking f (f stands for find). Then enter your string and search for it within the file. If the string is especially long, then only search for a small part of it to make it easier to find an exact match.
In our example we will search for "Terms of Service".
Success! Next we need to create a language override.
We are going to create a language override so that when we upgrade Joomla in the future, we won't lose our translations. Copy the whole line.
Now navigate to the language/overrides folder within the language folder (rather than the en-GB folder as we did previously). Look for en-GB.override.ini and edit it.
Note: If you're editing a text that appear within the administrator then you'd use administrator/language/overrides instead.
Paste within the first empty line after the comments.
Finally we can modify the string between the double quotes. In our case we're making it linkable.
Note if your translation needs to use Double Quotes: In the image above I've circled "_QQ_" (it has double quotes around it as well) which is used to represent double quotes. Since the language string is within double quotes if we were to add another set of double quotes it wouldn't be processed correctly, so instead we can use "_QQ_" or the HTML code " to represent double quotes to make sure Joomla knows we haven't reached the end of the language string. Don't use escaped double quotes (i.e. ") as that will break in PHP 5.2.x
Last step is to check your front-end to make sure everything worked as it should.
Copyright © . All Rights Reserved