Skip to content

Releases: ICanBoogie/CLDR

v4.0.0

01 Jul 21:14
Compare
Choose a tag to compare

New Requirements

Requires PHP 7.1+

New features

None

Backward Incompatible Changes

  • Numbers symbols are now represented by a Symbols instance instead of an array. Methods using numeric symbols have been updated. The currency symbol is no longer added to the numeric symbols, it is now a separated parameter.

     <?php
    
     /* @var ICanBoogie\CLDR\CurrencyFormatter $formatter */
     /* @var array $symbols */
    
     $formatter->format($number, $pattern, $symbols);
     <?php
    
     /* @var ICanBoogie\CLDR\CurrencyFormatter $formatter */
     /* @var ICanBoogie\CLDR\Numbers\Symbols $symbols */
     /* @var string $currencySymbol */
    
     $formatter->format($number, $pattern, $symbols, $currencySymbol);
  • List patterns are now represented by a ListPattern instance instead of an array. Methods using a list pattern have been updated.

     <?php
    
     /* @var ICanBoogie\CLDR\ListFormatter $formatter */
     /* @var array $list_pattern */
    
     $formatter->format([ 1, 2, 3 ], list_pattern);
     <?php
    
     /* @var ICanBoogie\CLDR\ListFormatter $formatter */
     /* @var ICanBoogie\CLDR\Locale\ListPattern $list_pattern */
    
     $formatter->format([ 1, 2, 3 ], list_pattern);
  • Removed NumberPattern:$format, it was never used.

  • Removed the localized() method on entities that don't naturally require access to the repository: NumberFormatter and ListFormatter. You can use $repository->locales['fr']->localize($formatter) to get a localized formatter, or the number_formatter and list_formater properties of the Locale object.

  • The fluent interface of units is now more on par with the rest of the API.

     <?php
    
     echo $units->duration_hour(23);
     echo $units->duration_hour(23, $units::LENGTH_SHORT);
     echo $units->volume_liter->per_unit(12.345, $units->duration_hour);
     echo $units->volume_liter->per_unit(12.345, $units->duration_hour, $units::LENGTH_SHORT);
     <?php
    
     echo $units->duration_hour(23);
     echo $units->duration_hour(23)->as_short;
     echo $units->volume_liter(12.345)->per($units->duration_hour);
     echo $units->volume_liter(12.345)->per($units->duration_hour)->as_short;

Deprecated Features

  • The localized currency formatter no longer supports a $symbols parameter. If you need to customize how a currency is formatted, create your own Symbols instance and use it with a non-localized formatter e.g. $repository->format_currency().

  • The localized list formatter no longer accepts a list pattern or a type, only a type. If you need to customize how a list is formatted, create you own ListPattern instance and use it with a non-localized formatter e.g. $repository->format_list().

Other Changes

  • Compatible with PHP 8.1+
  • Targets CLDR v36
  • Improved type annotations, including generics.

v3.0.3: Not all locales have context transforms

28 Apr 08:01
Compare
Choose a tag to compare
Fix #17 Not all locales have context transforms

v3.0.1: Merge pull request #16 from kornrunner/master

16 Feb 21:35
23b6ac5
Compare
Choose a tag to compare

Target CLDR 34, hosted on GitHub

25 Nov 01:56
Compare
Choose a tag to compare

Targeting CLDR 26, hosted by Unicode, was causing a lot of availability issues. We now target CLDR 34, which is hosted on GitHub and should be highly available. It's also the most recent version.

Updated requirements

New features

  • Added Repository::$available_locales
  • Added Repository::is_locale_available()

Other changes

  • Travis: Cache repository data
  • Add remote configuration for Xdebug

PHP 5.6, Providers and Cache

25 Nov 00:40
Compare
Choose a tag to compare

Updated requirements

  • PHP 5.6+

Backward incompatible changes

  • Extract cache feature from providers
  • Rename LocalizeAwareInterface as Localizable

Other changes

  • Add EditorConfig

v1.10.0

25 Nov 00:15
Compare
Choose a tag to compare

New features

  • Add LocalizedCurrency::name_for()
  • Add Calendar::format_datetime()
  • Add Calendar::format_date()
  • Add Calendar::format_time()

Currency formatters, percent formatters

25 Nov 00:09
Compare
Choose a tag to compare

New features

  • Refactored LocalizedCurrency, Added LocalizedCurrencyFormatter
  • Added Repository::$currency_formatter
  • Added Repository::format_currency()
  • Added Locale::$currency_formatter
  • Added Locale::format_currency()
  • Added Locale::format_percent()

Units

22 Sep 22:11
Compare
Choose a tag to compare

New features

  • Added support for unit formatting
  • Added Repository::format_number()
  • Added Repository::format_list()

Plurals

18 Sep 17:51
Compare
Choose a tag to compare

New features

  • Added support for Plurals
  • Added DateTimeFormatter::WIDTH_*

Other changes

  • Deprecated NumberFormatter::precision_from(), round_to(), parse_number()
  • Improved code coverage
  • A bunch of refactoring

Context transforms

15 Sep 21:27
Compare
Choose a tag to compare

New features

  • Added ContextTransforms
  • Added Locale::$context_transforms
  • Added Locale::context_transform()

Other changes

  • Calendar applies context transforms to its data