1

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?

hamobi
  • 7,940
  • 4
  • 35
  • 64

1 Answers1

2

Creator of the plugin here. By default, babel-plugin-i18next-extract indeed extracts the keys to extractedTranslations/{{locale}}/{{ns}}.json. If you want to change this, you must set the outputPath configuration option to something else. For instance:

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

If the outputPath you set already exists for a given locale and namespace, the plugin should only add new keys and leave the values of existing keys untouched.

You may want to look at the other configuration options to make the plugin match to your workflow.

user8808265
  • 1,893
  • 1
  • 17
  • 25