Clone this repo:
  1. 392a30c Update to cldr 48 by Reedy · 7 weeks ago master
  2. e06f475 Localisation updates from https://translatewiki.net. by Translation updater bot · 5 days ago wmf/1.46.0-wmf.7 wmf/branch_cut_pretest wmf/next
  3. 4ee6c2f Localisation updates from https://translatewiki.net. by Translation updater bot · 7 days ago
  4. 9144449 build: Updating eslint-config-wikimedia to 0.32.3 by libraryupgrader · 12 days ago
  5. e969b92 Add Shughni (sgh) to LocalNamesEn.php by ToluAyo · 3 weeks ago

mediawiki/extensions/cldr

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