charm / i18n
Provides a Locale and Collator instance based on a Psr\Http\ServerRequestInterface.
0.0.2
2021-06-16 15:21 UTC
Requires
- charm/error: ^0
- psr/http-message: ^1.0
This package is auto-updated.
Last update: 2024-12-09 17:59:34 UTC
README
Given a ServerRequestInterface object, provides essential instances for internationalization; in particular the \Collator class and the \Locale class.
Installation
composer require charm/i18n
Usage
// A Locale instance from the current request
$locale = Charm\I18n\Locale::fromRequest($serverRequest);
// The system default Locale instance
$locale = Charm\I18n\Locale::instance();
// A Collator instance from the current request
$collator = Charm\I18n\Collator::fromRequest($serverRequest);
// The system default Collator instance
$collator = Charm\I18n\Collator::instance();