hyperf / translation
一个独立的翻译组件,由 illuminate/translation 分支而来。
v3.1.35
2024-08-08 02:28 UTC
Requires
- php: >=8.1
- hyperf/contract: ~3.1.0
- hyperf/macroable: ~3.1.0
- hyperf/support: ~3.1.0
- hyperf/utils: ~3.1.0
- psr/container: ^1.0 || ^2.0
- 3.1.x-dev
- dev-master / 3.1.x-dev
- v3.1.35
- v3.1.33
- v3.1.27
- v3.1.15
- v3.1.0
- v3.1.0-rc.11
- v3.1.0-rc.4
- v3.1.0-alpha.1
- 3.0.x-dev
- v3.0.42
- v3.0.37
- v3.0.22
- v3.0.18
- v3.0.17
- v3.0.16
- v3.0.15
- v3.0.0
- v3.0.0-rc.13
- v3.0.0-rc.3
- v3.0.0-rc.1
- v3.0.0-beta.1
- v3.0.0-alpha.4
- v3.0.0-alpha.1
- 2.2.x-dev
- v2.2.33
- v2.2.13
- v2.2.5
- v2.2.0
- v2.2.0-beta1
- 2.1.x-dev
- v2.1.0
- v2.1.0-beta1
- 2.0.x-dev
- v2.0.18
- v2.0.13
- v2.0.3
- v2.0.0
- 1.1.x-dev
- v1.1.26
- v1.1.17
- v1.1.16
- v1.1.6
- v1.1.3
- v1.1.0
- 1.0.x-dev
- v1.0.14
- v1.0.13
This package is auto-updated.
Last update: 2024-09-08 02:56:06 UTC
README
hyperf/translation 组件是从 Laravel Translation
组件衍生出来的,我们对它进行了一些改造,大部分功能保持不变。在此感谢 Laravel 开发组,实现了如此强大且易用的 Translation 组件。
安装
composer require hyperf/translation
配置
发布配置
php bin/hyperf.php vendor:publish hyperf/translation
配置文件
+ ./config/autoload/translation.php
配置
<?php declare(strict_types=1); return [ 'locale' => 'en', 'fallback_locale' => '', 'path' => BASE_PATH . '/storage/languages', ];
用法
$container = ApplicationContext::getContainer(); $translator = $container->get(\Hyperf\Contract\TranslatorInterface::class); $translator->trans('validation.accepted');