New Year 2018 present from CoalaWeb! Get 20% off for the entire month of January. More Info

Language Override

Do you need to change some text being used by a CoalaWeb extension on a multi lingual website? Your first step would be to install a language pack but what if you are looking to edit the name of a custom field? Then you need a language override.

Table of Contents

  1. Intro
  2. Terminology
  3. Scenario
  4. Override
  5. Need More Help?

Intro

In this guide I will show you how to create a language override for a multi lingual site. It will be using the CoalaWeb Contact extension as an example and more specifically the custom input field option.

Depending on what version of CoalaWeb Contact you are using you will have one or more custom fields. If you have a single language site you could use the inbuilt component options to change it's label and associated messages but for a multi lingual site its a bit more complicated.

Terminology

Before you start creating language overrides it's important to know a few terms that will be used when talking about language strings.

Contained inside each of the language files used through out a Joomla website are a series of language strings. Each of these strings are made up of two elements a Constant the reference to the language string which comes first and is in capitals.

COM_CWCONTACT_LABEL_CUSTOM1

The second part if the Value which will change depending on the particular language of the file in question.

Custom 1

When we deal with language overrides the system will take care of formating the Constant and Value together for us but just for your own knowledge if you were to open a language file they would be display like this:

COM_CWCONTACT_LABEL_CUSTOM1="Custom 1"

Scenario

I want to change the Custom 1 field in my contact form to Phone Number and I have a website with both English and Spanish. To do this I will be updating the custom field's label. [Figure-1]

Figure-1

The Constant that we will be applying the override to is:

COM_CWCONTACT_LABEL_CUSTOM1

Override

To get started log into the backend of your site and then go to:

Extensions -> Language(s)

Constant Known

Next select Overrides from the side menu. For this example I want to create a language override for Spanish and it will be applied to Administrator because thats where the language strings are stored in this case.

Note: We will also make sure it is applied to the front end in a future step.

To get started I first select Spanish (español) - Administrator from the bottom left menu and then New from the top menu. [Figure-2]

Figure-2

Next enter the Language Constant to be overridden. [Figure-3]

COM_CWCONTACT_LABEL_CUSTOM1

Figure-3

Next enter the text to be displayed instead of the original text. [Figure-4]

Figure-4

Next tick the For both locations option because although the language string is stored in the Administrator language location we want it to be applied to the Site part where the module is displayed. [Figure-5]

Figure-5

Now after you save your new override it will be displayed in the list of Spanish (español) - Administrator and Spanish (español) - Site overrides .

Now try refreshing your site to see the contact form with its new label in action. [Figure-6]

Figure-6

Note: You would also have to repeat the process for the other two associated language strings.
COM_CWCONTACT_CUSTOM1_HINT
COM_CWCONTACT_MSG_CUSTOM1_MISSING

Constant Not Known

In this case it gets a bit more complicated because the language file that contains the Constant and Value that I want to override is English - Administrator and the override will need to be applied to Spanish. Now to find out the correct Constant we will first select English - Administrator from the side menu and then New from the top menu. [Figure-7]

Figure-7

Now I'm not sure what the exact language Constant is so I'm going to use the search option to the right. For example if I wanted to see what the Constant for the Custom 1 label is I could set the Search For option to Value and then type Custom 1 in the search field and click search. [Figure-8]

Figure-8

In most cases you will have to have a look through the returned option to get the exact one you are looking for. [Figure-9]

Figure-9

Now that we have our Constant we can select Spanish (español) - Administrator from the bottom left menu and then New from the top menu. [Figure-10]

Note: We will also make sure it is applied to the front end in a future step.

Figure-10

Next enter the Language Constant to be overridden. [Figure-11]

COM_CWCONTACT_LABEL_CUSTOM1

Figure-11

Next enter the text to be displayed instead of the original text. [Figure-12]

Figure-12

Next tick the For both locations option because although the language string is stored in the Administrator language location we want it to be applied to the Site part where the module is displayed. [Figure-13]

Figure-13

Now after you save your new override it will be displayed in the list of Spanish (español) - Administrator overrides.

Now try refreshing your site to see the contact form with its new label in action. [Figure-14]

Figure-14

Note: You would also have to repeat the process for the other two associated language strings.
COM_CWCONTACT_CUSTOM1_HINT
COM_CWCONTACT_MSG_CUSTOM1_MISSING

Need More Help

Do you have a question that wasn't covered by this GUIDE? Then it's time to drop by the Forum
Written by Steven Palmer Tuesday, 26 January 2016 Posted in General, Extensions, Facebook JS, Gears, Flair, Traffic, Social Links, Hours, News, Contact, Versions, Date, Analytics

GET IN TOUCH

We will be glad to help you with any general or technical questions.