@hua-labs/i18n-core 2.2.0 → 2.2.1
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/LICENSE +21 -0
- package/README.md +4 -4
- package/dist/{chunk-7ZYOSEMW.mjs → chunk-4IYWT7MS.mjs} +143 -45
- package/dist/chunk-4IYWT7MS.mjs.map +1 -0
- package/dist/index.cjs +500 -288
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +21 -21
- package/dist/index.d.ts +21 -21
- package/dist/index.mjs +361 -247
- package/dist/index.mjs.map +1 -1
- package/dist/{server-DgpyR0RE.d.mts → server-CQztOmd-.d.mts} +21 -7
- package/dist/{server-DgpyR0RE.d.ts → server-CQztOmd-.d.ts} +21 -7
- package/dist/server.cjs +141 -43
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.mjs +1 -1
- package/package.json +9 -9
- package/src/__tests__/default-value.test.ts +149 -0
- package/src/core/translator.tsx +385 -188
- package/src/hooks/useI18n.tsx +490 -337
- package/src/types/index.ts +291 -163
- package/dist/chunk-7ZYOSEMW.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React$1 from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { I as I18nConfig, a as I18nContextType, L as LanguageConfig, R as ResolveStringKey, T as TranslationParams, b as ResolvePluralKey, c as ResolveArrayKey, d as TranslationError } from './server-
|
|
4
|
-
export { e as I18nPlatformAdapter, P as PluralCategory, f as PluralValue, g as Translator, h as TypedTranslationKeys, i as headlessPlatformAdapter, s as serverTranslate, j as ssrTranslate, w as webPlatformAdapter } from './server-
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { I as I18nConfig, a as I18nContextType, L as LanguageConfig, R as ResolveStringKey, T as TranslationParams, b as ResolvePluralKey, c as ResolveArrayKey, d as TranslationError } from './server-CQztOmd-.mjs';
|
|
4
|
+
export { e as I18nPlatformAdapter, P as PluralCategory, f as PluralValue, g as Translator, h as TypedTranslationKeys, i as headlessPlatformAdapter, s as serverTranslate, j as ssrTranslate, w as webPlatformAdapter } from './server-CQztOmd-.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* I18n Provider 컴포넌트
|
|
8
8
|
*/
|
|
9
|
-
declare function I18nProvider({ config, children }: {
|
|
9
|
+
declare function I18nProvider({ config, children, }: {
|
|
10
10
|
config: I18nConfig & {
|
|
11
11
|
autoLanguageSync?: boolean;
|
|
12
12
|
};
|
|
13
13
|
children: React.ReactNode;
|
|
14
|
-
}):
|
|
14
|
+
}): React$1.JSX.Element;
|
|
15
15
|
/**
|
|
16
16
|
* I18n 훅
|
|
17
17
|
*/
|
|
@@ -194,56 +194,56 @@ declare function createCoreI18n(options?: {
|
|
|
194
194
|
*/
|
|
195
195
|
localFallbackBaseUrl?: string;
|
|
196
196
|
}): ({ children }: {
|
|
197
|
-
children:
|
|
198
|
-
}) =>
|
|
197
|
+
children: React__default.ReactNode;
|
|
198
|
+
}) => React__default.FunctionComponentElement<{
|
|
199
199
|
config: I18nConfig & {
|
|
200
200
|
autoLanguageSync?: boolean;
|
|
201
201
|
};
|
|
202
|
-
children:
|
|
202
|
+
children: React__default.ReactNode;
|
|
203
203
|
}>;
|
|
204
204
|
/**
|
|
205
205
|
* 가장 기본적인 Provider (최소한의 설정)
|
|
206
206
|
*/
|
|
207
207
|
declare function CoreProvider({ children }: {
|
|
208
|
-
children:
|
|
209
|
-
}):
|
|
208
|
+
children: React__default.ReactNode;
|
|
209
|
+
}): React__default.FunctionComponentElement<{
|
|
210
210
|
config: I18nConfig & {
|
|
211
211
|
autoLanguageSync?: boolean;
|
|
212
212
|
};
|
|
213
|
-
children:
|
|
213
|
+
children: React__default.ReactNode;
|
|
214
214
|
}>;
|
|
215
215
|
/**
|
|
216
216
|
* 언어별 Provider (언어만 지정)
|
|
217
217
|
*/
|
|
218
218
|
declare function createLanguageProvider(language: string): ({ children }: {
|
|
219
|
-
children:
|
|
220
|
-
}) =>
|
|
219
|
+
children: React__default.ReactNode;
|
|
220
|
+
}) => React__default.FunctionComponentElement<{
|
|
221
221
|
config: I18nConfig & {
|
|
222
222
|
autoLanguageSync?: boolean;
|
|
223
223
|
};
|
|
224
|
-
children:
|
|
224
|
+
children: React__default.ReactNode;
|
|
225
225
|
}>;
|
|
226
226
|
/**
|
|
227
227
|
* 네임스페이스별 Provider (네임스페이스만 지정)
|
|
228
228
|
*/
|
|
229
229
|
declare function createNamespaceProvider(namespaces: string[]): ({ children }: {
|
|
230
|
-
children:
|
|
231
|
-
}) =>
|
|
230
|
+
children: React__default.ReactNode;
|
|
231
|
+
}) => React__default.FunctionComponentElement<{
|
|
232
232
|
config: I18nConfig & {
|
|
233
233
|
autoLanguageSync?: boolean;
|
|
234
234
|
};
|
|
235
|
-
children:
|
|
235
|
+
children: React__default.ReactNode;
|
|
236
236
|
}>;
|
|
237
237
|
/**
|
|
238
238
|
* 커스텀 로더 Provider (사용자 정의 번역 로더 사용)
|
|
239
239
|
*/
|
|
240
240
|
declare function createCustomLoaderProvider(loadTranslations: (language: string, namespace: string) => Promise<Record<string, string>>): ({ children }: {
|
|
241
|
-
children:
|
|
242
|
-
}) =>
|
|
241
|
+
children: React__default.ReactNode;
|
|
242
|
+
}) => React__default.FunctionComponentElement<{
|
|
243
243
|
config: I18nConfig & {
|
|
244
244
|
autoLanguageSync?: boolean;
|
|
245
245
|
};
|
|
246
|
-
children:
|
|
246
|
+
children: React__default.ReactNode;
|
|
247
247
|
}>;
|
|
248
248
|
|
|
249
249
|
export { CoreProvider, I18nConfig, I18nContextType, I18nProvider, ResolveArrayKey, ResolvePluralKey, ResolveStringKey, TranslationParams, createCoreI18n, createCustomLoaderProvider, createLanguageProvider, createNamespaceProvider, useI18n, useLanguageChange, useTranslation };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import React$1 from 'react';
|
|
2
|
-
import
|
|
3
|
-
import { I as I18nConfig, a as I18nContextType, L as LanguageConfig, R as ResolveStringKey, T as TranslationParams, b as ResolvePluralKey, c as ResolveArrayKey, d as TranslationError } from './server-
|
|
4
|
-
export { e as I18nPlatformAdapter, P as PluralCategory, f as PluralValue, g as Translator, h as TypedTranslationKeys, i as headlessPlatformAdapter, s as serverTranslate, j as ssrTranslate, w as webPlatformAdapter } from './server-
|
|
1
|
+
import * as React$1 from 'react';
|
|
2
|
+
import React__default from 'react';
|
|
3
|
+
import { I as I18nConfig, a as I18nContextType, L as LanguageConfig, R as ResolveStringKey, T as TranslationParams, b as ResolvePluralKey, c as ResolveArrayKey, d as TranslationError } from './server-CQztOmd-.js';
|
|
4
|
+
export { e as I18nPlatformAdapter, P as PluralCategory, f as PluralValue, g as Translator, h as TypedTranslationKeys, i as headlessPlatformAdapter, s as serverTranslate, j as ssrTranslate, w as webPlatformAdapter } from './server-CQztOmd-.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* I18n Provider 컴포넌트
|
|
8
8
|
*/
|
|
9
|
-
declare function I18nProvider({ config, children }: {
|
|
9
|
+
declare function I18nProvider({ config, children, }: {
|
|
10
10
|
config: I18nConfig & {
|
|
11
11
|
autoLanguageSync?: boolean;
|
|
12
12
|
};
|
|
13
13
|
children: React.ReactNode;
|
|
14
|
-
}):
|
|
14
|
+
}): React$1.JSX.Element;
|
|
15
15
|
/**
|
|
16
16
|
* I18n 훅
|
|
17
17
|
*/
|
|
@@ -194,56 +194,56 @@ declare function createCoreI18n(options?: {
|
|
|
194
194
|
*/
|
|
195
195
|
localFallbackBaseUrl?: string;
|
|
196
196
|
}): ({ children }: {
|
|
197
|
-
children:
|
|
198
|
-
}) =>
|
|
197
|
+
children: React__default.ReactNode;
|
|
198
|
+
}) => React__default.FunctionComponentElement<{
|
|
199
199
|
config: I18nConfig & {
|
|
200
200
|
autoLanguageSync?: boolean;
|
|
201
201
|
};
|
|
202
|
-
children:
|
|
202
|
+
children: React__default.ReactNode;
|
|
203
203
|
}>;
|
|
204
204
|
/**
|
|
205
205
|
* 가장 기본적인 Provider (최소한의 설정)
|
|
206
206
|
*/
|
|
207
207
|
declare function CoreProvider({ children }: {
|
|
208
|
-
children:
|
|
209
|
-
}):
|
|
208
|
+
children: React__default.ReactNode;
|
|
209
|
+
}): React__default.FunctionComponentElement<{
|
|
210
210
|
config: I18nConfig & {
|
|
211
211
|
autoLanguageSync?: boolean;
|
|
212
212
|
};
|
|
213
|
-
children:
|
|
213
|
+
children: React__default.ReactNode;
|
|
214
214
|
}>;
|
|
215
215
|
/**
|
|
216
216
|
* 언어별 Provider (언어만 지정)
|
|
217
217
|
*/
|
|
218
218
|
declare function createLanguageProvider(language: string): ({ children }: {
|
|
219
|
-
children:
|
|
220
|
-
}) =>
|
|
219
|
+
children: React__default.ReactNode;
|
|
220
|
+
}) => React__default.FunctionComponentElement<{
|
|
221
221
|
config: I18nConfig & {
|
|
222
222
|
autoLanguageSync?: boolean;
|
|
223
223
|
};
|
|
224
|
-
children:
|
|
224
|
+
children: React__default.ReactNode;
|
|
225
225
|
}>;
|
|
226
226
|
/**
|
|
227
227
|
* 네임스페이스별 Provider (네임스페이스만 지정)
|
|
228
228
|
*/
|
|
229
229
|
declare function createNamespaceProvider(namespaces: string[]): ({ children }: {
|
|
230
|
-
children:
|
|
231
|
-
}) =>
|
|
230
|
+
children: React__default.ReactNode;
|
|
231
|
+
}) => React__default.FunctionComponentElement<{
|
|
232
232
|
config: I18nConfig & {
|
|
233
233
|
autoLanguageSync?: boolean;
|
|
234
234
|
};
|
|
235
|
-
children:
|
|
235
|
+
children: React__default.ReactNode;
|
|
236
236
|
}>;
|
|
237
237
|
/**
|
|
238
238
|
* 커스텀 로더 Provider (사용자 정의 번역 로더 사용)
|
|
239
239
|
*/
|
|
240
240
|
declare function createCustomLoaderProvider(loadTranslations: (language: string, namespace: string) => Promise<Record<string, string>>): ({ children }: {
|
|
241
|
-
children:
|
|
242
|
-
}) =>
|
|
241
|
+
children: React__default.ReactNode;
|
|
242
|
+
}) => React__default.FunctionComponentElement<{
|
|
243
243
|
config: I18nConfig & {
|
|
244
244
|
autoLanguageSync?: boolean;
|
|
245
245
|
};
|
|
246
|
-
children:
|
|
246
|
+
children: React__default.ReactNode;
|
|
247
247
|
}>;
|
|
248
248
|
|
|
249
249
|
export { CoreProvider, I18nConfig, I18nContextType, I18nProvider, ResolveArrayKey, ResolvePluralKey, ResolveStringKey, TranslationParams, createCoreI18n, createCustomLoaderProvider, createLanguageProvider, createNamespaceProvider, useI18n, useLanguageChange, useTranslation };
|