mastox/react-i18-next-translation-bundle

为 react-i18next 提供的 Symfony 扩展包

dev-master 2021-06-18 19:30 UTC

This package is auto-updated.

Last update: 2024-09-19 02:18:50 UTC


README

安装

composer require mastox/react-i18-next-translation-bundle:@dev

注册路由

#/config/routes/annotations.yaml
react_i18_next_translation:
    resource: "@ReactI18NextTranslationBundle/Resources/config/routes/routes.xml"

注册扩展包

#/config/bundles.php
return [
    /* */
    Mastox\ReactI18NextTranslationBundle\ReactI18NextTranslationBundle::class => ['all' => true],
    /* */
];

如果您有 .php 扩展名的翻译文件,则创建一个 react_i18_next_translation.yaml 文件。目前支持 php 和 yaml。

#config/packages/dev || server/config/prod || server/config/
react_i18_next_translation:
  file_extension: 'xlf'

使用方法

localhost/react_i18_next_translation/locales/{LANG-KEY}/{NAMESPACE}.json

localhost/react_i18_next_translation/locales/fr/messages.json