@ckbox/i18n 0.0.2 → 0.0.5-dev.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/index.d.ts CHANGED
@@ -41,7 +41,27 @@ interface I18nProps {
41
41
  resources?: I18nResources;
42
42
  }
43
43
 
44
- interface I18nContextShape {
44
+ declare class Plural {
45
+ lang: string;
46
+ private _rules?;
47
+ constructor(lang: string);
48
+ /**
49
+ * Checks if plural form is supported for selected language.
50
+ *
51
+ * @returns flag indicating if plural is supported
52
+ */
53
+ static isSupported: (lang: string) => boolean;
54
+ /**
55
+ * Gets plural form of the translation key.
56
+ *
57
+ * @param key main part of the translation key
58
+ * @param plural desired plural form
59
+ * @returns plural form of the translation key
60
+ */
61
+ getKey(key: string, plural: number): string;
62
+ }
63
+
64
+ interface I18nContext {
45
65
  /**
46
66
  * Switch language.
47
67
  */
@@ -58,11 +78,15 @@ interface I18nContextShape {
58
78
  * Stored translations.
59
79
  */
60
80
  resources: I18nResources;
81
+ /**
82
+ * Plural utils.
83
+ */
84
+ pluralUtils: Plural;
61
85
  }
62
86
  /**
63
87
  * Defines React context for i18n and sets defaults.
64
88
  */
65
- declare const I18nContext: React.Context<I18nContextShape>;
89
+ declare const I18nContext: React.Context<I18nContext>;
66
90
 
67
91
  /**
68
92
  * `I18nProvider` component sets i18n context for all child components.
@@ -83,18 +107,15 @@ interface Props extends I18nProps {
83
107
  */
84
108
  declare const getTranslations: (locale: string) => I18nTranslations;
85
109
 
86
- interface MsgOpts {
87
- /**
88
- * Indicates which plural to use.
89
- */
90
- plural?: number;
91
- }
92
-
93
- interface TOpts<T extends boolean> extends MsgOpts {
110
+ interface TOpts<T extends boolean> {
94
111
  /**
95
112
  * Values to interpolate message with.
96
113
  */
97
114
  values?: (string | number)[];
115
+ /**
116
+ * Indicates which plural to use.
117
+ */
118
+ plural?: number;
98
119
  /**
99
120
  * Include html tags in message.
100
121
  */
@@ -114,4 +135,4 @@ declare const useTranslation: () => {
114
135
  lang: string;
115
136
  };
116
137
 
117
- export { I18nContext, I18nContextShape, I18nProps, I18nProvider, I18nResources, I18nTranslations, getTranslations, useTranslation };
138
+ export { I18nContext, I18nProps, I18nProvider, I18nResources, I18nTranslations, getTranslations, useTranslation };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
3
  */
4
- const _0x7c8c5f=_0x2c18;(function(_0x202fa2,_0x306854){const _0x431794=_0x2c18,_0x30e5e8=_0x202fa2();while(!![]){try{const _0xc7a74d=-parseInt(_0x431794(0x121))/0x1+parseInt(_0x431794(0x11e))/0x2+-parseInt(_0x431794(0x109))/0x3+parseInt(_0x431794(0x103))/0x4+-parseInt(_0x431794(0x117))/0x5+-parseInt(_0x431794(0x108))/0x6+parseInt(_0x431794(0x123))/0x7*(parseInt(_0x431794(0x10d))/0x8);if(_0xc7a74d===_0x306854)break;else _0x30e5e8['push'](_0x30e5e8['shift']());}catch(_0x11e457){_0x30e5e8['push'](_0x30e5e8['shift']());}}}(_0x3d11,0x7cf08));import*as _0x1b9f41 from'react';import{__rest}from'tslib';import{sprintf}from'sprintf-js';const I18nContext=_0x1b9f41[_0x7c8c5f(0x120)]({'changeLang':()=>{},'debug':![],'lang':'en','resources':{}});function _0x2c18(_0x543884,_0x51aedd){const _0x3d1139=_0x3d11();return _0x2c18=function(_0x2c18f7,_0x387ca5){_0x2c18f7=_0x2c18f7-0xfe;let _0x1f5d9e=_0x3d1139[_0x2c18f7];return _0x1f5d9e;},_0x2c18(_0x543884,_0x51aedd);}function reducer(_0xf65c60,_0xd01b){const _0x20e7db=_0x7c8c5f;switch(_0xd01b['type']){case _0x20e7db(0xff):return Object[_0x20e7db(0x113)](Object[_0x20e7db(0x113)]({},_0xf65c60),{'lang':_0xd01b[_0x20e7db(0x11c)]});case _0x20e7db(0x10e):return Object[_0x20e7db(0x113)](Object[_0x20e7db(0x113)]({},_0xf65c60),{'lang':_0xd01b['payload'][_0x20e7db(0x115)],'resources':Object[_0x20e7db(0x113)](Object['assign']({},_0xf65c60['resources']),{[_0xd01b[_0x20e7db(0x11c)][_0x20e7db(0x115)]]:_0xd01b['payload'][_0x20e7db(0x102)]})});}}const useI18n=({debug:debug=![],loadURL:_0x16b227,lang:_0x306d46='en',resources:_0x591ed3={}})=>{const _0x48795c=_0x7c8c5f,[{lang:_0x2b5740,resources:_0x4211f9},_0x25b1ce]=_0x1b9f41['useReducer'](reducer,{'lang':_0x306d46,'resources':_0x591ed3});_0x1b9f41[_0x48795c(0x106)](()=>{const _0x26ad74=_0x48795c;if(_0x4211f9[_0x2b5740]||!_0x16b227)return;fetch(_0x16b227(_0x2b5740))[_0x26ad74(0x11b)](_0x1ab56f=>_0x1ab56f[_0x26ad74(0x10c)]())[_0x26ad74(0x11b)](_0xbb0c5b=>{_0x25b1ce({'type':'loadTranslations','payload':{'lang':_0x2b5740,'translations':_0xbb0c5b}});});},[_0x2b5740,_0x16b227,_0x4211f9]);const _0x93de3d=_0xe6eaa9=>{_0x25b1ce({'type':'changeLang','payload':_0xe6eaa9});};return{'changeLang':_0x93de3d,'debug':debug,'lang':_0x2b5740,'resources':_0x4211f9};},I18nProvider=_0xe52e08=>{const _0x4d8d20=_0x7c8c5f;var {children:_0x33a492}=_0xe52e08,_0xcf525a=__rest(_0xe52e08,['children']);const _0x15ee32=useI18n(_0xcf525a);return _0x1b9f41[_0x4d8d20(0x125)](I18nContext[_0x4d8d20(0x105)],{'value':_0x15ee32},_0x33a492);},getTranslations=_0x556ab8=>{const _0x39dedf=_0x7c8c5f;var _0x3f2da9,_0x44de6d;const _0x25240a=typeof globalThis!==_0x39dedf(0x116)?globalThis:global||self;return(_0x44de6d=(_0x3f2da9=_0x25240a===null||_0x25240a===void 0x0?void 0x0:_0x25240a[_0x39dedf(0x111)])===null||_0x3f2da9===void 0x0?void 0x0:_0x3f2da9[_0x556ab8])!==null&&_0x44de6d!==void 0x0?_0x44de6d:{};},defaultPlural=(_0x42157c,_0x5b2f89=0x1)=>{const _0x32fc17=_0x7c8c5f;return _0x5b2f89===0x1?_0x42157c:_0x42157c+_0x32fc17(0xfe);},plPlural=(_0x53a19e,_0x2405cc=0x1)=>{if(_0x2405cc===0x1)return _0x53a19e+'_0';else{if(_0x2405cc%0xa>=0x2&&_0x2405cc%0xa<=0x4&&(_0x2405cc%0x64<0xc||_0x2405cc%0x64>0xe))return _0x53a19e+'_1';else return _0x2405cc!=0x1&&_0x2405cc%0xa>=0x0&&_0x2405cc%0xa<=0x1||_0x2405cc%0xa>=0x5&&_0x2405cc%0xa<=0x9||_0x2405cc%0x64>=0xc&&_0x2405cc%0x64<=0xe?_0x53a19e+'_2':_0x53a19e+'_3';}},plurals={'default':defaultPlural,'en':defaultPlural,'pl':plPlural},getPluralKeyFn=_0x4d8dc4=>{return plurals[_0x4d8dc4]?plurals[_0x4d8dc4]:plurals['default'];},TAG_REGEX=/<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g,ALLOWED_TAGS=['em',_0x7c8c5f(0x11a),_0x7c8c5f(0x112)],getMsg=(_0x28edb1,_0x5544e5,_0x385c57={},_0xb282df)=>{const _0x28fc09=_0x7c8c5f;if(_0x385c57[_0x5544e5]&&(_0xb282df===null||_0xb282df===void 0x0?void 0x0:_0xb282df[_0x28fc09(0x11f)])===undefined)return{'found':!![],'msg':_0x385c57[_0x5544e5]};const _0x52daac=Object['keys'](_0x385c57)[_0x28fc09(0x104)](_0x20fbfe=>_0x20fbfe[_0x28fc09(0x100)](_0x5544e5)===0x0);if(_0x52daac[_0x28fc09(0x10a)]===0x0)return{'found':![],'msg':_0x5544e5};const _0x41e4fe=getPluralKeyFn(_0x28edb1)(_0x5544e5,_0xb282df===null||_0xb282df===void 0x0?void 0x0:_0xb282df['plural']);return{'found':!![],'msg':_0x385c57[_0x41e4fe]};},parseMsgTags=_0x4a683b=>{const _0x493011=_0x7c8c5f,_0x151ebe=[];let _0x3ea327=0x0,_0x37214;while((_0x37214=TAG_REGEX[_0x493011(0x10b)](_0x4a683b))!==null){const _0x2dad28=_0x37214[0x0],{index:_0x45c15b}=_0x37214,_0x38499d=_0x2dad28['charAt'](0x1)==='/',_0x15015d=_0x38499d?_0x2dad28[_0x493011(0x10f)](0x2,-0x1):_0x2dad28[_0x493011(0x10f)](0x1,-0x1),_0x38339b=ALLOWED_TAGS['includes'](_0x15015d);if(!_0x38339b)continue;const _0x5d4cc1=_0x4a683b['slice'](_0x3ea327,_0x45c15b);if(!_0x5d4cc1){_0x3ea327=_0x45c15b+_0x2dad28[_0x493011(0x10a)];continue;}_0x38499d?_0x151ebe[_0x493011(0x118)]({'type':_0x493011(0x122),'name':_0x2dad28[_0x493011(0x10f)](0x2,-0x1),'content':_0x5d4cc1}):_0x151ebe[_0x493011(0x118)]({'type':_0x493011(0x101),'content':_0x5d4cc1}),_0x3ea327=_0x45c15b+_0x2dad28['length'];}return _0x3ea327<_0x4a683b['length']&&_0x151ebe[_0x493011(0x118)]({'type':_0x493011(0x101),'content':_0x4a683b[_0x493011(0x10f)](_0x3ea327)}),_0x151ebe;};function formatMsgWithTags(_0x46434f){const _0x30a800=parseMsgTags(_0x46434f),_0x251d05=_0x30a800['map'](({content:_0x19d22f,type:_0x1861ff,name:_0x324306},_0x53de45)=>{const _0x3dcd15=_0x2c18,_0x46911f=_0x1861ff!==_0x3dcd15(0x101)&&_0x324306?_0x324306:_0x1b9f41[_0x3dcd15(0x11d)];return _0x1b9f41[_0x3dcd15(0x125)](_0x46911f,{'key':''+_0x53de45},_0x19d22f);});return _0x251d05;}function _0x3d11(){const _0x4d7acc=['CKBOX_TRANSLATIONS','code','assign',']:\x20Translation\x20for\x20key\x20\x27','lang','undefined','941295PRKSDK','push','values','strong','then','payload','Fragment','601022PATUlO','plural','createContext','80628BgVLXN','tag','1106dCaCrp','processTags','createElement','_plural','changeLang','indexOf','text','translations','3051756ckDuNd','filter','Provider','useEffect','\x27\x20is\x20missing.','4019832KXNGtC','2619141EnHdWL','length','exec','json','63808SSEjxH','loadTranslations','slice','useContext'];_0x3d11=function(){return _0x4d7acc;};return _0x3d11();}function formatMsg(_0x5b93f4,_0x307bcd,_0x440a92){const _0x202fc7=sprintf(_0x5b93f4,..._0x307bcd!==null&&_0x307bcd!==void 0x0?_0x307bcd:[]);if(!_0x440a92)return _0x202fc7;return formatMsgWithTags(_0x202fc7);}const useTranslation=()=>{const _0x229b63=_0x7c8c5f,{lang:_0x3e9762,debug:_0x3f8625,resources:_0x46b1b0}=_0x1b9f41[_0x229b63(0x110)](I18nContext);function _0x9c9d37(_0x4758e7,_0x1390b2){const _0x2ee5d8=_0x229b63,{found:_0x5a331a,msg:_0x2455e9}=getMsg(_0x3e9762,_0x4758e7,_0x46b1b0[_0x3e9762],{'plural':_0x1390b2===null||_0x1390b2===void 0x0?void 0x0:_0x1390b2[_0x2ee5d8(0x11f)]});_0x3f8625&&!_0x5a331a&&console['log']('['+_0x3e9762+_0x2ee5d8(0x114)+_0x4758e7+_0x2ee5d8(0x107));if(_0x1390b2===null||_0x1390b2===void 0x0?void 0x0:_0x1390b2[_0x2ee5d8(0x124)])return formatMsg(_0x2455e9,_0x1390b2===null||_0x1390b2===void 0x0?void 0x0:_0x1390b2['values'],!![]);return formatMsg(_0x2455e9,_0x1390b2===null||_0x1390b2===void 0x0?void 0x0:_0x1390b2[_0x2ee5d8(0x119)],![]);}return{'t':_0x9c9d37,'lang':_0x3e9762};};export{I18nContext,I18nProvider,getTranslations,useTranslation};
4
+ function _0x25a0(){const _0x40a4ca=['strong','useContext','translations','processTags','Plural\x20rules\x20could\x20not\x20be\x20created.\x20Perhaps\x20`Intl.PluralRules`\x20is\x20not\x20supported?','lang','isSupported','8ycJwpR','then','Fragment','map','assign','log','useReducer','12FuyzQB','select','Provider','length','includes','slice','createElement','values','keys','exec','text','16292BKAvCC','getKey','warn','json','517EapuEl','85mJatDR',']:\x20Translation\x20for\x20key\x20\x27','plural','supportedLocalesOf','3fvEMby','PluralRules','push','useEffect','changeLang','createContext','46160gkxGiM','38226RRbnrd','24039EWpBkI','undefined','360246boMwyK','charAt','payload','408qIEKbL','_rules','867433fROAVL','Plural\x20form\x20for\x20language\x20\x22','resources','545519jDbokM','loadTranslations'];_0x25a0=function(){return _0x40a4ca;};return _0x25a0();}const _0x37758c=_0x2129;(function(_0x275abf,_0x393327){const _0x26f99e=_0x2129,_0x32e260=_0x275abf();while(!![]){try{const _0x54f4e1=-parseInt(_0x26f99e(0x116))/0x1*(parseInt(_0x26f99e(0x10d))/0x2)+-parseInt(_0x26f99e(0x120))/0x3*(parseInt(_0x26f99e(0x131))/0x4)+parseInt(_0x26f99e(0x112))/0x5*(-parseInt(_0x26f99e(0x11d))/0x6)+parseInt(_0x26f99e(0x125))/0x7+parseInt(_0x26f99e(0x123))/0x8*(parseInt(_0x26f99e(0x11e))/0x9)+parseInt(_0x26f99e(0x11c))/0xa*(parseInt(_0x26f99e(0x111))/0xb)+-parseInt(_0x26f99e(0x138))/0xc*(-parseInt(_0x26f99e(0x128))/0xd);if(_0x54f4e1===_0x393327)break;else _0x32e260['push'](_0x32e260['shift']());}catch(_0x1f641e){_0x32e260['push'](_0x32e260['shift']());}}}(_0x25a0,0x23ae2));import*as _0x5677ce from'react';import{__rest}from'tslib';import{sprintf}from'sprintf-js';class Plural{constructor(_0x176f4f){const _0x4ed09e=_0x2129;this[_0x4ed09e(0x12f)]=_0x176f4f;try{this['_rules']=new Intl[(_0x4ed09e(0x117))](_0x176f4f);}catch(_0x343e93){console[_0x4ed09e(0x10f)](_0x4ed09e(0x12e));}}['getKey'](_0x18facb,_0x50a70d){const _0x148816=_0x2129;if(!this[_0x148816(0x124)])return _0x18facb+'_one';const _0x312f5d=this[_0x148816(0x124)][_0x148816(0x103)](_0x50a70d);return _0x18facb+'_'+_0x312f5d;}}Plural['isSupported']=_0x1c2f37=>{const _0x2e4445=_0x2129;try{return Intl['PluralRules'][_0x2e4445(0x115)]([_0x1c2f37])[_0x2e4445(0x105)]>0x0;}catch(_0x3469ec){return![];}};const I18nContext=_0x5677ce[_0x37758c(0x11b)]({'changeLang':()=>{},'debug':![],'lang':'en','resources':{},'pluralUtils':new Plural('en')});function reducer(_0x43f4a3,_0x32ca89){const _0x22697b=_0x37758c;switch(_0x32ca89['type']){case _0x22697b(0x11a):return Object[_0x22697b(0x135)](Object[_0x22697b(0x135)]({},_0x43f4a3),{'lang':_0x32ca89[_0x22697b(0x122)]});case _0x22697b(0x129):return Object[_0x22697b(0x135)](Object[_0x22697b(0x135)]({},_0x43f4a3),{'lang':_0x32ca89[_0x22697b(0x122)][_0x22697b(0x12f)],'resources':Object['assign'](Object[_0x22697b(0x135)]({},_0x43f4a3[_0x22697b(0x127)]),{[_0x32ca89[_0x22697b(0x122)][_0x22697b(0x12f)]]:_0x32ca89[_0x22697b(0x122)][_0x22697b(0x12c)]})});}}const useI18n=({debug:debug=![],loadURL:_0x2246e4,lang:_0x1f4d68='en',resources:_0x4f97ef={}})=>{const _0x2572b6=_0x37758c,[{lang:_0x54b406,resources:_0x361373},_0x100c6c]=_0x5677ce[_0x2572b6(0x137)](reducer,{'lang':_0x1f4d68,'resources':_0x4f97ef});_0x5677ce[_0x2572b6(0x119)](()=>{const _0x5cfc34=_0x2572b6,_0x37d391=Plural[_0x5cfc34(0x130)](_0x54b406);!_0x37d391&&console[_0x5cfc34(0x10f)](_0x5cfc34(0x126)+_0x54b406+'\x22\x20is\x20not\x20supported.');},[_0x54b406]),_0x5677ce[_0x2572b6(0x119)](()=>{const _0xe432c=_0x2572b6;if(_0x361373[_0x54b406]||!_0x2246e4)return;fetch(_0x2246e4(_0x54b406))[_0xe432c(0x132)](_0x11a103=>_0x11a103[_0xe432c(0x110)]())['then'](_0x4f60a0=>{_0x100c6c({'type':'loadTranslations','payload':{'lang':_0x54b406,'translations':_0x4f60a0}});});},[_0x54b406,_0x2246e4,_0x361373]);const _0x5f5d6b=_0x349727=>{_0x100c6c({'type':'changeLang','payload':_0x349727});};return{'changeLang':_0x5f5d6b,'debug':debug,'lang':_0x54b406,'pluralUtils':new Plural(_0x54b406),'resources':_0x361373};},I18nProvider=_0x450331=>{const _0x4b2e43=_0x37758c;var {children:_0x3a0371}=_0x450331,_0x1a5dfc=__rest(_0x450331,['children']);const _0x4cb2fb=useI18n(_0x1a5dfc);return _0x5677ce[_0x4b2e43(0x108)](I18nContext[_0x4b2e43(0x104)],{'value':_0x4cb2fb},_0x3a0371);},getTranslations=_0x570cb6=>{const _0x32e139=_0x37758c;var _0x31f2cd,_0x262bea;const _0xb86436=typeof globalThis!==_0x32e139(0x11f)?globalThis:global||self;return(_0x262bea=(_0x31f2cd=_0xb86436===null||_0xb86436===void 0x0?void 0x0:_0xb86436['CKBOX_TRANSLATIONS'])===null||_0x31f2cd===void 0x0?void 0x0:_0x31f2cd[_0x570cb6])!==null&&_0x262bea!==void 0x0?_0x262bea:{};},TAG_REGEX=/<[a-zA-Z0-9\-!/](?:"[^"]*"|'[^']*'|[^'">])*>/g,ALLOWED_TAGS=['em',_0x37758c(0x12a),'code'],getMsg=(_0x4d7ee2,_0x2b0390={},_0x1f4353)=>{const _0x1a4246=_0x37758c,_0x57fb9f=_0x1f4353[_0x1a4246(0x114)];if(_0x2b0390[_0x4d7ee2]&&_0x57fb9f===undefined)return{'found':!![],'msg':_0x2b0390[_0x4d7ee2]};const _0x3064ee=Object[_0x1a4246(0x10a)](_0x2b0390)['filter'](_0x52cdfc=>_0x52cdfc['indexOf'](_0x4d7ee2)===0x0);if(_0x3064ee[_0x1a4246(0x105)]===0x0||_0x57fb9f===undefined)return{'found':![],'msg':_0x4d7ee2};const _0x318d64=_0x1f4353['pluralUtils'][_0x1a4246(0x10e)](_0x4d7ee2,_0x57fb9f);return{'found':!![],'msg':_0x2b0390[_0x318d64]};},parseMsgTags=_0x2a9ec5=>{const _0x2fd49c=_0x37758c,_0x458506=[];let _0x4722c1=0x0,_0x1b3e96;while((_0x1b3e96=TAG_REGEX[_0x2fd49c(0x10b)](_0x2a9ec5))!==null){const _0x2f7642=_0x1b3e96[0x0],{index:_0x305d16}=_0x1b3e96,_0x2aa013=_0x2f7642[_0x2fd49c(0x121)](0x1)==='/',_0xb969f=_0x2aa013?_0x2f7642[_0x2fd49c(0x107)](0x2,-0x1):_0x2f7642[_0x2fd49c(0x107)](0x1,-0x1),_0x10f5a5=ALLOWED_TAGS[_0x2fd49c(0x106)](_0xb969f);if(!_0x10f5a5)continue;const _0x449fcc=_0x2a9ec5[_0x2fd49c(0x107)](_0x4722c1,_0x305d16);if(!_0x449fcc){_0x4722c1=_0x305d16+_0x2f7642['length'];continue;}_0x2aa013?_0x458506[_0x2fd49c(0x118)]({'type':'tag','name':_0x2f7642[_0x2fd49c(0x107)](0x2,-0x1),'content':_0x449fcc}):_0x458506[_0x2fd49c(0x118)]({'type':_0x2fd49c(0x10c),'content':_0x449fcc}),_0x4722c1=_0x305d16+_0x2f7642[_0x2fd49c(0x105)];}return _0x4722c1<_0x2a9ec5['length']&&_0x458506[_0x2fd49c(0x118)]({'type':_0x2fd49c(0x10c),'content':_0x2a9ec5[_0x2fd49c(0x107)](_0x4722c1)}),_0x458506;};function formatMsgWithTags(_0x4e4316){const _0x158c23=_0x37758c,_0x1b0a3e=parseMsgTags(_0x4e4316),_0x29ec44=_0x1b0a3e[_0x158c23(0x134)](({content:_0x237863,type:_0x4a5a0,name:_0x5476ab},_0x214c06)=>{const _0x449a99=_0x158c23,_0xf4383d=_0x4a5a0!==_0x449a99(0x10c)&&_0x5476ab?_0x5476ab:_0x5677ce[_0x449a99(0x133)];return _0x5677ce[_0x449a99(0x108)](_0xf4383d,{'key':''+_0x214c06},_0x237863);});return _0x29ec44;}function formatMsg(_0x4c11ad,_0x23a1f6,_0x18aa3d){const _0x382321=sprintf(_0x4c11ad,..._0x23a1f6!==null&&_0x23a1f6!==void 0x0?_0x23a1f6:[]);if(!_0x18aa3d)return _0x382321;return formatMsgWithTags(_0x382321);}function _0x2129(_0x9dab15,_0x5ae51a){const _0x25a0c5=_0x25a0();return _0x2129=function(_0x2129ac,_0x54c146){_0x2129ac=_0x2129ac-0x103;let _0x3d58b3=_0x25a0c5[_0x2129ac];return _0x3d58b3;},_0x2129(_0x9dab15,_0x5ae51a);}const useTranslation=()=>{const _0x5e3fc7=_0x37758c,{lang:_0x41ab09,debug:_0x484f5e,pluralUtils:_0x56eb2c,resources:_0x33d45f}=_0x5677ce[_0x5e3fc7(0x12b)](I18nContext);function _0x45337d(_0x1a5cf8,_0x385a66){const _0x48b3b5=_0x5e3fc7,{found:_0x4e14dc,msg:_0x46cdcb}=getMsg(_0x1a5cf8,_0x33d45f[_0x41ab09],{'plural':_0x385a66===null||_0x385a66===void 0x0?void 0x0:_0x385a66[_0x48b3b5(0x114)],'pluralUtils':_0x56eb2c});_0x484f5e&&!_0x4e14dc&&console[_0x48b3b5(0x136)]('['+_0x41ab09+_0x48b3b5(0x113)+_0x1a5cf8+'\x27\x20is\x20missing.');if(_0x385a66===null||_0x385a66===void 0x0?void 0x0:_0x385a66[_0x48b3b5(0x12d)])return formatMsg(_0x46cdcb,_0x385a66===null||_0x385a66===void 0x0?void 0x0:_0x385a66['values'],!![]);return formatMsg(_0x46cdcb,_0x385a66===null||_0x385a66===void 0x0?void 0x0:_0x385a66[_0x48b3b5(0x109)],![]);}return{'t':_0x45337d,'lang':_0x41ab09};};export{I18nContext,I18nProvider,getTranslations,useTranslation};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckbox/i18n",
3
- "version": "0.0.2",
3
+ "version": "0.0.5-dev.0",
4
4
  "description": "i18n functionality",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",