How to Translate a Single Text String in a Joomla Site

Did you know that you can translate any of the default text on your Joomla site without touching the core language files? The feature that makes this possible is called "Language Overrides". In this tutorial, we'll show you how to use the "Language Overrides" to change a single text string.

A language string is composed of two parts: a specific language constant and its value.

constant value pairing

The COM_OSCAMPUS to the left of the equal sign in the image above is a language string constant. The OSCampus Pro text to the right of the equal sign is a language string value.

The constant is needed for Joomla code. The value is the very text which will be displayed in a label.

Without this feature, if you wanted to write your own labels and text messages you need to actually go to your /language/ folder and replace language strings.

You now don't need any knowledge of coding to change a text of your Joomla labels. It doesn't affect the core files. Delete your changes and revert back. It is just a piece of cake!

For the purpose of this tutorial, you will replace the "Become a member to view this session" text for your OSCampus Pro sign-up page by its string.

First let's acess the language overrides

  • Go to Extensions > Language(s) > Overrides:

extensions languages overrides

You will see the Languages: Overrides administrative page:

language overrides

  • Click New.

click new

You will see the Languages: Edit Override administrative page:

languages edit overrides

  • Locate the Search For field. Make sure the field displays the Value option:

make sure the field is set to value

  1. Enter Become a member into the Search field.
  2. Click on the blue Search button:

enter the text click the search button

You will see the string and its text appeared in the Search Results box:

you will see the text to be changed

  1. Click anywhere inside that box.
  2. You will see the text "Become a member to view this session" appeared in the Text box. Replace it with the one you prefer.
  3. Click Save & Close.

replace the text click save and close

You will be taken to the administrative Languages: Overrides page with your new override listed:

override listed

If you would like to further tweak the text of your newly created language override, simply click on the constant:

click on the constant to edit language override

You will be once again taken to already familiar to you Languages: Edit Override administrative page. 

  1. Edit the language string text inside the Text box.
  2. Click Save & Close.

edit text save and close


Adding Images to Language Strings

One Joomlashack user asked if they can include images in language overrides. The answer is: "Yes, you can but you may not need to."

Technically, the Language Override allows you to place HTML tags, such as the img either inside or instead of your language text strings. If you want, you can edit your Language Override to end up with the string looking similar to the one in the image below:

image inside language string

However, the best approach with content management systems is normally to keep your content separate from presentation. Before you do this, check to see if you have better ways to get the same result.