npm i18next-parser 7.0.0

latest releases: 9.0.2, 9.0.1, 9.0.0...
2 years ago
  • BREAKING: change the API for defaultValue. Deprecate skipDefaultValues and useKeysAsDefaultValues options. #676
  • Add support for shouldUnescape option in jsx-lexer #678
  • Add support for .ts, .json and .yaml config #673
  • Update dependencies

Migrating from 6.x to 7.x

he API to manage what default value is being used was getting too complicated. This version simplifies the API by deprecating the skipDefaultValues and useKeysAsDefaultValues options and adding a value argument when the defaultValue option is used as a function. Here are couple example of how it can be used:

To replace skipDefaultValue, make the following change:

// 5.x.x
{
  skipDefaultValues: true
}

// 6.x.x
{
  defaultValue: function (locale, namespace, key, value) {
    return '';
  }
}

To replace useKeysAsDefaultValues, make the following change:

// 5.x.x
{
  useKeysAsDefaultValues: true
}

// 6.x.x
{
  defaultValue: function (locale, namespace, key, value) {
    return key;
  }
}

And now you have complete control over the logic:

// 6.x.x
{
  defaultValue: function (locale, namespace, key, value) {
    if (locale === 'fr') {
      return '';
    }
    return value || key;
  }
}

Don't miss a new i18next-parser release

NewReleases is sending notifications on new releases.