chunhei2008 / hyperf-translation
This package is abandoned and no longer maintained.
No replacement package was suggested.
v1.0.0
2019-07-31 07:52 UTC
Requires
- php: >=7.2
- ext-swoole: >=4.3
- hyperf/di: 1.0.*
- hyperf/framework: 1.0.*
- hyperf/utils: 1.0.*
- psr/container: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.14
- hyperf/testing: 1.0.*
- mockery/mockery: ^1.2
- phpstan/phpstan: ^0.10.5
- swoft/swoole-ide-helper: dev-master
This package is auto-updated.
Last update: 2020-08-30 01:38:48 UTC
README
About
chunhei2008/hyperf-translation 是对Laravel Translation的移植(不包含门面和快捷函数部分),具体使用方法可以参考Laravel Lang的使用。
Install
composer require chunhei2008/hyperf-translation
Config
publish config
php bin/hyperf.php vendor:publish chunhei2008/hyperf-translation
config path
your/config/path/autoload/translation.php
config content
<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://doc.hyperf.io
* @contact group@hyperf.io
* @license https://github.com/hyperf-cloud/hyperf/blob/master/LICENSE
*/
return [
'locale' => 'en',
'fallback_locale' => '',
'lang' => BASE_PATH . '/resources/lang',
];
Usage
$translator = $this->container->get(\Chunhei2008\Hyperf\Translation\Contracts\Translator::class);
$translator->trans('validation.accepted'),