Binds CLDR to ICanBoogie
<?php $app = ICanBoogie\boot(); # Getting the CLDR echo get_class($app->cldr); // ICanBoogie\CLDR\Repository echo $app->cldr->locales['fr']['languages']['fr']; // français # Getting the current locale, defaulting to 'en' locale echo get_class($app->locale); // ICanBoogie\CLDR\Locale echo $app->locale; // en # Setting the current locale to French $app->locale = 'fr-FR'; echo get_class($app->locale); // ICanBoogie\CLDR\Locale echo $app->locale; // fr-FR echo $app->language; // fr
The following prototype methods are provided:
ICanBoogie\Application::lazy_get_cldr_provider: A lazy getter that returns a ProviderCollection instance. A FileProvider instance is used in the collection and is configured to use
<ICanBoogie\REPOSITORY>cache/cldras cache directory. A APCStorage instance is also part of the collection if APC is available.
ICanBoogie\Application::lazy_get_cldr: A lazy getter that returns a Repository instance created with the CLDR provider.
ICanBoogie\Application::set_locale: Sets the locale used by the application.
ICanBoogie\Application::get_locale: Returns the locale used by the application.
The package requires PHP 5.6 or later.
The recommended way to install this package is through Composer:
$ composer require icanboogie/bind-cldr
The package is available on GitHub, its repository can be cloned with the following command line:
$ git clone https://github.com/ICanBoogie/bind-cldr.git
The package is documented as part of the ICanBoogie framework
documentation. You can generate the documentation for the package
and its dependencies with the
make doc command. The documentation is generated in the
directory. ApiGen is required. You can later clean the directory with
make clean command.
The test suite is ran with the
make test command. Composer is
automatically installed as well as all dependencies required to run the suite. You can later
clean the directory with the
make clean command.
The package is continuously tested by Travis CI.
icanboogie/bind-cldr is licensed under the New BSD License - See the LICENSE file for details.