nuXed / 翻译
nuXed 翻译
v2.0.1
2020-11-23 05:46 UTC
Requires
- hhvm: ~4.83.1 || ~4.84.0
- hhvm/hsl: ^4.41
- hhvm/type-assert: ^4.1.2
- nuxed/contract: ^2.0
- nuxed/filesystem: ^2.0
- nuxed/json: ^2.0
Requires (Dev)
- facebook/difflib: ^1.1.1
- facebook/fbexpect: ^2.7.7
- facebook/hh-clilib: ^2.5.2
- hhvm/hacktest: ^2.0
- hhvm/hhast: ^4.82.2
- hhvm/hhvm-autoload: ^3.1.6
README
nuXed 翻译
nuXed 翻译组件提供了国际化应用程序的工具。
安装
此软件包可以使用 Composer 安装。
$ composer require nuxed/translation
示例
use namespace Nuxed\Translation; use namespace Nuxed\Translation\Loader; <<__EntryPoint>> async function main(): Awaitable<void> { $translator = new Translation\Translator('en'); $translator->addLoader('json', new Loader\JsonLoader()); // "translation/messages.en.json"s content : // { // "hello": "Hello {name}" // } $translator->addResource('json', 'translation/messages.en.json', 'en'); // "translation/messages.fr.json"s content : // { // "hello": "Bonjour {name}" // } $translator->addResource('json', 'translation/messages.fr.json', 'fr'); echo await $translator->trans('hello', dict['name' => 'saif']); // Hello saif echo await $translator->trans('hello', dict['name' => 'saif'], 'fr'); // Bonjour saif }
安全
有关报告 nuXed 中安全漏洞的信息,请参阅 SECURITY.md。
许可证
nuXed 是开源软件,根据 MIT 许可证许可。