Language files

From Jomres v4 manual

Jump to: navigation, search

Contents

Introduction

The language files can be found in /jomres/languages. They follow the 'old' Mambo style of language string definitions, looking similar to the following.

  1. define('_JOMRES_COM_MR_SHOWPROFILES','Show profiles');

You could edit that string to

  1. define('_JOMRES_COM_MR_SHOWPROFILES','List users');

To change the button in the configuration panel from "Show profiles" to "List Users".

The strings are shown in the Jomres output in one of two ways. Either by echoing the value of the definition, or by using the jr_gettext function. Two simple examples follow.

  1. echo _JOMRES_COM_MR_SHOWPROFILES;
  1. $variable = jr_gettext('_JOMRES_COM_MR_SHOWPROFILES',_JOMRES_COM_MR_SHOWPROFILES);

It depends on the context as to which is used.

  • Note, Jomres currently comes with 24 language files by default. These files are contributed back to the project by users of the software and as a result, apart from the English language files, they are invariably in different states of translation. This means that most of the non-English files will have some or many definitions which are still in their English form and it is the responsibility of the purchaser to ensure that the language file for their chosen language/languages suits their needs.

Discussion

There are quite a lot of language definitions in Jomres, somewhere in the region of 1000+. Some of them are unused as they were once used by now non-existent functionality. New language definitions are always added to the end of the language files which makes it easy for users who have upgraded to add their own definitions to the end of the file.

Language strings are used in two ways in Jomres, this is because some are passed through a Jomres function called jr_gettext, whereas others are used as is. In the administrator area functions the strings aren't generally passed through the jr_gettext function because they are unlikely to need much translation. Frontend, or guest facing strings, are passed through the jr_gettext function to offer us the Editing mode feature.

Whilst you can edit the language files, it's not the best way to translate Jomres. However, if you find that the Editing mode is a little too complex for you, or if you don't expect to upgrade Jomres in the future, then this is a good way to translate labels within the system.

To see more information about the PHP define function, please see the manual page http://uk2.php.net/manual/en/function.define.php

Property type specific language strings

Jomres offers you the ability to have different language files for different property types. When you create a new property type in the administrator area of Jomres you can give it a Title and a "Property type description". When this information is saved the Title is saved as it is entered into the relevant input but the Property type description has it's text cleaned up by removing non-latin text and spaces. Then a sub directory is created in the languages folder and a copy of the current language file is copied into this folder. This allows you to have different language files for different scenarios, and in fact Jomres comes with several different examples (campsite, vehiclerental and yachtbrokerage) to demonstrate this.


Upgrading Jomres

If you edit the language files, then obviously you'll need to back up your customised language files before you upgrade. Existing Jomres language strings will have been overwritten if they are part of the core languages.

If you then use the upgraded version of Jomres and use a new feature or configuration area, you might see something like the string _JOMRES_COM_MR_LISTTARIFF_TITLE instead of where you would expect to see a label (eg "Tariffs"). This is because the new version of the Jomres language file has definitions that your 'old' version does not, which is why it's best, when upgrading, to compare your customised language file with the core Jomres one and copy the new definitions from the core Jomres file to your customised file before replacing the core with the customised files.

Also note, if you have customised property types (see Property type specific language strings above) then they will not have been overwritten during the upgrade and you'll need to do the same thing to those files to ensure that you don't display unsightly text to your users.

A word of caution

You need to be careful when editing language files. A common problem is where French language users (who commonly use the ' (single quote) accidently introduce errors such as the following (My French is terrible, so translation examples will be in English).

  1. define('_JOMRES_COM_MR_SHOWPROFILES','Show p'rofiles');

The above string will cause a fatal error within PHP because the ' after the "p" has cut short the string to "Show p" and PHP cannot parse the "rofiles" afterwards in a meaningful way.

If you find yourself creating this problem, there are two ways to rewrite the line to make it work correctly. You could either wrap the entire string in " (double quotes) or escape the single quote using the \ symbol. Following are both working examples.

  1. define('_JOMRES_COM_MR_SHOWPROFILES',"Show p'rofiles");
  1. define('_JOMRES_COM_MR_SHOWPROFILES','Show p\'rofiles');

Contributing your translations to the Jomres community

We don't have the resources to ensure that all of the language files are translated for each and every version of Jomres that's released, which is why some files have been translated more than others. The non-English language files have been contributed by various memebers of the Jomres community over the years, and we rely on existing members contributing their versions of the language files back to the project.

If you'd like to contribute a translated file back to the project, that's great. It means that your translation will appear in the next version of Jomres (meaning there's less hassle for you when you upgrade) and other users will benefit from your work. The only thing we ask is that you sign the copyright of the translation over to Woollyinwales IT so that we can ensure that we can continue using the translation in the future.

Personal tools