gilbsgilbs / babel-plugin-i18next-extract

Babel plugin that statically extracts i18next and react-i18next translation keys.
https://i18next-extract.netlify.com
MIT License
161 stars 37 forks source link

Extract updates to default value as new `key:value` pair #163

Open abhijit945 opened 4 years ago

abhijit945 commented 4 years ago

Describe the bug

I have en-us i18next strings with default values:

t("en-locale-test:GoBack", "Back to Hello World");

// change to 

t("en-locale-test:GoBack", "Back");

Additional translations could be ja-jp etc. When I try to extract them only new keys are added to ja-jp but changing the default value doesnt trigger the same behavior? This results in translations out of context or wrong strings in translation files.

How to reproduce

Babel configuration:

    {
        locales: supportedAdditionalLocales,
        keySeparator: false,
        keyAsDefaultValue: ['en-us'],
        discardOldKeys: true,
        useI18nextDefaultValue: true,
        keyAsDefaultValueForDerivedKeys: true,
        outputPath: 'src/_/i18n/languages/{{locale}}/{{ns}}.json',
      },

Expected behavior

GoBack: "Back"

What actually happens

Extraction ignores this and doesnt notify the consumer.

GoBack: "Hello Worldに戻る"
dcalvom commented 4 years ago

I'm having the same issue. Did you were able to fix it?