hyperf / translation
An independent translation component, forked by illuminate/translation.
Fund package maintenance!
Open Collective
hyperf.wiki/#/zh-cn/donate
Installs: 1 392 473
Dependents: 62
Suggesters: 6
Security: 0
Stars: 8
Watchers: 3
Forks: 2
Open Issues: 1
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.42
- 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-11-21 02:16:19 UTC
README
hyperf/translation 组件衍生于 Laravel Translation
组件的,我们对它进行了一些改造,大部分功能保持了相同。在这里感谢一下 Laravel 开发组,实现了如此强大好用的 Translation 组件。
Installation
composer require hyperf/translation
Configuration
Publish config
php bin/hyperf.php vendor:publish hyperf/translation
Config files:
+ ./config/autoload/translation.php
Configuration
<?php declare(strict_types=1); return [ 'locale' => 'en', 'fallback_locale' => '', 'path' => BASE_PATH . '/storage/languages', ];
Usage
$container = ApplicationContext::getContainer(); $translator = $container->get(\Hyperf\Contract\TranslatorInterface::class); $translator->trans('validation.accepted');