Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A Lithium plugin adding support for querying Unicode's CLDR.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 config
Octocat-spinner-32 extensions
Octocat-spinner-32 resources
Octocat-spinner-32 tests
Octocat-spinner-32 .gitignore
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.md
Octocat-spinner-32 composer.json
README.md

Introduction

From the CLDR project site:

The Unicode CLDR provides key building blocks for software to support the world's languages, with the largest and most extensive standard repository of locale data available. This data is used by a wide spectrum of companies for their software internationalization and localization, adapting software to the conventions of different languages [...]

The core g11n implementation in Lithium already utilizes the CLDR indirectly through the intl php extension, which makes use of ICU, which in turn is based upon the data provided by the CLDR. So at first sight there seems to be no need to access the CLDR directly. As more and more features are added to the intl extension it does not provide a way to access certain data yet. With the CLDR Catalog adapter contained in this plugin you can query the CLDR for this data. Currently there's support for:

  • Postal code validation rules for most countries (validation.postalCode).
  • List and translation of currencies (currency).
  • List and translation of languages (language).
  • List and translation of territories (territory).
  • List and translation of scripts (script).

Installation

Clone the project into your libraries directory.

git clone code@rad-dev.org:li3_cldr.git /path/to/project/libraries/li3_cldr

Make your Lithium app aware of the plugin by adding the following line to your bootstrap/libraries.php file.

Libraries::add('li3_cldr');

Currently the plugin does not contain the actual CLDR data. We must take the following steps to install it. Download the ZIP file of the latest release, unpack it into a temporary directory and move the common directory into place.

curl http://unicode.org/Public/cldr/1.8.0/core.zip --O core.zip
unzip core.zip -d /tmp
mv /tmp/common /path/to/project/libraries/li3_cldr/resources/g11n
Something went wrong with that request. Please try again.