Расширение:CLDR
Статус релиза: стабильно |
|
|---|---|
| Описание | Предоставляет функции для локализации названий языков, стран, валют и единиц времени на основе их языковых кодов. |
| Автор(ы) |
|
| Последняя версия | 4.17.0 (Постоянные обновления) |
| MediaWiki | 1.30+ |
| Изменения в БД | Нет |
| Composer | mediawiki/cldr |
| Лицензия | GPL-2.0-or-later, data variant of BSD 3-clauses |
| Скачать | Included in Language Extension Bundle or
README |
| Пример | Translatewiki.net |
| master | |
| Переведите расширение CLDR, если оно доступно на translatewiki.net | |
The CLDR extension contains local language names for different languages, countries, currencies, and time units extracted from CLDR data. See translatewiki:CLDR for information.
Установка
- Скачайте и распакуйте файл(ы) в папку с названием
cldrв вашей папкеextensions/.
Вместо этого разработчикам и соавторам кода следует установить расширение из Git, используя:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/cldr
- Добавьте следующий код в конце вашего файла LocalSettings.php:
wfLoadExtension( 'cldr' );
Готово – Перейдите на страницу Special:Version на своей вики, чтобы удостовериться в том, что расширение успешно установлено.
If you download from git, change the file from CLDR to cldr.
Updating data
The CLDR extension comes with data pre-populated in the language files, but if you want to get the latest data from the Unicode Consortium, you'll need to download it from the CLDR site and then run a rebuild script.
Download newest data from CLDR site:
http://www.unicode.org/cldr/repository_access.html
Example (from within the cldr directory):
wget https://www.unicode.org/Public/cldr/latest/core.zip
unzip core.zip -d core
php rebuild.php
Использование и параметры
Language names
CLDR defines the class LanguageNames which has a static method, getNames().
LanguageNames::getNames accepts three parameters:
- code – the ISO 639 (see Manual:Language#Language code for details) code of the preferred language to return the list in
- fbMethod – fallback method, it should be set to one of the following:
- LanguageNames::FALLBACK_NATIVE - Missing entries fallback to the native name (default)
- LanguageNames::FALLBACK_NORMAL - Missing entries fallback through the fallback chain
- list – which languages to return. Should be set to one of the following:
- LanguageNames::LIST_MW_SUPPORTED - Only languages that have localization in MediaWiki
- LanguageNames::LIST_MW - All languages that are in
Names.php(default) - LanguageNames::LIST_MW_AND_CLDR - All languages that are either in MediaWiki or in CLDR
Пример
The language names are best access with MediaWiki core functions:
// Japanisch
$name = Language::fetchLanguageName( 'ja', 'de', 'all' );
Названия стран
CLDR defines the class CountryNames which has a static method, getNames().
CountryNames::getNames принимает один параметр
- code - the ISO 639 code of the preferred language to return the list in
Пример
The following example sets a variable to the list of all countries in CLDR in French.
if ( is_callable( array( 'CountryNames', 'getNames' ) ) ) {
$countries = CountryNames::getNames( 'fr' );
}
См. также
| Это расширение используется в одном или нескольких проектах Викимедиа. Вероятно, это означает, что расширение стабильно и работает достаточно хорошо, чтобы использоваться такими сайтами с высоким трафиком. Найдите название этого расширения в файлах конфигурации Викимедиа CommonSettings.php и InitialiseSettings.php, чтобы узнать, где оно установлено. Полный список расширений, установленных на конкретной вики, можно увидеть на странице Special:Version wiki. |
| Это расширение включено в следующие вики-фермы/хостинги и/или пакеты: |
- Stable extensions/ru
- Extensions with invalid or missing type/ru
- Extensions supporting Composer/ru
- Extensions with unknown license/ru
- Extensions in Wikimedia version control/ru
- GetHumanTimestamp extensions/ru
- LanguageGetTranslatedLanguageNames extensions/ru
- All extensions/ru
- Extensions used on Wikimedia/ru
- Extensions included in Canasta/ru
- Extensions included in Fandom/ru
- Extensions included in Miraheze/ru
- Extensions included in ProWiki/ru
- Extensions included in wiki.gg/ru
- Localisation extensions/ru
