xdg/locale
最新稳定版本:0.1.0
Composer 安装命令:
composer require xdg/locale
包简介
PHP library to work with POSIX locale identifiers.
README 文档
README
PHP library to work with POSIX locale identifiers.
Installation
composer require xdg/locale
Usage
Constructing locale objects
use Xdg\Locale\Locale; // from a POSIX locale identifier $locale = Locale::of('ca_ES@valencia'); // from an IETF (BCP47) language tag $locale = Locale::of('zh-Hans-CN'); // On Windows, windows-specific locale identifiers are accepted $locale = Locale::of('French_France.1252');
Locale matching
Locale matching is performed using the algorithm described in the XDG Desktop Entry specification.
use Xdg\Locale\Locale; $locale = Locale::of('fr_FR.UTF-8') $locale->matches('fr'); // => true $locale->matches('fr_BE'); // => false
Use Locale::select() to select the best match from a list of candidates.
use Xdg\Locale\Locale; $locale = Locale::of('fr_FR.UTF-8') $locale->select(['fr_CA', 'fr_BE', 'fr']); // => 'fr'
统计信息
- 总下载量: 74
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-10-12