From 0b54b284bc13d962ab4fd2a60c81ae804a2164ec Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 27 Mar 2013 20:42:46 +0100 Subject: [PATCH] Updated i18n docs --- docs/en/topics/i18n.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/en/topics/i18n.md b/docs/en/topics/i18n.md index e94f2b45b..a497272bf 100644 --- a/docs/en/topics/i18n.md +++ b/docs/en/topics/i18n.md @@ -67,14 +67,35 @@ Formats can be set globally in the i18n class. These settings are currently only to write your own logic for any frontend output. :::php - i18n::set_date_format('dd.MM.YYYY'); - i18n::set_time_format('HH:mm'); + Config::inst()->update('i18n', 'date_format', 'dd.MM.YYYY'); + Config::inst()->update('i18n', 'time_format', 'HH:mm'); Most localization routines in SilverStripe use the [Zend_Date API](http://framework.zend.com/manual/en/zend.date.html). This means all formats are defined in [ISO date format](http://framework.zend.com/manual/en/zend.date.constants.html#zend.date.constants.selfdefinedformats), not PHP's built-in [date()](http://nz.php.net/manual/en/function.date.php). +### Language Names + +SilverStripe comes with a built-in list of common languages, listed by locale and region. +They can be accessed via the `i18n.common_languages` and `i18n.common_locales` [config setting](/topics/configuratio). + +In order to add a value, add the following to your `config.yml`: + + :::yml + i18n: + common_languages: + de_CGN: + name: German (Cologne) + native: Kölsch + +Similarly, to change an existing existing language label, you can overwrite one of these keys: + + i18n: + common_languages: + en_NZ: + native: Niu Zillund + ### i18n in URLs By default, URLs for pages in SilverStripe (the `SiteTree->URLSegment` property)