use-intl 3.13.0 → 3.14.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.
- package/dist/development/{_useLocale-321e619f.js → _useLocale-dde19ae0.js} +1 -1
- package/dist/development/_useLocale.js +1 -1
- package/dist/development/index.js +1 -1
- package/dist/development/react.js +1 -1
- package/dist/esm/_useLocale-07e20873.js +1 -0
- package/dist/esm/_useLocale.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/react.js +1 -1
- package/package.json +2 -2
- package/dist/esm/_useLocale-65297b4e.js +0 -1
|
@@ -6,7 +6,7 @@ var IntlContext = require('./IntlContext-b5cc6be8.js');
|
|
|
6
6
|
function useIntlContext() {
|
|
7
7
|
const context = React.useContext(IntlContext.IntlContext);
|
|
8
8
|
if (!context) {
|
|
9
|
-
throw new Error('No intl context found. Have you configured the provider?' );
|
|
9
|
+
throw new Error('No intl context found. Have you configured the provider? See https://next-intl-docs.vercel.app/docs/usage/configuration#client-server-components' );
|
|
10
10
|
}
|
|
11
11
|
return context;
|
|
12
12
|
}
|
|
@@ -7,7 +7,7 @@ var core = require('./core.js');
|
|
|
7
7
|
var createFormatter = require('./createFormatter-3c05ea0b.js');
|
|
8
8
|
var _IntlProvider = require('./_IntlProvider.js');
|
|
9
9
|
var react = require('./react.js');
|
|
10
|
-
var _useLocale = require('./_useLocale-
|
|
10
|
+
var _useLocale = require('./_useLocale-dde19ae0.js');
|
|
11
11
|
require('intl-messageformat');
|
|
12
12
|
require('react');
|
|
13
13
|
require('./IntlContext-b5cc6be8.js');
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var _IntlProvider = require('./_IntlProvider.js');
|
|
6
|
-
var _useLocale = require('./_useLocale-
|
|
6
|
+
var _useLocale = require('./_useLocale-dde19ae0.js');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var createFormatter = require('./createFormatter-3c05ea0b.js');
|
|
9
9
|
var initializeConfig = require('./initializeConfig-c503e215.js');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useContext as o}from"react";import{I as t}from"./IntlContext-b1dc6cbd.js";function e(){const e=o(t);if(!e)throw new Error("No intl context found. Have you configured the provider? See https://next-intl-docs.vercel.app/docs/usage/configuration#client-server-components");return e}function n(){return e().locale}export{e as a,n as u};
|
package/dist/esm/_useLocale.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{u as useLocale}from"./_useLocale-
|
|
1
|
+
export{u as useLocale}from"./_useLocale-07e20873.js";import"react";import"./IntlContext-b1dc6cbd.js";
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{I as IntlError,a as IntlErrorCode,i as initializeConfig}from"./initializeConfig-8268c3a9.js";export{createTranslator}from"./core.js";export{c as createFormatter}from"./createFormatter-d32b7359.js";export{IntlProvider}from"./_IntlProvider.js";export{useFormatter,useMessages,useNow,useTimeZone,useTranslations}from"./react.js";export{u as useLocale}from"./_useLocale-
|
|
1
|
+
export{I as IntlError,a as IntlErrorCode,i as initializeConfig}from"./initializeConfig-8268c3a9.js";export{createTranslator}from"./core.js";export{c as createFormatter}from"./createFormatter-d32b7359.js";export{IntlProvider}from"./_IntlProvider.js";export{useFormatter,useMessages,useNow,useTimeZone,useTranslations}from"./react.js";export{u as useLocale}from"./_useLocale-07e20873.js";import"intl-messageformat";import"react";import"./IntlContext-b1dc6cbd.js";
|
package/dist/esm/react.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{IntlProvider}from"./_IntlProvider.js";import{a as e}from"./_useLocale-
|
|
1
|
+
export{IntlProvider}from"./_IntlProvider.js";import{a as e}from"./_useLocale-07e20873.js";export{u as useLocale}from"./_useLocale-07e20873.js";import{useMemo as o,useState as t,useEffect as n}from"react";import{r,a,c as s}from"./createFormatter-d32b7359.js";import{I as i,a as c}from"./initializeConfig-8268c3a9.js";import"./IntlContext-b1dc6cbd.js";import"intl-messageformat";let l=!1;const m="undefined"==typeof window;function f(t){return function(t,n,s){const{defaultTranslationValues:u,formats:f,getMessageFallback:d,locale:g,messageFormatCache:p,onError:v,timeZone:h}=e();return t=t[s],n=r(n,s),h||l||!m||(l=!0,v(new i(c.ENVIRONMENT_FALLBACK,"There is no `timeZone` configured, this can lead to markup mismatches caused by environment differences. Consider adding a global default: https://next-intl-docs.vercel.app/docs/configuration#time-zone"))),o((()=>a({messageFormatCache:p,getMessageFallback:d,messages:t,defaultTranslationValues:u,namespace:n,onError:v,formats:f,locale:g,timeZone:h})),[p,d,t,n,v,u,f,g,h])}({"!":e().messages},t?"!.".concat(t):"!","!")}function d(){return new Date}function g(o){const r=null==o?void 0:o.updateInterval,{now:a}=e(),[s,i]=t(a||d());return n((()=>{if(!r)return;const e=setInterval((()=>{i(d())}),r);return()=>{clearInterval(e)}}),[a,r]),null==r&&a?a:s}function p(){return e().timeZone}function v(){const o=e();if(!o.messages)throw new Error("No messages found. Have you configured them correctly? See https://next-intl-docs.vercel.app/docs/configuration#messages");return o.messages}function h(){const{formats:t,locale:n,now:r,onError:a,timeZone:i}=e();return o((()=>s({formats:t,locale:n,now:r,onError:a,timeZone:i})),[t,r,n,a,i])}export{h as useFormatter,v as useMessages,g as useNow,p as useTimeZone,f as useTranslations};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "use-intl",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"author": "Jan Amann <jan@amann.work>",
|
|
6
6
|
"description": "Minimal, but complete solution for managing internationalization in React apps.",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"limit": "15.26 kB"
|
|
94
94
|
}
|
|
95
95
|
],
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "158b2dc0b3eb4b074a23d1182f8608ed0bae1c62"
|
|
97
97
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useContext as o}from"react";import{I as r}from"./IntlContext-b1dc6cbd.js";function t(){const t=o(r);if(!t)throw new Error("No intl context found. Have you configured the provider?");return t}function n(){return t().locale}export{t as a,n as u};
|