Category: Blog

You are excited about Joomla custom fields and you want to add them to your multi-lingual site - then you suddenly realise that you don't know how to make the custom fields multi-lingual.

You know you could add different versions of the same field - specifying the language for each of them.  The downside of this is that it becomes complex when you want to control the layout of your articles - with so many field and language combinations the template overrides quickly become difficult to manage. 

If you use separate custom fields for each language then the relevant ones would be included in your edit pages but filtering and ordering your articles based on these custom fields then becomes very cumbersome to manage.

There is another approach - using the Joomla language overrides system.

1. Select List, Radio and Checkbox Fields

You would create your custom field using special labels, descriptions and option values - for example:

Notice how the label, description and option texts are all capitalised and have no spaces.

If we now edit an article with this field it doesn't look very promising!

But then we start the magic - in the backend of Joomla go to Extensions -> Language(s) -> Overrides and create translations for these special strings.  Before you click 'New' make sure you change the filter on the left to the 'Administrator' version of the language you to translate

Then press 'New' and create your translation

 

 

IMPORTANT - make sure you click the checkbox 'For Both Locations' (this makes the translation available in the frontend and the backend of your site).  Then, once you have saved this translation and translated the field description and option text your article edit page is transformed.

The translated values also appear in the frontend too !!

Remember if you are using EasyLayouts to customise the ordering of your articles based on this custom field that the ordering is based on the custom field value and not the displayed text.

2. Text, Textarea and HTML Editor Fields

These fields are more straightforward.  The main requirements for text type fields is that the input/output field labels are translated and that the content can be set in each language.

Again you set the custom field label in capital letters with no spaces e.g.

 

Then create language overrides as above:

Now when you edit the article in Welsh you will see the translated field label