Start a FREE 7 day trial! Get training videos and books, plus expert support:  

Joomla Tutorials and Blog Posts

Translating and Modifying Joomla's Language files using Language Overrides

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

tutuploadsmedia_1318557225908.png

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.

Find the Translatable String

tutuploadsmedia_1318556868456.png

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

  • Note 1: If you don't have a reliable file manager then you can use an FTP program to download the file to your computer and edit it with a text editor and then re-upload it.
  • Note 2: Also, if you have any special characters (e.g. such as those used in Cyrillic languages) then it would be best to download the file and use a text editor such as notepad++ that can save the files as UTF-8 without BOM to ensure that the special characters are translated properly.
  • Note 3: If your Joomla site is set to another language rather than Great Britain English (which is the default) then navigate to that language folder instead rather than the en-GB folder.
tutuploadsmedia_1318558883142.png

Select utf-8 and click edit. If utf-8 without BOM is given as an option select it.

tutuploadsmedia_1318559129689.png

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.

Create an Override

tutuploadsmedia_1318559516354.png

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.

tutuploadsmedia_1318559625804.png

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.

tutuploadsmedia_1318560568037.png

Paste within the first empty line after the comments.

Modify the String Between the Double Quotes

tutuploadsmedia_1318568197853.png

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

Success!

tutuploadsmedia_1318568527254.png

Last step is to check your front-end to make sure everything worked as it should.

Video Showing How to Translating and Modifying Joomla's Language files using Language Overrides

 

Start a FREE 7 day trial! Get training videos and books, plus expert support: