Guide to Locales

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, and en_us (American English) is an alias to en. This means that you cannot create the en_us locale separately, as you could with en_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. 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....