# i18n
**Repository Path**: mirrors_yiisoft/i18n
## Basic Information
- **Project Name**: i18n
- **Description**: Yii i18n
- **Primary Language**: Unknown
- **License**: BSD-3-Clause
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-08-19
- **Last Updated**: 2026-02-14
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
Yii Internationalization Library
[](https://packagist.org/packages/yiisoft/i18n)
[](https://packagist.org/packages/yiisoft/i18n)
[](https://github.com/yiisoft/i18n/actions?query=workflow%3Abuild)
[](https://codecov.io/gh/yiisoft/i18n)
[](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/i18n/master)
[](https://github.com/yiisoft/i18n/actions/workflows/static.yml?query=branch%3Amaster)
[](https://shepherd.dev/github/yiisoft/i18n)
The package provides common internationalization utilities:
- `Locale` stores locale information created from [BCP 47](https://www.rfc-editor.org/info/bcp47) formatted string. It
can parse locale string, modify locale parts, form locale string from parts, and derive fallback locale.
- `LocaleProvider` is a stateful service that stores current locale.
## Requirements
- PHP 8.0 - 8.5.
## Installation
The package could be installed with [Composer](https://getcomposer.org):
```shell
composer install yiisoft/i18n
```
## General usage
Use `Locale` as follows:
```php
$locale = new \Yiisoft\I18n\Locale('es-CL');
echo $locale->language(); // es
echo $locale->region(); // CL
$locale = $locale->withLanguage('en');
echo $locale->asString(); // en-CL
echo $locale
->fallbackLocale()
->asString(); // en
```
Use `LocaleProvider` as follows:
```php
use \Yiisoft\I18n\LocaleProvider;
final class MyService
{
public function __construct(
private LocaleProvider $localeProvider
) {
}
public function doIt(): void
{
$locale = $this->localeProvider->get();
if ($this->localeProvider->isDefaultLocale()) {
// ...
}
// ...
}
}
```
## Documentation
- [Internals](docs/internals.md)
If you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that.
You may also check out other [Yii Community Resources](https://www.yiiframework.com/community).
## License
The Yii Internationalization Library is free software. It is released under the terms of the BSD License.
Please see [`LICENSE`](./LICENSE.md) for more information.
Maintained by [Yii Software](https://www.yiiframework.com/).
## Support the project
[](https://opencollective.com/yiisoft)
## Follow updates
[](https://www.yiiframework.com/)
[](https://twitter.com/yiiframework)
[](https://t.me/yii3en)
[](https://www.facebook.com/groups/yiitalk)
[](https://yiiframework.com/go/slack)