Locale and translations
One setting, $padLocale, says which language and conventions a request is written in. The {trans} tag and the trans, currency and localDate functions all read it.
|
PHP fragments/locale_1.php |
HTML fragments/locale_1.pad |
Result |
|---|---|---|
|
|
Je winkelwagen3 artikelen - Bewaard voor Ann € 1.234,50 - 5 oktober 2026 |
Catalogs
The texts live in _lang/<locale>.json, one flat object of keys:
{
"cart.title": "Je winkelwagen",
"cart.items": "%d artikel|%d artikelen",
"cart.owner": "Bewaard voor :name"
}
-
count=picks the plural form and replaces%d: two forms are one and other, three are zero, one and other. - Every other
name=replaces:name. - A catalog is looked up like a
_datafile: from the page's directory up to the application root, then_common, the most specific winning. Fornl_NLthe filesnl_NL.json,nl-NL.jsonandnl.jsonall count. - A key no catalog knows is written as itself.
Choosing the locale
-
$padLocale- the locale,'en'unless the configuration or the page says otherwise. -
$padLocales- the locales the application speaks. When it lists any, a?lang=nllink chooses one and thepadLangcookie keeps it; without a choice the visitor'sAccept-Languagepicks the best match. -
$padTimezone- the timezone dates are shown in.