PHP Classes
elePHPant
Icontem

PHP CLDR: Retrieve locale details from Unicode CLDR files

Recommend this page to a friend!

  Author Author  
Name: Payam Naderi <contact>
Classes: 11 packages by
Country: Iran Iran
Innovation award
Innovation award
Nominee: 2x


  Detailed description   Download Download .zip .tar.gz  
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

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.


  Classes of Payam Naderi  >  PHP CLDR  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: PHP CLDR
Base name: cldr
Description: Retrieve locale details from Unicode CLDR files
Version: -
PHP version: 5
License: MIT/X Consortium License
 
  Groups   Applications   Files Files  

  Groups  
Group folder image Localization Internationalization and translations View top rated classes
Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Text processing Manipulating and validating text data View top rated classes


  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  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

Download Download all files: cldr.tar.gz cldr.zip
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.