- Translating WaypointHR
- The WaypointHR Database
- User authentication and security
Translating WaypointHR
WaypointHR can be translated into you preferred language. If you would like to share your translation files, please contact us or post a message on our support forums.
Overview
Language files for WaypointHR are separated into modules to ensure performance (as the language files need to be loaded by the web server on every page request or Ajax request).
A languages directory exists in the root folder for the most common message strings (module titles, 'save', 'cancel', and so on). Further languages directories then exist in each of the various module directories, containing the language strings specific to that particular module. (Whilst this can result is a small duplication of translation strings, it does help ensure the server runs efficiently.)
A list of available translations is maintained within the components/i18n.php file. You will need to add your locale to the $this->available_locales array. Follow the same format as the existing elements.
Your locale should follow a [langauge]-[country] format. This should be in lowercase, separated with a hyphen (-). If you are adding a default locale with no country specifier, repeat the language code (e.g. 'ru-ru'), then add an element to the $default_language_locales array. (For example 'ru'=>'ru-ru'.) This will allow your browser to detect your preferences.
Please note that if you update WaypointHR, any changes you make to existing files (such as i18n.php) will be lost. Similarly, if WaypointHR is extended to include a locale with the same filenames, these will also be overwritten. Therefore we encourage you to contact us so we can include your translations in our distribution. You should always ensure a backup of any files you have modified before updating WaypointHR.
How WaypointHR determines your locale
The first time you open WaypointHR, your language preferences will be determined by your browser settings. (Specifically, what your browser sends is its ACCEPT_LANGUAGE header.) If WaypointHR supports a language in your preferred list, the translation will appear automatically. If you wish to change the language, select 'Change language' on the login page (to the right of the first 'welcome' tab).
Once the preferred language has been detected, a cookie is set to remember your preference.
If you wish to override the setting, you can also add "&lang=en-gb" (or another locale) to the querystring parameters (the web address bar). Again, a cookie will be set to remember your preference.
Creating the translations
The default language for WaypointHR if English (United Kingdom). If a preferred language isn't available for a particular module (or for a required string within a module), the default language will be used.
Therefore, if you are creating a new translation file, it is best to start by copying the en-gb.php files. These will always contain a complete list of the required language strings.
The languages directory in the root folder contains the most common strings. The translation strings for individual modules are contained in a languages directory of each module. Again, copy the en-gb.php from the language module subdirectory.
The language files are PHP scripts that are included by the internationalisation component. The first line is a call to an add_strings function. You should change the first parameter of the function call to match the locale string you are using (from 'en-gb' to, for example, 'ru-ru'). All lowercase, separated by a hyphen (-).
The main body of the file is a series of array elements. For example...
'module_title_employees'=>'Employees',
Simply change the right hand side to your required translation. Please do not change the left hand side.
Wherever possible, we have kept the strings to complete sentences to make translation more practical.
Important! Some strings include parameters. You will see symbols such as %d or %s. These are replaced automatically when displayed. This allows for the text to be reordered to include the replacements. However, please keep the same number (and type) of parameters. (If you find a reason to change this, please contact us as this will most likely require changes to the calling function.)
Finally, please save your files as UTF-8 without a byte-order mark (BOM).
We would love to include your translations with our distribution of WaypointHR under our GPL license. Please contact us. (You may wish to contact us before starting your translations, as there may be someone else already working on your preferred language.)
Any comments or suggestions?
If you have any ideas for improving this page, please post your feedback in our community support forums.
Need additional support?
You can post your question in our forums, or please contact us for professional support and assistance.