@jetshop/intl 5.8.3 → 5.11.0

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.
Files changed (2) hide show
  1. package/index.js +13 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -3,18 +3,19 @@ import IntlContext from '@jetshop/intl/context';
3
3
 
4
4
  export const useIntl = () => useContext(IntlContext);
5
5
 
6
- const withContextFormatMessage = callback => (...args) => (
7
- <IntlContext.Consumer>{t => callback(t)(...args)}</IntlContext.Consumer>
8
- );
6
+ const withContextFormatMessage =
7
+ (callback) =>
8
+ (...args) =>
9
+ React.createElement(IntlContext.Consumer, {}, (t) => callback(t)(...args));
9
10
 
10
- const Translate = withContextFormatMessage(t => t);
11
- Translate.rich = withContextFormatMessage(t => t.rich);
12
- Translate.number = withContextFormatMessage(t => t.number);
13
- Translate.date = withContextFormatMessage(t => t.date);
14
- Translate.time = withContextFormatMessage(t => t.time);
15
- Translate.select = withContextFormatMessage(t => t.select);
16
- Translate.plural = withContextFormatMessage(t => t.plural);
17
- Translate.selectordinal = withContextFormatMessage(t => t.selectordinal);
18
- Translate.custom = withContextFormatMessage(t => t.custom);
11
+ const Translate = withContextFormatMessage((t) => t);
12
+ Translate.rich = withContextFormatMessage((t) => t.rich);
13
+ Translate.number = withContextFormatMessage((t) => t.number);
14
+ Translate.date = withContextFormatMessage((t) => t.date);
15
+ Translate.time = withContextFormatMessage((t) => t.time);
16
+ Translate.select = withContextFormatMessage((t) => t.select);
17
+ Translate.plural = withContextFormatMessage((t) => t.plural);
18
+ Translate.selectordinal = withContextFormatMessage((t) => t.selectordinal);
19
+ Translate.custom = withContextFormatMessage((t) => t.custom);
19
20
  export const Intl = IntlContext.Consumer;
20
21
  export default Translate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetshop/intl",
3
- "version": "5.8.3",
3
+ "version": "5.11.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "bin": {