Cherrycake
ExamplesGithub
version 2.x alpha
version 2.x alpha
  • Introduction
  • Status
  • Changelog
  • Migration
  • Architecture
    • Basics
    • Modules
    • Classes
    • Lifecycle
      • Deep lifecycle
    • Performance
    • Security
    • Patterns
      • Files structure
    • Items
    • Server requirements
  • Guide
    • Getting started
      • Skeleton start
      • Docker start
    • Modules guide
    • Classes guide
    • Actions guide
      • Complex actions
      • Variable path components
      • Accept GET or POST parameters
      • Getting the URL of an action
      • Cached actions
      • Brute force attacks
    • Patterns guide
      • Passing variables to a pattern
      • Nested patterns
      • Cached patterns
    • Cache guide
      • Time To Live
      • Using cache
      • Lists
      • Queues
      • Pools
    • Database guide
      • Basic queries
      • Prepared queries
      • Cached queries
      • Cache key naming
      • Removing queries from cache
    • Items guide
      • Item cache
      • Item lists
      • Items custom filters
      • Items custom ordering
      • Mixing filters and ordering
      • Items with relationships
      • Items cache
    • HtmlDocument guide
    • Css and Javascript guide
      • Modules injecting CSS and JavaScript
    • Session guide
    • Login guide
      • Creating a complete login workflow
    • Locale guide
      • Multilingual texts
      • Domain based site localization
    • Log guide
      • Loading Log events from the database
    • Stats guide
      • Stats events with additional dimensions
      • Loading Stats events from the database
    • Janitor guide
      • Janitor tasks configuration files
    • Command line interface
    • Debugging
  • Reference
    • Core modules
      • Actions
        • Actions methods
      • Browser
      • Cache
        • Cache methods
      • Css
        • Css methods
      • Database
      • Email
      • Errors
      • HtmlDocument
        • HtmlDocument methods
      • ItemAdmin
      • Janitor
        • Janitor methods
      • Javascript
        • Javascript methods
      • Locale
        • Locale methods
      • Log
        • Log methods
      • Login
        • Login methods
      • Output
        • Output methods
      • Patterns
        • Patterns methods
      • Security
        • Security methods
      • Session
        • Session methods
      • Stats
        • Stats methods
      • SystemLog
      • TableAdmin
      • Translation
      • Validate
    • Core classes
      • Action
        • Action methods
        • Action properties
      • AjaxResponseJson
      • BasicObject
        • BasicObject methods
      • CacheProvider
        • CacheProvider methods
      • Color
      • DatabaseProvider
        • DatabaseProvider methods
      • DatabaseResult
        • DatabaseResult methods
        • DatabaseResult properties
      • DatabaseRow
      • Engine
        • Engine methods
        • Engine properties
      • Gradient
      • Item
        • Item methods
        • Item properties
      • Items
        • Items methods
        • Items properties
      • Image
      • JanitorTask
        • JanitorTask methods
        • JanitorTask properties
      • LogEvent
        • LogEvent methods
        • LogEvent Properties
      • LogEvents
        • LogEvents methods
      • Module
        • Module methods
        • Module properties
      • Response
      • Request
        • Request methods
      • RequestParameter
        • RequestParameter methods
      • RequestPathComponent
        • RequestPathComponent methods
      • Result
      • StatsEvent
        • StatsEvent properties
      • StatsEvents
        • StatsEvents methods
      • SystemLogEvent
        • SystemLogEvent methods
        • SystemLogEvent properties
      • SystemLogEvents
        • SystemLogEvents methods
  • Code conventions
  • License
  • Extras
Powered by GitBook
On this page
  • Configuration
  • Constants

Was this helpful?

  1. Reference
  2. Core modules

Locale

The Locale module provides a mechanism to build apps that adapt to users using different languages, timezones, currencies and other local unit standards.

PreviousJavascript methodsNextLocale methods

Last updated 4 years ago

Was this helpful?

See the to learn how to work with the Locale module.

