Comparing version 0.0.0-canary-91f2bb95294708297d0d88248e09b1c0dc454c79 to 0.0.0-canary-a205821
@@ -6,3 +6,3 @@ 'use strict'; | ||
var React = require('react'); | ||
var initializeConfig = require('./initializeConfig-o7L_y07P.js'); | ||
var initializeConfig = require('./initializeConfig-BhfMSHP7.js'); | ||
var IntlContext = require('./IntlContext-BKfsnzBx.js'); | ||
@@ -9,0 +9,0 @@ require('@formatjs/fast-memoize'); |
@@ -5,4 +5,4 @@ 'use strict'; | ||
var initializeConfig = require('./initializeConfig-o7L_y07P.js'); | ||
var createFormatter = require('./createFormatter-TZTkYRKI.js'); | ||
var initializeConfig = require('./initializeConfig-BhfMSHP7.js'); | ||
var createFormatter = require('./createFormatter-D2v4ATzl.js'); | ||
require('@formatjs/fast-memoize'); | ||
@@ -9,0 +9,0 @@ require('intl-messageformat'); |
@@ -5,5 +5,5 @@ 'use strict'; | ||
var initializeConfig = require('./initializeConfig-o7L_y07P.js'); | ||
var initializeConfig = require('./initializeConfig-BhfMSHP7.js'); | ||
var core = require('./core.js'); | ||
var createFormatter = require('./createFormatter-TZTkYRKI.js'); | ||
var createFormatter = require('./createFormatter-D2v4ATzl.js'); | ||
var _IntlProvider = require('./_IntlProvider.js'); | ||
@@ -10,0 +10,0 @@ var react = require('./react.js'); |
@@ -8,4 +8,4 @@ 'use strict'; | ||
var React = require('react'); | ||
var createFormatter = require('./createFormatter-TZTkYRKI.js'); | ||
var initializeConfig = require('./initializeConfig-o7L_y07P.js'); | ||
var createFormatter = require('./createFormatter-D2v4ATzl.js'); | ||
var initializeConfig = require('./initializeConfig-BhfMSHP7.js'); | ||
require('./IntlContext-BKfsnzBx.js'); | ||
@@ -12,0 +12,0 @@ require('intl-messageformat'); |
@@ -1,1 +0,1 @@ | ||
import{b as e,c as r,e as t,d as s}from"./initializeConfig-D2A8plWf.js";export{I as IntlError,a as IntlErrorCode,i as initializeConfig}from"./initializeConfig-D2A8plWf.js";import{r as o,a as m}from"./createFormatter-D1WNHqdE.js";export{c as createFormatter}from"./createFormatter-D1WNHqdE.js";import"@formatjs/fast-memoize";import"intl-messageformat";import"react";function n(a){let{_cache:i=e(),_formatters:c=r(i),getMessageFallback:n=t,messages:f,namespace:l,onError:g=s,...p}=a;return function(e,a){let{messages:r,namespace:t,...s}=e;return r=r[a],t=o(t,a),m({...s,messages:r,namespace:t})}({...p,onError:g,cache:i,formatters:c,getMessageFallback:n,messages:{"!":f},namespace:l?"!.".concat(l):"!"},"!")}export{e as _createCache,r as _createIntlFormatters,n as createTranslator}; | ||
import{b as e,c as r,e as t,d as s}from"./initializeConfig-D2A8plWf.js";export{I as IntlError,a as IntlErrorCode,i as initializeConfig}from"./initializeConfig-D2A8plWf.js";import{r as o,a as m}from"./createFormatter-zqPbsiYR.js";export{c as createFormatter}from"./createFormatter-zqPbsiYR.js";import"@formatjs/fast-memoize";import"intl-messageformat";import"react";function n(a){let{_cache:i=e(),_formatters:c=r(i),getMessageFallback:n=t,messages:f,namespace:l,onError:g=s,...p}=a;return function(e,a){let{messages:r,namespace:t,...s}=e;return r=r[a],t=o(t,a),m({...s,messages:r,namespace:t})}({...p,onError:g,cache:i,formatters:c,getMessageFallback:n,messages:{"!":f},namespace:l?"!.".concat(l):"!"},"!")}export{e as _createCache,r as _createIntlFormatters,n as createTranslator}; |
@@ -1,1 +0,1 @@ | ||
export{I as IntlError,a as IntlErrorCode,b as _createCache,c as _createIntlFormatters,i as initializeConfig}from"./initializeConfig-D2A8plWf.js";export{createTranslator}from"./core.js";export{c as createFormatter}from"./createFormatter-D1WNHqdE.js";export{IntlProvider}from"./_IntlProvider.js";export{useFormatter,useMessages,useNow,useTimeZone,useTranslations}from"./react.js";export{u as useLocale}from"./_useLocale-v-ZT5JoE.js";import"@formatjs/fast-memoize";import"intl-messageformat";import"react";import"./IntlContext-DoS4CDM3.js"; | ||
export{I as IntlError,a as IntlErrorCode,b as _createCache,c as _createIntlFormatters,i as initializeConfig}from"./initializeConfig-D2A8plWf.js";export{createTranslator}from"./core.js";export{c as createFormatter}from"./createFormatter-zqPbsiYR.js";export{IntlProvider}from"./_IntlProvider.js";export{useFormatter,useMessages,useNow,useTimeZone,useTranslations}from"./react.js";export{u as useLocale}from"./_useLocale-v-ZT5JoE.js";import"@formatjs/fast-memoize";import"intl-messageformat";import"react";import"./IntlContext-DoS4CDM3.js"; |
@@ -1,1 +0,1 @@ | ||
export{IntlProvider}from"./_IntlProvider.js";import{a as e}from"./_useLocale-v-ZT5JoE.js";export{u as useLocale}from"./_useLocale-v-ZT5JoE.js";import{useMemo as t,useState as o,useEffect as r}from"react";import{r as n,a,c as s}from"./createFormatter-D1WNHqdE.js";import{I as i,a as c}from"./initializeConfig-D2A8plWf.js";import"./IntlContext-DoS4CDM3.js";import"intl-messageformat";import"@formatjs/fast-memoize";let m=!1;const l="undefined"==typeof window;function f(o){return function(o,r,s){const{cache:f,defaultTranslationValues:u,formats:d,formatters:p,getMessageFallback:g,locale:v,onError:h,timeZone:w}=e(),I=o[s],j=n(r,s);return w||m||!l||(m=!0,h(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"))),t((()=>a({cache:f,formatters:p,getMessageFallback:g,messages:I,defaultTranslationValues:u,namespace:j,onError:h,formats:d,locale:v,timeZone:w})),[f,p,g,I,u,j,h,d,v,w])}({"!":e().messages},o?"!.".concat(o):"!","!")}function d(){return new Date}function p(t){const n=null==t?void 0:t.updateInterval,{now:a}=e(),[s,i]=o(a||d());return r((()=>{if(!n)return;const e=setInterval((()=>{i(d())}),n);return()=>{clearInterval(e)}}),[a,n]),null==n&&a?a:s}function g(){return e().timeZone}function v(){const t=e();if(!t.messages)throw new Error("No messages found. Have you configured them correctly? See https://next-intl-docs.vercel.app/docs/configuration#messages");return t.messages}function h(){const{formats:o,formatters:r,locale:n,now:a,onError:i,timeZone:c}=e();return t((()=>s({formats:o,locale:n,now:a,onError:i,timeZone:c,_formatters:r})),[o,r,a,n,i,c])}export{h as useFormatter,v as useMessages,p as useNow,g as useTimeZone,f as useTranslations}; | ||
export{IntlProvider}from"./_IntlProvider.js";import{a as e}from"./_useLocale-v-ZT5JoE.js";export{u as useLocale}from"./_useLocale-v-ZT5JoE.js";import{useMemo as t,useState as o,useEffect as r}from"react";import{r as n,a,c as s}from"./createFormatter-zqPbsiYR.js";import{I as i,a as c}from"./initializeConfig-D2A8plWf.js";import"./IntlContext-DoS4CDM3.js";import"intl-messageformat";import"@formatjs/fast-memoize";let m=!1;const l="undefined"==typeof window;function f(o){return function(o,r,s){const{cache:f,defaultTranslationValues:u,formats:d,formatters:p,getMessageFallback:g,locale:v,onError:h,timeZone:w}=e(),I=o[s],j=n(r,s);return w||m||!l||(m=!0,h(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"))),t((()=>a({cache:f,formatters:p,getMessageFallback:g,messages:I,defaultTranslationValues:u,namespace:j,onError:h,formats:d,locale:v,timeZone:w})),[f,p,g,I,u,j,h,d,v,w])}({"!":e().messages},o?"!.".concat(o):"!","!")}function d(){return new Date}function p(t){const n=null==t?void 0:t.updateInterval,{now:a}=e(),[s,i]=o(a||d());return r((()=>{if(!n)return;const e=setInterval((()=>{i(d())}),n);return()=>{clearInterval(e)}}),[a,n]),null==n&&a?a:s}function g(){return e().timeZone}function v(){const t=e();if(!t.messages)throw new Error("No messages found. Have you configured them correctly? See https://next-intl-docs.vercel.app/docs/configuration#messages");return t.messages}function h(){const{formats:o,formatters:r,locale:n,now:a,onError:i,timeZone:c}=e();return t((()=>s({formats:o,locale:n,now:a,onError:i,timeZone:c,_formatters:r})),[o,r,a,n,i,c])}export{h as useFormatter,v as useMessages,p as useNow,g as useTimeZone,f as useTranslations}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./createFormatter-CTr0qKAI.js"),r=require("./initializeConfig-AbYTngyP.js");require("intl-messageformat"),require("react"),require("@formatjs/fast-memoize"),exports.IntlError=e.IntlError,exports.IntlErrorCode=e.IntlErrorCode,exports.createFormatter=e.createFormatter,exports._createCache=r.createCache,exports._createIntlFormatters=r.createIntlFormatters,exports.initializeConfig=r.initializeConfig,exports.createTranslator=function(t){let{_cache:a=r.createCache(),_formatters:s=r.createIntlFormatters(a),getMessageFallback:o=r.defaultGetMessageFallback,messages:c,namespace:n,onError:i=r.defaultOnError,...l}=t;return function(r,t){let{messages:a,namespace:s,...o}=r;return a=a[t],s=e.resolveNamespace(s,t),e.createBaseTranslator({...o,messages:a,namespace:s})}({...l,onError:i,cache:a,formatters:s,getMessageFallback:o,messages:{"!":c},namespace:n?"!.".concat(n):"!"},"!")}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./createFormatter-CZeYe_QF.js"),r=require("./initializeConfig-AbYTngyP.js");require("intl-messageformat"),require("react"),require("@formatjs/fast-memoize"),exports.IntlError=e.IntlError,exports.IntlErrorCode=e.IntlErrorCode,exports.createFormatter=e.createFormatter,exports._createCache=r.createCache,exports._createIntlFormatters=r.createIntlFormatters,exports.initializeConfig=r.initializeConfig,exports.createTranslator=function(t){let{_cache:a=r.createCache(),_formatters:s=r.createIntlFormatters(a),getMessageFallback:o=r.defaultGetMessageFallback,messages:c,namespace:n,onError:i=r.defaultOnError,...l}=t;return function(r,t){let{messages:a,namespace:s,...o}=r;return a=a[t],s=e.resolveNamespace(s,t),e.createBaseTranslator({...o,messages:a,namespace:s})}({...l,onError:i,cache:a,formatters:s,getMessageFallback:o,messages:{"!":c},namespace:n?"!.".concat(n):"!"},"!")}; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./createFormatter-CTr0qKAI.js"),r=require("./core.js"),t=require("./initializeConfig-AbYTngyP.js"),s=require("./_IntlProvider.js"),o=require("./react.js"),a=require("./_useLocale-CpTrqBDt.js");require("intl-messageformat"),require("react"),require("@formatjs/fast-memoize"),require("./IntlContext-DcFt0tgW.js"),exports.IntlError=e.IntlError,exports.IntlErrorCode=e.IntlErrorCode,exports.createFormatter=e.createFormatter,exports.createTranslator=r.createTranslator,exports._createCache=t.createCache,exports._createIntlFormatters=t.createIntlFormatters,exports.initializeConfig=t.initializeConfig,exports.IntlProvider=s.IntlProvider,exports.useFormatter=o.useFormatter,exports.useMessages=o.useMessages,exports.useNow=o.useNow,exports.useTimeZone=o.useTimeZone,exports.useTranslations=o.useTranslations,exports.useLocale=a.useLocale; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./createFormatter-CZeYe_QF.js"),r=require("./core.js"),t=require("./initializeConfig-AbYTngyP.js"),s=require("./_IntlProvider.js"),o=require("./react.js"),a=require("./_useLocale-CpTrqBDt.js");require("intl-messageformat"),require("react"),require("@formatjs/fast-memoize"),require("./IntlContext-DcFt0tgW.js"),exports.IntlError=e.IntlError,exports.IntlErrorCode=e.IntlErrorCode,exports.createFormatter=e.createFormatter,exports.createTranslator=r.createTranslator,exports._createCache=t.createCache,exports._createIntlFormatters=t.createIntlFormatters,exports.initializeConfig=t.initializeConfig,exports.IntlProvider=s.IntlProvider,exports.useFormatter=o.useFormatter,exports.useMessages=o.useMessages,exports.useNow=o.useNow,exports.useTimeZone=o.useTimeZone,exports.useTranslations=o.useTranslations,exports.useLocale=a.useLocale; |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./_IntlProvider.js"),t=require("./_useLocale-CpTrqBDt.js"),r=require("react"),o=require("./createFormatter-CTr0qKAI.js");require("./initializeConfig-AbYTngyP.js"),require("@formatjs/fast-memoize"),require("./IntlContext-DcFt0tgW.js"),require("intl-messageformat");let n=!1;const s="undefined"==typeof window;function a(){return new Date}exports.IntlProvider=e.IntlProvider,exports.useLocale=t.useLocale,exports.useFormatter=function(){const{formats:e,formatters:n,locale:s,now:a,onError:u,timeZone:l}=t.useIntlContext();return r.useMemo((()=>o.createFormatter({formats:e,locale:s,now:a,onError:u,timeZone:l,_formatters:n})),[e,n,a,s,u,l])},exports.useMessages=function(){const e=t.useIntlContext();if(!e.messages)throw new Error(void 0);return e.messages},exports.useNow=function(e){const o=null==e?void 0:e.updateInterval,{now:n}=t.useIntlContext(),[s,u]=r.useState(n||a());return r.useEffect((()=>{if(!o)return;const e=setInterval((()=>{u(a())}),o);return()=>{clearInterval(e)}}),[n,o]),null==o&&n?n:s},exports.useTimeZone=function(){return t.useIntlContext().timeZone},exports.useTranslations=function(e){return function(e,a,u){const{cache:l,defaultTranslationValues:i,formats:c,formatters:m,getMessageFallback:f,locale:I,onError:d,timeZone:x}=t.useIntlContext(),p=e[u],v=o.resolveNamespace(a,u);return x||n||!s||(n=!0,d(new o.IntlError(o.IntlErrorCode.ENVIRONMENT_FALLBACK,void 0))),r.useMemo((()=>o.createBaseTranslator({cache:l,formatters:m,getMessageFallback:f,messages:p,defaultTranslationValues:i,namespace:v,onError:d,formats:c,locale:I,timeZone:x})),[l,m,f,p,i,v,d,c,I,x])}({"!":t.useIntlContext().messages},e?"!.".concat(e):"!","!")}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./_IntlProvider.js"),t=require("./_useLocale-CpTrqBDt.js"),r=require("react"),o=require("./createFormatter-CZeYe_QF.js");require("./initializeConfig-AbYTngyP.js"),require("@formatjs/fast-memoize"),require("./IntlContext-DcFt0tgW.js"),require("intl-messageformat");let n=!1;const s="undefined"==typeof window;function a(){return new Date}exports.IntlProvider=e.IntlProvider,exports.useLocale=t.useLocale,exports.useFormatter=function(){const{formats:e,formatters:n,locale:s,now:a,onError:u,timeZone:l}=t.useIntlContext();return r.useMemo((()=>o.createFormatter({formats:e,locale:s,now:a,onError:u,timeZone:l,_formatters:n})),[e,n,a,s,u,l])},exports.useMessages=function(){const e=t.useIntlContext();if(!e.messages)throw new Error(void 0);return e.messages},exports.useNow=function(e){const o=null==e?void 0:e.updateInterval,{now:n}=t.useIntlContext(),[s,u]=r.useState(n||a());return r.useEffect((()=>{if(!o)return;const e=setInterval((()=>{u(a())}),o);return()=>{clearInterval(e)}}),[n,o]),null==o&&n?n:s},exports.useTimeZone=function(){return t.useIntlContext().timeZone},exports.useTranslations=function(e){return function(e,a,u){const{cache:l,defaultTranslationValues:i,formats:c,formatters:m,getMessageFallback:f,locale:I,onError:d,timeZone:x}=t.useIntlContext(),p=e[u],v=o.resolveNamespace(a,u);return x||n||!s||(n=!0,d(new o.IntlError(o.IntlErrorCode.ENVIRONMENT_FALLBACK,void 0))),r.useMemo((()=>o.createBaseTranslator({cache:l,formatters:m,getMessageFallback:f,messages:p,defaultTranslationValues:i,namespace:v,onError:d,formats:c,locale:I,timeZone:x})),[l,m,f,p,i,v,d,c,I,x])}({"!":t.useIntlContext().messages},e?"!.".concat(e):"!","!")}; |
@@ -1,2 +0,2 @@ | ||
import { ReactElement, ReactNodeArray } from 'react'; | ||
import { ReactNode } from 'react'; | ||
import AbstractIntlMessages from './AbstractIntlMessages'; | ||
@@ -20,6 +20,6 @@ import Formats from './Formats'; | ||
<TargetKey extends MessageKeys<NestedValueOf<Messages, NestedKey>, NestedKeyOf<NestedValueOf<Messages, NestedKey>>>>(key: TargetKey, values?: TranslationValues, formats?: Formats): string; | ||
rich: (key: string, values?: RichTranslationValues, formats?: Formats) => string | ReactElement | ReactNodeArray; | ||
markup(key: Parameters<(key: string, values?: RichTranslationValues, formats?: Formats) => string | ReactElement | ReactNodeArray>[0], values: MarkupTranslationValues, formats?: Parameters<(key: string, values?: RichTranslationValues, formats?: Formats) => string | ReactElement | ReactNodeArray>[2]): string; | ||
rich: (key: string, values?: RichTranslationValues, formats?: Formats) => ReactNode; | ||
markup(key: Parameters<(key: string, values?: RichTranslationValues, formats?: Formats) => ReactNode>[0], values: MarkupTranslationValues, formats?: Parameters<(key: string, values?: RichTranslationValues, formats?: Formats) => ReactNode>[2]): string; | ||
raw(key: string): any; | ||
has(key: Parameters<(key: string, values?: RichTranslationValues, formats?: Formats) => string | ReactElement | ReactNodeArray>[0]): boolean; | ||
has(key: Parameters<(key: string, values?: RichTranslationValues, formats?: Formats) => ReactNode>[0]): boolean; | ||
}; |
@@ -1,2 +0,2 @@ | ||
import { ReactElement, ReactNodeArray } from 'react'; | ||
import { ReactNode } from 'react'; | ||
import Formats from './Formats'; | ||
@@ -43,3 +43,3 @@ import IntlConfig from './IntlConfig'; | ||
NestedKey | ||
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: RichTranslationValues, formats?: Formats): string | ReactElement | ReactNodeArray; | ||
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: RichTranslationValues, formats?: Formats): ReactNode; | ||
markup<TargetKey extends MessageKeys<NestedValueOf<{ | ||
@@ -46,0 +46,0 @@ '!': IntlMessages; |
@@ -13,6 +13,6 @@ import AbstractIntlMessages from './AbstractIntlMessages'; | ||
<TargetKey extends import(".").MessageKeys<import(".").NestedValueOf<Messages, NestedKey>, NestedKeyOf<import(".").NestedValueOf<Messages, NestedKey>>>>(key: TargetKey, values?: import("./TranslationValues").default, formats?: import("./Formats").default): string; | ||
rich: (key: string, values?: import("./TranslationValues").RichTranslationValues, formats?: import("./Formats").default) => string | import("react").ReactElement | import("react").ReactNodeArray; | ||
markup(key: Parameters<(key: string, values?: import("./TranslationValues").RichTranslationValues, formats?: import("./Formats").default) => string | import("react").ReactElement | import("react").ReactNodeArray>[0], values: import("./TranslationValues").MarkupTranslationValues, formats?: Parameters<(key: string, values?: import("./TranslationValues").RichTranslationValues, formats?: import("./Formats").default) => string | import("react").ReactElement | import("react").ReactNodeArray>[2]): string; | ||
rich: (key: string, values?: import("./TranslationValues").RichTranslationValues, formats?: import("./Formats").default) => import("react").ReactNode; | ||
markup(key: Parameters<(key: string, values?: import("./TranslationValues").RichTranslationValues, formats?: import("./Formats").default) => import("react").ReactNode>[0], values: import("./TranslationValues").MarkupTranslationValues, formats?: Parameters<(key: string, values?: import("./TranslationValues").RichTranslationValues, formats?: import("./Formats").default) => import("react").ReactNode>[2]): string; | ||
raw(key: string): any; | ||
has(key: Parameters<(key: string, values?: import("./TranslationValues").RichTranslationValues, formats?: import("./Formats").default) => string | import("react").ReactElement | import("react").ReactNodeArray>[0]): boolean; | ||
has(key: Parameters<(key: string, values?: import("./TranslationValues").RichTranslationValues, formats?: import("./Formats").default) => import("react").ReactNode>[0]): boolean; | ||
}; |
@@ -7,2 +7,4 @@ export type { default as AbstractIntlMessages } from './AbstractIntlMessages'; | ||
export type { default as NumberFormatOptions } from './NumberFormatOptions'; | ||
export type { default as RelativeTimeFormatOptions } from './RelativeTimeFormatOptions'; | ||
export type { default as Timezone } from './TimeZone'; | ||
export { default as IntlError, IntlErrorCode } from './IntlError'; | ||
@@ -9,0 +11,0 @@ export { default as createTranslator } from './createTranslator'; |
@@ -47,3 +47,3 @@ import type AbstractIntlMessages from './AbstractIntlMessages'; | ||
* @deprecated See https://next-intl-docs.vercel.app/docs/usage/messages#rich-text-reuse-tags | ||
* */ | ||
**/ | ||
defaultTranslationValues?: RichTranslationValues; | ||
@@ -50,0 +50,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
export default function useTimeZone(): import("../core/TimeZone").default | undefined; | ||
export default function useTimeZone(): import("..").Timezone | undefined; |
@@ -1,2 +0,2 @@ | ||
import { ReactElement, ReactNodeArray } from 'react'; | ||
import { ReactNode } from 'react'; | ||
import Formats from '../core/Formats'; | ||
@@ -34,3 +34,3 @@ import TranslationValues, { MarkupTranslationValues, RichTranslationValues } from '../core/TranslationValues'; | ||
NestedKey | ||
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: RichTranslationValues, formats?: Formats): string | ReactElement | ReactNodeArray; | ||
] extends [never] ? '!' : `!.${NestedKey}`>>>>(key: TargetKey, values?: RichTranslationValues, formats?: Formats): ReactNode; | ||
markup<TargetKey extends MessageKeys<NestedValueOf<{ | ||
@@ -37,0 +37,0 @@ '!': IntlMessages; |
@@ -5,6 +5,6 @@ import AbstractIntlMessages from '../core/AbstractIntlMessages'; | ||
<TargetKey extends unknown>(key: TargetKey, values?: import("../core").TranslationValues, formats?: import("../core").Formats): string; | ||
rich: (key: string, values?: import("../core").RichTranslationValues, formats?: import("../core").Formats) => string | import("react").ReactElement | import("react").ReactNodeArray; | ||
markup(key: Parameters<(key: string, values?: import("../core").RichTranslationValues, formats?: import("../core").Formats) => string | import("react").ReactElement | import("react").ReactNodeArray>[0], values: import("../core").MarkupTranslationValues, formats?: Parameters<(key: string, values?: import("../core").RichTranslationValues, formats?: import("../core").Formats) => string | import("react").ReactElement | import("react").ReactNodeArray>[2]): string; | ||
rich: (key: string, values?: import("../core").RichTranslationValues, formats?: import("../core").Formats) => import("react").ReactNode; | ||
markup(key: Parameters<(key: string, values?: import("../core").RichTranslationValues, formats?: import("../core").Formats) => import("react").ReactNode>[0], values: import("../core").MarkupTranslationValues, formats?: Parameters<(key: string, values?: import("../core").RichTranslationValues, formats?: import("../core").Formats) => import("react").ReactNode>[2]): string; | ||
raw(key: string): any; | ||
has(key: Parameters<(key: string, values?: import("../core").RichTranslationValues, formats?: import("../core").Formats) => string | import("react").ReactElement | import("react").ReactNodeArray>[0]): boolean; | ||
has(key: Parameters<(key: string, values?: import("../core").RichTranslationValues, formats?: import("../core").Formats) => import("react").ReactNode>[0]): boolean; | ||
}; |
{ | ||
"name": "use-intl", | ||
"version": "0.0.0-canary-91f2bb95294708297d0d88248e09b1c0dc454c79", | ||
"version": "0.0.0-canary-a205821", | ||
"sideEffects": false, | ||
@@ -17,4 +17,5 @@ "author": "Jan Amann <jan@amann.work>", | ||
"lint": "pnpm run lint:source && pnpm run lint:package", | ||
"lint:source": "eslint src test && tsc --noEmit", | ||
"lint:source": "eslint src test && tsc --noEmit && pnpm run lint:prettier", | ||
"lint:package": "publint && attw --pack", | ||
"lint:prettier": "prettier src --check", | ||
"prepublishOnly": "turbo build", | ||
@@ -71,5 +72,5 @@ "size": "size-limit" | ||
"peerDependencies": { | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0" | ||
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0" | ||
}, | ||
"gitHead": "b163d90edf0f07f232fe763028967c1d6b15731b" | ||
"gitHead": "5d3f6d909314403150f7d1cd005924815738b3b3" | ||
} |
@@ -20,6 +20,6 @@ # 🌐 use-intl | ||
import {useTranslations} from 'use-intl'; | ||
export default function UserProfile({user}) { | ||
const t = useTranslations('UserProfile'); | ||
return ( | ||
@@ -39,3 +39,3 @@ <section> | ||
"UserProfile": { | ||
"title": "{username}'s profile", | ||
"title": "{firstName}'s profile", | ||
"membership": "Member since {memberSince, date, short}", | ||
@@ -61,7 +61,7 @@ "followers": "{count, plural, ↵ | ||
// You can get the messages from anywhere you like. You can also | ||
// fetch them from within a component and then render the provider | ||
// fetch them from within a component and then render the provider | ||
// along with your app once you have the messages. | ||
const messages = { | ||
"App": { | ||
"hello": 'Hello {username}!' | ||
App: { | ||
hello: 'Hello {firstName}!' | ||
} | ||
@@ -73,3 +73,3 @@ }; | ||
<IntlProvider messages={messages} locale="en"> | ||
<App user={{name: 'Jane'}} /> | ||
<App user={{firstName: 'Jane'}} /> | ||
</IntlProvider> | ||
@@ -81,3 +81,3 @@ ); | ||
const t = useTranslations('App'); | ||
return <h1>{t('hello', {username: user.name})}</h1>; | ||
return <h1>{t('hello', {firstName: user.firstName})}</h1>; | ||
} | ||
@@ -84,0 +84,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
108609