This part covers information that is important for internationalization and proper use of CLDR, but is not contained in the locale hierarchy. It is not localizable, nor is it overridden by locale data.
The documentation is divided into the following parts, mimicking Unicode's documentation:
- Part 1: Core (languages, locales, basic structure)
- Part 2: General (display names & transforms, etc.)
- Part 3: Numbers (number & currency formatting)
- Part 4: Dates (date, time, time zone formatting)
- Part 5: Collation (sorting, searching, grouping)
- Part 6: Supplemental (supplemental data)
The information about a territory is represented by a Territory instance, which aggregates information that is actually scattered across the CLDR.
<?php
/**
* @var ICanBoogie\CLDR\Repository $repository
*/
$territory = $repository->territory_for('FR');
echo $territory; // FR
echo $territory->currency; // EUR
echo $territory->currency_at('1977-06-06'); // FRF
echo $territory->currency_at('now'); // EUR
echo $territory->language; // fr
echo $territory->population; // 66259000
echo $territory->name_as('fr-FR'); // France
echo $territory->name_as('it'); // Francia
echo $territory->name_as('ja'); // フランス
echo $territory->name_as_fr_FR; // France
echo $territory->name_as_it; // Francia
echo $territory->name_as_ja; // フランス
echo $repository->territory_for('FR')->first_day; // mon
echo $repository->territory_for('EG')->first_day; // sat
echo $repository->territory_for('BS')->first_day; // sun
echo $repository->territory_for('AE')->weekend_start; // fri
echo $repository->territory_for('AE')->weekend_end; // sat
A localized territory can be obtained with the localize()
method, or the localize()
method of
the desired locale.
<?php
/**
* @var ICanBoogie\CLDR\Repository $repository
*/
$territory = $repository->territory_for('FR');
$localized_territory = $territory->localized('fr');
echo $territory->localized('fr')->name; // France
echo $territory->localized('it')->name; // Francia
echo $territory->localized('ja')->name; // フランス