@hua-labs/i18n-core 1.0.0 → 1.1.0-alpha.0.2

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.
@@ -1,62 +1,62 @@
1
- "use client";
2
-
3
- import { useI18n } from './useI18n';
4
-
5
- /**
6
- * 간단한 번역 훅 (원본 SDK와 호환)
7
- *
8
- * @example
9
- * ```tsx
10
- * import { useTranslation } from '@hua-labs/i18n-core';
11
- *
12
- * function MyComponent() {
13
- * const { t, currentLanguage, setLanguage, isLoading, error } = useTranslation();
14
- *
15
- * return (
16
- * <div>
17
- * <h1>{t('welcome')}</h1>
18
- * <p>Current language: {currentLanguage}</p>
19
- * <button onClick={() => setLanguage('en')}>Switch to English</button>
20
- * </div>
21
- * );
22
- * }
23
- * ```
24
- */
25
- export function useTranslation() {
26
- const { t, tWithParams, currentLanguage, setLanguage, getRawValue, isLoading, error, supportedLanguages, debug, isInitialized } = useI18n();
27
-
28
- return {
29
- t,
30
- tWithParams,
31
- currentLanguage,
32
- setLanguage,
33
- getRawValue,
34
- isLoading,
35
- error,
36
- supportedLanguages,
37
- debug,
38
- isInitialized,
39
- };
40
- }
41
-
42
- /**
43
- * 언어 변경 전용 훅
44
- */
45
- export function useLanguageChange() {
46
- const { currentLanguage, setLanguage, supportedLanguages } = useI18n();
47
-
48
- const changeLanguage = (language: string) => {
49
- const supported = supportedLanguages.find(lang => lang.code === language);
50
- if (supported) {
51
- setLanguage(language);
52
- } else {
53
- console.warn(`Language ${language} is not supported`);
54
- }
55
- };
56
-
57
- return {
58
- currentLanguage,
59
- changeLanguage,
60
- supportedLanguages,
61
- };
1
+ "use client";
2
+
3
+ import { useI18n } from './useI18n';
4
+
5
+ /**
6
+ * 간단한 번역 훅 (원본 SDK와 호환)
7
+ *
8
+ * @example
9
+ * ```tsx
10
+ * import { useTranslation } from '@hua-labs/i18n-core';
11
+ *
12
+ * function MyComponent() {
13
+ * const { t, currentLanguage, setLanguage, isLoading, error } = useTranslation();
14
+ *
15
+ * return (
16
+ * <div>
17
+ * <h1>{t('welcome')}</h1>
18
+ * <p>Current language: {currentLanguage}</p>
19
+ * <button onClick={() => setLanguage('en')}>Switch to English</button>
20
+ * </div>
21
+ * );
22
+ * }
23
+ * ```
24
+ */
25
+ export function useTranslation() {
26
+ const { t, tWithParams, currentLanguage, setLanguage, getRawValue, isLoading, error, supportedLanguages, debug, isInitialized } = useI18n();
27
+
28
+ return {
29
+ t,
30
+ tWithParams,
31
+ currentLanguage,
32
+ setLanguage,
33
+ getRawValue,
34
+ isLoading,
35
+ error,
36
+ supportedLanguages,
37
+ debug,
38
+ isInitialized,
39
+ };
40
+ }
41
+
42
+ /**
43
+ * 언어 변경 전용 훅
44
+ */
45
+ export function useLanguageChange() {
46
+ const { currentLanguage, setLanguage, supportedLanguages } = useI18n();
47
+
48
+ const changeLanguage = (language: string) => {
49
+ const supported = supportedLanguages.find(lang => lang.code === language);
50
+ if (supported) {
51
+ setLanguage(language);
52
+ } else {
53
+ console.warn(`Language ${language} is not supported`);
54
+ }
55
+ };
56
+
57
+ return {
58
+ currentLanguage,
59
+ changeLanguage,
60
+ supportedLanguages,
61
+ };
62
62
  }