PHP Classes

PHP CLDR: Retrieve locale details from Unicode CLDR files

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 38 All time: 10,933 This week: 206Up
Version License PHP version Categories
cldr 1.0.0MIT/X Consortium ...5Localization, PHP 5, Text processing
Description 

Author

This package can retrieve locale details from Unicode CLDR files.

It can parse XML files downloaded from the Unicode CLDR repository to extract locale details of several types.

Currently it can retrieve details extracted from CLDR files like:

- The language
- Territory
- The languages list
- The language name by locale
- The scripts list
- The scripts name by type
- The territories list
- A territory name
- The variants list
- A variant name
- The measurement system names
- The character order,
- A date fields name,
- A date relative time steps name
- A date future and past times name by count
- The time z one names list
- A time zone name by code
- A calendar era name
- A calendar era abbreviated name
- A calendar era narrow name
- The calendar months list
- A calendar month name

Picture of Payam Naderi
  Performance   Level  
Name: Payam Naderi <contact>
Classes: 15 packages by
Country: United States United States
Age: 41
All time rank: 2016286 in United States United States
Week rank: 43 Up5 in United States United States Up
Innovation award
Innovation award
Nominee: 2x

Documentation

[[ Work in progress ]]

I will put more example and documentation.

at very basic, you may use something like this:


$locale = \Locale::getDefault();
$mainProvider = new \Poirot\Cldr\DataProvider\MainProvider($locale);

echo $mainProvider->getCharacterOrder(); // right-to-left

/*
array(3) {
  ["metric"]=>
  string(10) "?????"
  ["UK"]=>
  string(20) "??????????"
  ["US"]=>
  string(16) "????????"
}
*/
$mn = $mainProvider->getMeasurementSystemNames();

$mainProvider->setLocale('en');
echo $mainProvider->getTerritoryName('IR'); // Iran

/Use custom data path/
// Iran
echo $mainProvider->getRepoReader()
    ->getEntityByPath(
        'localeDisplayNames/territories/territory',
        array('type' => 'IR')
    );

Support

To report bugs or request features, please visit the Issue Tracker.

Please feel free to contribute with new issues, requests and code fixes or new features.


  Files folder image Files (11)  
File Role Description
Files folder imagePoirot (1 directory)
Files folder imagerepoLdml (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (11)  /  Poirot  
File Role Description
Files folder imageCldr (1 file, 3 directories)

  Files folder image Files (11)  /  Poirot  /  Cldr  
File Role Description
Files folder imageDataProvider (3 files)
Files folder imageRepoBrowser (2 files)
Files folder imageRepoReader (2 files)
  Plain text file LocaleData.php Class Class source

  Files folder image Files (11)  /  Poirot  /  Cldr  /  DataProvider  
File Role Description
  Plain text file MainProvider.php Class Class source
  Plain text file ProviderAbstract.php Class Class source
  Plain text file ProviderInterface.php Class Class source

  Files folder image Files (11)  /  Poirot  /  Cldr  /  RepoBrowser  
File Role Description
  Plain text file BrowserInterface.php Class Class source
  Plain text file LDMLRepo.php Class Class source

  Files folder image Files (11)  /  Poirot  /  Cldr  /  RepoReader  
File Role Description
  Plain text file LDMLReader.php Class Class source
  Plain text file ReaderInterface.php Class Class source

  Files folder image Files (11)  /  repoLdml  
File Role Description
  Accessible without login Plain text file README.txt Doc. Documentation

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:38
This week:0
All time:10,933
This week:206Up