@abhashmi/lingui-multi 中文文档教程
Lingui Multi
这是一个命令行实用程序,用于使用 js-lingui cli api< 从单个(统一的)消息 JSON 文件生成多个目录文件/a>。 在尝试使用此实用程序之前,请确保您的应用程序使用 js-lingui。
Setup
将以下内容添加到项目的 package.json 文件中:
"lingui-multi": {
"sub_catalog_name": {
"srcPathIgnorePatterns": [
"<ignore_folder>",
"<ignore_folder_2>"
...
]
},
"sub_catalog_2_name": {
"srcPathIgnorePatterns": [
"<ignore_folder_3>",
"<ignore_folder_4>"
...
]
}
}
每个子目录将包括 package.json 文件中为 lingui 定义的源路径中使用的所有 i18n 翻译,减去 lingui 配置或 lingui-multi 中定义的忽略模式子目录配置。
Usage
您可以通过执行包提供的命令来运行该实用程序,如下所示:
lingui-multi <path-to-application-package.json> <path-to-locale-directory>
该实用程序将从 package.json 文件中获取 lingui 配置和 lingui-multi 配置,并在 locale 目录中以 < 格式输出目录文件;sub_catalog>.messages.js
每个子目录。
Lingui Multi
This is a command line utility for generating multiple catalog files from a single (unified) messages JSON file using js-lingui cli api. Please ensure your application uses js-lingui before attempting to use this utility.
Setup
Add the following to your project's package.json file:
"lingui-multi": {
"sub_catalog_name": {
"srcPathIgnorePatterns": [
"<ignore_folder>",
"<ignore_folder_2>"
...
]
},
"sub_catalog_2_name": {
"srcPathIgnorePatterns": [
"<ignore_folder_3>",
"<ignore_folder_4>"
...
]
}
}
Each sub-catalog will include all the i18n translations used in the source paths defined for lingui in the package.json file minus the ignore patterns defined either in the lingui configuration or the lingui-multi sub-catalog configuration.
Usage
You can run the utility by executing the command provided by the package like so:
lingui-multi <path-to-application-package.json> <path-to-locale-directory>
The utility will pick up lingui configuration and lingui-multi configuration from the package.json file and spit out catalog files in the locale directory with the format <sub_catalog>.messages.js
for each sub-catalog.