@transifex/native 7.1.2 → 7.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transifex/native",
3
- "version": "7.1.2",
3
+ "version": "7.1.3",
4
4
  "description": "i18n framework using Transifex Native",
5
5
  "keywords": [
6
6
  "transifex",
@@ -53,8 +53,8 @@
53
53
  "webpack-cli": "^5.1.4"
54
54
  },
55
55
  "dependencies": {
56
- "@messageformat/core": "^3.3.0",
57
56
  "cross-fetch": "^4.0.0",
57
+ "intl-messageformat": "^10.5.14",
58
58
  "md5": "^2.3.0"
59
59
  }
60
60
  }
@@ -1,9 +1,5 @@
1
1
  /* eslint-disable class-methods-use-this */
2
- import MessageFormat from '@messageformat/core';
3
-
4
- // object to cache MessageFormat classes related to
5
- // specific locales
6
- const MF = {};
2
+ import IntlMessageFormat from 'intl-messageformat';
7
3
 
8
4
  /**
9
5
  * MessageFormat renderer
@@ -16,18 +12,12 @@ export default class MessageFormatRenderer {
16
12
  // construct a MessageFormat class based on locale
17
13
  // to make dates and other content localizable
18
14
  const locale = ((localeCode || '').split('_'))[0];
19
- if (!MF[locale]) {
20
- try {
21
- MF[locale] = new MessageFormat(locale, {
22
- strictPluralKeys: false,
23
- });
24
- } catch (err) {
25
- MF[locale] = new MessageFormat('*', {
26
- strictPluralKeys: false,
27
- });
28
- }
15
+ let msg;
16
+ try {
17
+ msg = new IntlMessageFormat(sourceString, locale, undefined, { ignoreTag: true });
18
+ } catch (err) {
19
+ msg = new IntlMessageFormat(sourceString, undefined, undefined, { ignoreTag: true });
29
20
  }
30
- const msg = MF[locale].compile(sourceString);
31
- return msg(params);
21
+ return msg.format(params);
32
22
  }
33
23
  }