Locale
The Locale module provides a mechanism to build apps that adapt to users using different languages, timezones, currencies and other local unit standards.
See the Locale guide to learn how to work with the Locale module.
Configuration
availableLocalesA hash array of available localizations the app supports, where each key is the locale name, and each value a hash array with the keys below. By default, a locale namedmainis defined with the following default values.domainsAn array of domains that will trigger this localization when the request to the app comes from one of them, or false if this is the only locale to be used always. Default:falselanguageThe language used in this localization, one of the availableLANGUAGE_?constants. Default:LANGUAGE_ENGLISHdateFormatThe date format used in this localization, one of the availableDATE_FORMAT_?constants. Default:DATE_FORMAT_MIDDLE_ENDIANtemperatureUnitsThe temperature units used in this localization, one of the availableTEMPERATURE_UNITS_?constants. Default:TEMPERATURE_UNITS_FAHRENHEITcurrencyThe currency used in this localization, one of the availableCURRENCY_?constants. Default:CURRENCY_USDdecimalMarkThe type character used when separating decimal digits in this localization, one of the availableDECIMAL_MARK_?constants. Default:DECIMAL_MARK_POINTmeasurementSystemThe measurement system used in this localization, one of the availableMEASUREMENT_SYSTEM_?constants. Default:MEASUREMENT_SYSTEM_IMPERIALtimeZoneThe timezone id used in this localization, from thecherrycake_location_timezonestable of the Cherrycake skeleton database. Default:532(532 is the id for the Etc/UTC time zone)
defaultLocaleThe locale name to use when it can not be auto-detected. Default:maincanonicalLocaleThe locale to consider canonical, used i.e. in the HtmlDocument module to set therel="canonical"meta tag, in order to let search engines understand that there are different pages in different languages that represent the same content.availableLanguagesAn array of the languages that are available for the app. The specifiedtextsTableNameshould contain at least the propertext_<language code>fields for this languages. From the availableLANGUAGE_? constants. Default:[LANGUAGE_ENGLISH]geolocationMethodThe method to use to determine the user's geographical location, one of the availableGEOLOCATION_METHOD_?constants.textsTableNameThe name of the table where multilingual localized texts are stored. See thecherrycake_locale_textstable in the Cherrycake skeleton database. Default:cherrycake_locale_textstextsDatabaseProviderNameThe name of the database provider where the localized multilingual texts are found. Default:maintextCategoriesTableNameThe name of the table where text categories are stored. See thecherrycake_locale_textCategoriestable in the Cherrycake skeleton database. Default:cherrycake_locale_textCategoriestextCacheProviderNameThe name of the cache provider that will be used to cache localized multilingual texts. Default:enginetextCacheKeyPrefixThe prefix of the keys when storing texts into cache. Default:LocaleTexttextCacheDefaultTtlThe default TTL for texts stored into cache. Default:CACHE_TTL_NORMALtimeZonesTableNameThe name of the table where the timezones are stored. See thecherrycake_location_timezonestable in the Cherrycake skeleton database. Default:cherrycake_location_timezonestimeZonesDatabaseProviderNameThe name of the database provider where the timezones are found. Default:maintimeZonesCacheProviderNameThe name of the cache provider that will be user to cache timezones. Default:enginetimeZonesCacheKeyPrefixThe prefix of the keys when storing timezones into cache. Default:LocaleTimeZonetimeZonesCacheDefaultTtlThe default TTL for timezones stored into cache. Default:CACHE_TTL_NORMAL
Constants
LANGUAGE_ENGLISHLANGUAGE_SPANISH
DATE_FORMAT_LITTLE_ENDIANAlmost all the world, like "20/12/2010", "9 November 2003", "Sunday, 9 November 2003", "9 November 2003"DATE_FORMAT_BIG_ENDIANAsian countries, Hungary and Sweden, like "2010/12/20", "2003 November 9", "2003-Nov-9, Sunday"DATE_FORMAT_MIDDLE_ENDIANUnited states and Canada, like "12/20/2010", "Sunday, November 9, 2003", "November 9, 2003", "Nov. 9, 2003", "Nov/9/2003"
TEMPERATURE_UNITS_FAHRENHEITTEMPERATURE_UNITS_CELSIUS
CURRENCY_USDCURRENCY_EURO
DECIMAL_MARK_POINTDECIMAL_MARK_COMMA
MEASUREMENT_SYSTEM_IMPERIALMEASUREMENT_SYSTEM_METRIC
HOURS_FORMAT_12HHOURS_FORMAT_24H
TIMESTAMP_FORMAT_BASICBasic formatting, like5/18/2020TIMESTAMP_FORMAT_HUMANHuman readable formatting, likemay 18th, 2020TIMESTAMP_FORMAT_RELATIVE_HUMANFormatting relative to now, like10 hours ago
ORDINAL_GENDER_MALEORDINAL_GENDER_FEMALE
GEOLOCATION_METHOD_CLOUDFLAREUses Cloudflare IP geolocation by reading theCF-IPCountryHTTP header added by Cloudflare when this option is enabled.
Last updated
Was this helpful?