Adding language files to Jomres

From Jomres v4 manual

Jump to: navigation, search

If you wish to add a new language file to Jomres, there are a number of changes that you will need to make.

To start with, you'll need to create a new language file, say Indian. We'll use the long short-code "hi-IN".

The easiest way to do this is to use an existing language file as a base to work from, for example the English en-GB.php. Copy it to a new file and rename that file to hi-IN.php. Now you can open it and edit the language strings inside (see Language files for more information) until you're satisfied with your translation.

Assuming that you edited the file locally, next you need to upload this file into the /jomres/languages folder.

Next, we need to tell Jomres that this file exists, so navigate to /jomres/libraries/jomres/classes and open the file jomres_language.class.php. There are two arrays we need to edit to add the language file.

The first is the method define_langfile_to_languages_array. This method provides the cross reference between the long short-code and the actual language as shown in the Jomres language switcher (not to be confused with the Joomfish language switcher, if installed). In this method there are the following lines:

  1. $langs['zh-CN']="Chinese";
  2. return $langs;

Add Indian to it by doing the following.

  1. $langs['zh-CN']="Chinese";
  2. $langs['hi-IN']="Indian";
  3. return $langs;

Exactly where you place it in the array doesn't really matter as the array is sorted later on in this class anyway.

Next, if you're using Joomfish and it's short short-codes, then you'll also need to modify the method get_shortcode_to_longcode.

  1. $langs['no']='nb-NO';
  2. if (array_key_exists($lang,$langs) )
  3. return $langs[$lang];

Add 'in' to the array like so:

  1. $langs['no']='nb-NO';
  2. $langs['in']='hi-IN';
  3. if (array_key_exists($lang,$langs) )
  4. return $langs[$lang];

Finally, you may need to use the Jomres administrator function "Choose Languages" to include the new Indian language file in the language switcher dropdown.

Personal tools