0

I'm using this babel plugin https://github.com/gilbsgilbs/babel-plugin-i18next-extract. Haven't configured it much beyond the basics.

it generates an extractedTranslations folder but I just end up with keys and no values. Is that the correct behavior? I would figure that it would reconcile the values from the translations files that i already have.. I'm kind of confused on how this is useful?

4

1 回答 1

1

插件的创建者在这里。默认情况下, babel-plugin-i18next-extract 确实将密钥提取到extractedTranslations/{{locale}}/{{ns}}.json. 如果要更改此设置,则必须将outputPath配置选项设置为其他内容。例如:

{
  "plugins": [
    [
      "i18next-extract",
      {
        "outputPath": "locales/{{locale}}/{{ns}}.json"
      }
    ]
  ]
}

如果outputPath您为给定的语言环境和命名空间设置的设置已经存在,则插件应该只添加新键并保持现有键的值不变。

您可能需要查看其他配置选项以使插件与您的工作流程相匹配。

于 2019-12-15T17:46:35.700 回答