Introduction
The locale system localizes text in Perl, Template Toolkit, or JavaScript code. Localization refers to the translation of text in one language into multiple other languages, as well as the addition of cultural adaptations to make a product usable globally.
cPanel & WHM's locale system uses CPAN's Locale::Maketext
and Locale::Maketext::Utils
modules to perform the majority of its tasks. For detailed information about the module's methods and options, read CPAN's Locale::Maketext::Utils
documentation.
Note:
You cannot call the locale system directly from PHP applications. If you want localized text in your custom code, we strongly recommend that you use Perl or JavaScript, or that you display the text via a Template Toolkit file.
Locales
Each locale has a lexicon hash, which contains keys and values in bracket notation. Each value is the translated version of the key (or, for the default English locale ( en
), values are specifically empty). Typically, the key in the lexicon hash is the phrase itself, rather than an arbitrary lookup key.
The locale system uses ISO codes from the Unicode Common Locale Data Repository (CLDR) as locale names (for example, fr
for French or en_gb
for British English).
- Locale names for base languages may use ISO 639-1's two-letter system, while region-specific locale names include this two-letter code, an underscore (_), and the ISO 3166 two-letter standard.
en
is the default locale, anden_us
(American English) is an alias toen
. This means that you cannot create theen_us
locale separately, as you could withen_gb
.- In order to prevent missing phrases in region-specific locales, we merge regional lexicons with the base language's lexicon. For example, the Mexican Spanish (
es_mx
) lexicon contains some lexicon entries from the Spanish (es
) lexicon.
To view a list of the available locales on a cPanel & WHM server, navigate to WHM's View Available Locales interface (Home >> Locales >> View Available Locales). In cPanel & WHM version 11.46, we expanded the locale system to provide 29 distinct locales.
Important:
- The terms "locale" and "language" are not interchangeable. Multiple locales may use the same base language but implement different conventions for specific geographical, dialectical, or cultural distinctions. For example, cPanel, Inc. provides separate locales for Spanish and Latin American Spanish.
- The terms "lang" and "legacy" refer to cPanel & WHM's deprecated
LANG
localization system.
Localization tasks
Because of its flexibility, the locale system offers the following customization options:
- You can include translated phrases in custom interface templates or command line output.
- You can distribute locales. For more information, read our Distribute a Custom Locale documentation.
- You can delete custom locales. For more information, read our Delete a Locale documentation.
Warning:
We strongly recommend that you only create and modify locales through the WHM interface. Manual edits generally result in nonfunctional locales.