Did you know that you can change any of the default text on your Joomla site without touching the language files?
The feature that makes this possible is called "Language Overrides".
In this tutorial, we'll show you how to use Language Overrides to safely customize your site's text.
A language string is composed of two parts: a specific language constant and its value.
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.
Step #1. Access the Language Overrides
- Go to Extensions > Language(s) > Overrides:
You will see the Languages: Overrides administrative page:
- Click New.
You will see the Languages: Edit Override administrative page:
- Locate the Search For field. Click Value and then click Constant:
- Enter OM_OSCAMPUS_LESSON_BECOME_A_MEMBER_TO_VIEW_LESSON into the Search field.
- Click on the blue Search button:
You will see the string and its text appeared in the Search Results box:
- Click anywhere inside that box.
- You will see the text "Become a member to view this session" appeared in the Text box. Replace it with the one you prefer.
- Click Save & Close.
You will be taken to the administrative Languages: Overrides page with your new override listed:
If you would like to edit the text of your language override, simply click on the constant:
You will be once again taken to already familiar to you Languages: Edit Override administrative page.
- Edit the language string text inside the Text box.
- Click Save & Close.
Can I Place Image In My Language String to Replace Its Text?
This question was asked below by one of the commenters to this post. The answer would be: "Yes, you can but you may not need to."
Technically, the Language Override allows you to place HTML tags, like the
img, either inside or instead of your language text strings.
If you wish, you can edit your Language Override to end up with the string looking similar to the one in the image below:
The whole purpose of you using Joomla Content Managment System, however, is to keep your content separate from presentation.
Check if you have better ways to do the same. Maybe, with your Joomla template? Maybe, with some custom CSS rules?