Configuration

  • availableLocales A 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 named main is defined with the following default values.

    • domains An 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: false

    • language The language used in this localization, one of the available LANGUAGE_? constants. Default: LANGUAGE_ENGLISH

    • dateFormat The date format used in this localization, one of the available DATE_FORMAT_? constants. Default: DATE_FORMAT_MIDDLE_ENDIAN

    • temperatureUnits The temperature units used in this localization, one of the available TEMPERATURE_UNITS_? constants. Default: TEMPERATURE_UNITS_FAHRENHEIT

    • currency The currency used in this localization, one of the available CURRENCY_? constants. Default: CURRENCY_USD

    • decimalMark The type character used when separating decimal digits in this localization, one of the available DECIMAL_MARK_? constants. Default: DECIMAL_MARK_POINT

    • measurementSystem The measurement system used in this localization, one of the available MEASUREMENT_SYSTEM_? constants. Default: MEASUREMENT_SYSTEM_IMPERIAL

    • timeZone The timezone id used in this localization, from the cherrycake_location_timezones table of the . Default: 532 (532 is the id for the Etc/UTC time zone)

  • defaultLocale The locale name to use when it can not be auto-detected. Default: main

  • canonicalLocale The locale to consider canonical, used i.e. in the module to set the rel="canonical" meta tag, in order to let search engines understand that there are different pages in different languages that represent the same content.

  • availableLanguages An array of the languages that are available for the app. The specifiedtextsTableName should contain at least the proper text_<language code> fields for this languages. From the available LANGUAGE_? constants. Default: [LANGUAGE_ENGLISH]

  • geolocationMethod The method to use to determine the user's geographical location, one of the available GEOLOCATION_METHOD_? constants.

  • textsTableName The name of the table where multilingual localized texts are stored. See the cherrycake_locale_texts table in the . Default: cherrycake_locale_texts

  • textsDatabaseProviderName The name of the database provider where the localized multilingual texts are found. Default: main

  • textCategoriesTableName The name of the table where text categories are stored. See the cherrycake_locale_textCategories table in the . Default: cherrycake_locale_textCategories

  • textCacheProviderName The name of the cache provider that will be used to cache localized multilingual texts. Default: engine

  • textCacheKeyPrefix The prefix of the keys when storing texts into cache. Default: LocaleText

  • textCacheDefaultTtl The default TTL for texts stored into cache. Default: CACHE_TTL_NORMAL

  • timeZonesTableName The name of the table where the timezones are stored. See the cherrycake_location_timezones table in the . Default: cherrycake_location_timezones

  • timeZonesDatabaseProviderName The name of the database provider where the timezones are found. Default: main

  • timeZonesCacheProviderName The name of the cache provider that will be user to cache timezones. Default: engine

  • timeZonesCacheKeyPrefix The prefix of the keys when storing timezones into cache. Default:LocaleTimeZone

  • timeZonesCacheDefaultTtl The default TTL for timezones stored into cache. Default: CACHE_TTL_NORMAL

Constants

  • LANGUAGE_ENGLISH

  • LANGUAGE_SPANISH

  • DATE_FORMAT_LITTLE_ENDIAN Almost all the world, like "20/12/2010", "9 November 2003", "Sunday, 9 November 2003", "9 November 2003"

  • DATE_FORMAT_BIG_ENDIAN Asian countries, Hungary and Sweden, like "2010/12/20", "2003 November 9", "2003-Nov-9, Sunday"

  • DATE_FORMAT_MIDDLE_ENDIAN United states and Canada, like "12/20/2010", "Sunday, November 9, 2003", "November 9, 2003", "Nov. 9, 2003", "Nov/9/2003"

  • TEMPERATURE_UNITS_FAHRENHEIT

  • TEMPERATURE_UNITS_CELSIUS

  • CURRENCY_USD

  • CURRENCY_EURO

  • DECIMAL_MARK_POINT

  • DECIMAL_MARK_COMMA

  • MEASUREMENT_SYSTEM_IMPERIAL

  • MEASUREMENT_SYSTEM_METRIC

  • HOURS_FORMAT_12H

  • HOURS_FORMAT_24H

  • TIMESTAMP_FORMAT_BASIC Basic formatting, like 5/18/2020

  • TIMESTAMP_FORMAT_HUMAN Human readable formatting, like may 18th, 2020

  • TIMESTAMP_FORMAT_RELATIVE_HUMAN Formatting relative to now, like 10 hours ago

  • ORDINAL_GENDER_MALE

  • ORDINAL_GENDER_FEMALE

GEOLOCATION_METHOD_CLOUDFLARE Uses by reading the CF-IPCountry HTTP header added by Cloudflare when this option is enabled.

Cloudflare IP geolocation
Locale guide
HtmlDocument
Cherrycake skeleton database
Cherrycake skeleton database
Cherrycake skeleton database
Cherrycake skeleton database