Extension:CLDR/pl
Status wydania: stabilne |
|
|---|---|
| Realizacja | Tłumaczenia i języki |
| Opis | Provides functions to localize the names of languages, countries, currencies, and time units based on their language code. |
| Autor(zy) |
|
| Ostatnia wersja | 4.17.0 (Continous updates) |
| Polityka zgodności | Master utrzymuje kompatybilność wsteczną. |
| MediaWiki | 1.30+ |
| Zmiany w bazie danych | Nie |
| Composer | mediawiki/cldr |
| Pobieranie | Included in Language Extension Bundle or
README |
| Przykład | Translatewiki.net |
| Przetłumacz rozszerzenie CLDR jeżeli jest dostępne na 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.
Instalacja
- Pobierz i umieść plik(i) w katalogu o nazwie
cldrw folderzeextensions/.
Developers and code contributors should install the extension from Git instead, using:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/cldr
- Dodaj poniższy kod na dole twojego pliku LocalSettings.php:
wfLoadExtension( 'cldr' );
Zrobione – Przejdź do Special:Version na twojej wiki, aby sprawdzić czy rozszerzenie zostało pomyślnie zainstalowane.
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
Usage and parameters
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
Example
The language names are best access with MediaWiki core functions:
// Japanisch
$name = Language::fetchLanguageName( 'ja', 'de', 'all' );
Country names
CLDR defines the class CountryNames which has a static method, getNames().
CountryNames::getNames accepts one parameter:
- 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' );
}
Zobacz też
| To rozszerzenie jest wykorzystywane przez jeden lub więcej projektów Wikimedia. Oznacza to prawdopodobnie, że to rozszerzenie jest stabilne i działa wystarczająco dobrze, aby wykorzystywać je na stronach o dużym natężeniu ruchu. Odnajdź nazwę tego rozszerzenia w plikach konfiguracyjnych Wikimedia CommonSettings.php oraz InitialiseSettings.php, aby zobaczyć gdzie są zainstalowane. Pełną listę rozszerzeń zainstalowanych na określonej wiki można znaleźć na stronie Special:Version na danej wiki. |
| To rozszerzenie jest dołączone do następujących farm/hostów wiki lub pakietów: |
- Stable extensions/pl
- Internationalization extensions/pl
- Extensions supporting Composer/pl
- GetHumanTimestamp extensions/pl
- LanguageGetTranslatedLanguageNames extensions/pl
- GPL licensed extensions/pl
- Unicode licensed extensions/pl
- Extensions in Wikimedia version control/pl
- All extensions/pl
- Extensions used on Wikimedia/pl
- Extensions included in Canasta/pl
- Extensions included in Fandom/pl
- Extensions included in Miraheze/pl
- Extensions included in ProWiki/pl
- Extensions included in wiki.gg/pl
