CLDR extension contains local language names for different languages, countries, and currencies extracted from CLDR data

Installs: 8 000

Dependents: 0

Suggesters: 1

Security: 0

Stars: 7

Watchers: 7

Forks: 10

Type:mediawiki-extension

2024.07 2024-07-25 07:46 UTC

This package is auto-updated.

Last update: 2024-11-22 07:40:27 UTC


README

This extension extracts a subset of core CLDR data and makes it available to PHP.

Currently, it provides the following:

  • Country names
  • Currency names and symbols
  • Language names
  • Units of time

Installation

Clone the source to MediaWiki extensions/ and enable it in LocalSettings.php:

wfLoadExtension( 'cldr' );

Updating data

Look up the latest release of CLDR and note the version number.

Update the version number in CLDR_CORE_URL in Makefile. Run make:

make all

Example usage

	if ( ExtensionRegistry::isLoaded( 'cldr' ) ) {
		// Get the English translation of all available language names.
		$languages = LanguageNames::getNames( 'en' ,
			LanguageNames::FALLBACK_NATIVE,
			LanguageNames::LIST_MW_AND_CLDR
		);
	} else {
		// Fall back to the MediaWiki core function without CLDR.
		$languages = Language::getLanguageNames( false );
	}