Update index.md

The piece in the docs regarding adding a value to the list of common languages is not valid anymore.

SS4 uses the php-intl extension,  so before adding an extra locale, the user needs to check whether the installed ICU lib on the server supports it.

If that is the case,  the locale can added through the config system by adding a piece of yaml.
This commit is contained in:
Lars Prakken 2021-01-21 15:23:30 +01:00 committed by GitHub
parent a2d7dd081d
commit 7a1a1dc132
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,31 +103,20 @@ that gets presented to them. Currently this is a mix of PHP defaults (for readon
browser defaults (for `DateField` on browsers supporting HTML5), and [Moment.JS](http://momentjs.com/)
client-side logic (for `DateField` polyfills and other readonly dates and times).
### Language Names
### Adding locales
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](/developer_guides/configuration).
SilverStripe now uses the php-intl extension. Before adding an extra locale, make sure the ICU library on your server supports it (see https://www.php.net/manual/en/resourcebundle.locales.php for more info).
They can be accessed via the `SilverStripe\i18n\Data\Intl\IntlLocales.locales` [config setting](/developer_guides/configuration).
In order to add a value, add the following to your `config.yml`:
```yml
SilverStripe\i18n\i18n:
common_locales:
de_CGN:
name: German (Cologne)
native: Kölsch
SilverStripe\i18n\Data\Intl\IntlLocales:
locales:
fr_LU: French (Luxembourg)
```
Similarly, to change an existing language label, you can overwrite one of these keys:
```yml
SilverStripe\i18n\i18n:
common_locales:
en_NZ:
native: Niu Zillund
```
### i18n in URLs