Ekstensi:CLDR

This page is a translated version of the page Extension:CLDR and the translation is 33% complete.
Other languages:
Manual ekstensi MediaWiki
OOjs UI icon advanced-invert.svg
CLDR
Status rilis: stabil
ExampleOfCLDRExtension.png
Implementasi Fungsi parser
Deskripsi Provides functions to localize the names of languages, countries, currencies, and time units based on their language code.
Perancang awal
Versi terbaru 4.11.0 (Pembaruan berkelanjuta)
MediaWiki 1.30+
Perubahan basis data Tidak
Composer mediawiki/cldr
Lisensi GPL-2.0-or-later, data variant of BSD 3-clauses
Unduh Disertakan dalam Paket Ekstensi Bahasa atau
README
Contoh Translatewiki.net
master
Terjemahkan ekstensi CLDR jika tersedia di translatewiki.net

Periksa matriks penggunaan dan versi.

The CLDR extension contains local language names for different languages, countries, currencies, and time units extracted from CLDR data. See translatewiki:CLDR for information.

Instalasi

  • Unduh dan letakkan berkas-berkasnya di dalam sebuah direktori yang bernama cldr di folder extensions/ Anda.
  • Tambahkan baris berikut di bawah LocalSettings.php Anda:
    wfLoadExtension( 'cldr' );
    
  •   Selesai – Telusuri ke Special:Version di wiki Anda untuk memastikan ekstensinya berhasil dipasang.

If you download from git, change the file from CLDR to cldr.

Memperbarui 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 http://www.unicode.org/Public/cldr/latest/core.zip
unzip core.zip -d core
php rebuild.php

Penggunaan dan parameter

Nama bahasa

CLDR defines the class LanguageNames which has a static method, getNames(). LanguageNames::getNames accepts three parameters:

  1. code - the ISO 639 (see here for details) code of the preferred language to return the list in
  2. fbMethod - fallback method. Should be set to one of the following:
    • LanguageNames::FALLBACK_NATIVE (default): Missing entries fallback to the native name
    • LanguageNames::FALLBACK_NORMAL: Missing entries fallback through the fallback chain
  3. 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 (default): All languages that are in Names.php
    • LanguageNames::LIST_MW_AND_CLDR: All languages that are either in MediaWiki or in CLDR

Example

The language names are best access with MediaWiki core functions:

// Japanisch
$name = Language::fetchLanguageName( 'ja', 'de', 'all' );

Nama negara

CLDR defines the class CountryNames which has a static method, getNames(). CountryNames::getNames accepts one parameter:

  1. code - the ISO 639 code of the preferred language to return the list in

Example

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' );
}

Nama mata uang

CLDR defines the class CurrencyNames which has a static method, getNames(). CurrencyNames::getNames accepts one parameter:

  1. code - the ISO 639 code of the preferred language to return the list in

Example

The following example sets a variable to the list of all currencies in CLDR in German.

if ( is_callable( array( 'CurrencyNames', 'getNames' ) ) ) {
    $currencies = CurrencyNames::getNames( 'de' );
}
CLDR includes a very large number of currencies, including many that are no longer in use.


Lihat juga