Skip to content

7.0.0

Compare
Choose a tag to compare
@karellm karellm released this 11 Nov 02:48
· 328 commits to master since this release
  • 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;
  }
}