Extension:CLDR
CLDR 확장은 CLDR 데이터에서 추출된 다양한 언어, 국가, 통화 및 시간 단위에 대한 현지 언어 이름을 포함하고 있습니다. 자세한 내용에 대해 translatewiki:CLDR을 참조하십시오.
Installation
미디어위키 확장 내려받기 지면에서 해당하는 버전을 다운로드하고 위키의 extensions 디렉토리에 cldr에 푸십시오.
또는 개발자와 코드 기여자는 대신 다음을 사용하여 Git에서 확장 프로그램을 설치해야 합니다.
cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/cldr
미디어위키 설정 LocalSettings.php에 다음을 추가하십시오:
wfLoadExtension( 'cldr' );
Special:Version에 접근해서 확장이 정상적으로 설치가 되었는지 확인하십시오.
만약 git에서 다운로드하면, 파일을 CLDR에서 cldr로 변경하십시오.
Updating data
CLDR 확장은 언어 파일에 미리 채워진 데이터와 함께 제공되지만, 만약 유니코드 컨소시엄에서 최신 데이터를 얻으려면, CLDR 사이트에서 다운로드한 다음 재구축 스크립트를 실행해야 합니다.
CLDR 사이트에서 최신 데이터 다운로드:
http://www.unicode.org/cldr/repository_access.html
예제 (cldr 디렉토리 내에서):
wget http://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' );
}
See also
이 확장은 하나 이상의 위키미디어 프로젝트 또는 다움위키에서 사용되고 있습니다. 이것은 아마도 확장이 안정적이고 높은-트래픽 웹 사이트에서 사용되기에 충분히 잘 작동한다는 것을 의미합니다. 위키미디어의 CommonSettings.php 및 InitialiseSettings.php 구성 파일에서 이 확장의 이름을 찾아 설치 위치를 확인하십시오. 특정 위키에 설치된 확장의 전체 목록은 위키의 Special:Version 페이지에서 볼 수 있습니다. |