charm/i18n

Provides a Locale and Collator instance based on a Psr\Http\ServerRequestInterface.

0.0.2 2021-06-16 15:21 UTC

This package is auto-updated.

Last update: 2024-04-09 16:23:55 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();