PHP Classes
elePHPant
Icontem

PHP CLDR: Retrieve locale details from Unicode CLDR files

Recommend this page to a friend!
  Info   View files Documentation   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-05-15 (4 months ago) RSS 2.0 feedNot yet rated by the usersTotal: 33 All time: 9,654 This week: 328Up
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

  Performance   Level  
Name: Payam Naderi <contact>
Classes: 13 packages by
Country: Iran Iran
Age: 36
All time rank: 226032 in Iran Iran
Week rank: 85 Up2 in Iran Iran Up
Innovation award
Innovation award
Nominee: 2x

 

Details

[[ 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  
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  /  Poirot  
File Role Description
Files folder imageCldr (1 file, 3 directories)

  Files folder image Files  /  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  /  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  /  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  /  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  /  repoLdml  
File Role Description
  Accessible without login Plain text file README.txt Doc. Documentation

 Version Control Unique User Downloads Download Rankings  
 100%
Total:33
This week:0
All time:9,654
This week:328Up