https://github.com/hyperf/translation
A independent translation component
https://github.com/hyperf/translation
coroutine hyperf i18n swoole translation
Last synced: 10 months ago
JSON representation
A independent translation component
- Host: GitHub
- URL: https://github.com/hyperf/translation
- Owner: hyperf
- License: mit
- Created: 2019-08-22T08:57:05.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-25T03:34:09.000Z (over 1 year ago)
- Last Synced: 2024-09-25T16:04:16.284Z (over 1 year ago)
- Topics: coroutine, hyperf, i18n, swoole, translation
- Language: PHP
- Homepage: https://doc.hyperf.io/#/zh/translation
- Size: 71.3 KB
- Stars: 8
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Hyperf Translation
[hyperf/translation](https://github.com/hyperf/translation) 组件衍生于 `Laravel Translation` 组件的,我们对它进行了一些改造,大部分功能保持了相同。在这里感谢一下 Laravel 开发组,实现了如此强大好用的 Translation 组件。
## Installation
```bash
composer require hyperf/translation
```
## Configuration
### Publish config
```bash
php bin/hyperf.php vendor:publish hyperf/translation
```
Config files:
```
+ ./config/autoload/translation.php
```
### Configuration
```php
'en',
'fallback_locale' => '',
'path' => BASE_PATH . '/storage/languages',
];
```
## Usage
```php
$container = ApplicationContext::getContainer();
$translator = $container->get(\Hyperf\Contract\TranslatorInterface::class);
$translator->trans('validation.accepted');
```