Internationalisation
Using CivCRM in a language other than US-English¶
CiviCRM uses US English by default but supports translation into a wide range of other languages with varying degrees of completeness.
If you want to help out with translations visit the translation documentation.
To enable use of CiviCRM in a new language translation you need to
- download the translation files
- install them in the appropriate directory
- select the language in the Language settings
The exact instructions on how to download and install the translations files differ between platforms:
Changing the default CiviCRM language after installation¶
Once you have installed the translation files, you can change the language used by CiviCRM:
- Go to Administer > Localization > Languages, Currency, Location
- Select the new default language.
- Update the default currency, money formatting options, default country, etc.
You will also probably want to update the date and time formats:
- Go to Administer > Localization > Date Formats
Finally, you may notice that many other options in CiviCRM will not be correctly translated:
- Individual prefixes (Mrs, M, etc)
- Gender options (M, F, other)
- Address Location Types
- Some fieldsets in the "Edit Contact" screen
These are known in CiviCRM as Option Values, and there are many of these.
To avoid having to change every single setting, you can install the following extension: fixoptiontranslations. Once the extension is enabled, all options will be translated. The extension can then be uninstalled and removed.
Updating translation files¶
The easiest way to update your translations regularly is to use the l10n update extension:
The "l10n update" extension will do a daily check to update the translation files for CiviCRM core, as well as for extensions. Every night, around 2 AM (North American Eastern Time), the CiviCRM website packages updated translation files. These are available at the following address: https://download.civicrm.org/civicrm-l10n-core/mo/xx_XX/civicrm.mo
where xx_XX
is an ISO language code corresponding to one CiviCRM has published translations for.
For example, for Spanish CiviCRM core:
wget https://download.civicrm.org/civicrm-l10n-core/mo/es_ES/civicrm.mo
For the CDN Tax Receipts extension in Canadian French:
wget https://download.civicrm.org/civicrm-l10n-extensions/mo/cdntaxreceipts/fr_CA/cdntaxreceipts.mo
Storing translation files in another directory¶
By default, CiviCRM looks in [civicrm.root]/l10n
for translation files. Since CiviCRM 5.23, there is a new setting available to store those files in another directory. This can be convenient when files are updated regularly, or when using the l10nupdate extension, which requires the files to be web-writable. More information, see PR15408. As of this writing, this setting only applies to core translations, not extensions.
Native gettext¶
gettext
is the mechanism by which strings are translated. By default, CiviCRM uses the PHP-Gettext implementation. This implementation can cause a 20-30% performance loss.
Since CiviCRM 4.2, it is possible to use native gettext
. This may require some changes to your hosting environment and is therefore recommended mainly for sites hosted on dedicated environments (VPS or dedicated server, it may not work on shared hosting).
To enable it:
- PHP must have
gettext
support compiled in (it usually is the case, seephpinfo()
for more information). Debian and Ubuntu include it by default. - The operating system must have the locale enabled. For example, on Linux-based systems, this is in
/etc/locale.gen
, or by typing this command:
locale -a
Debian/Ubuntu systems can enable locales by typing:
dpkg-reconfigure locales
Note
The "UTF-8" variant of the locale must be enabled. For example: "fr_FR.UTF-8".
Apache or PHP-FPM must be restarted after adding a new locale. Finally, uncomment the following in civicrm.settings.php:
define('CIVICRM_GETTEXT_NATIVE', 1);