inline-i18n-multi-react 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/README.md +78 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ > **Important:** For complete documentation, examples, and best practices, please read the [full documentation on GitHub](https://github.com/exiivy98/inline-i18n-multi).
2
+
3
+ # inline-i18n-multi-react
4
+
5
+ React bindings for inline-i18n-multi. Write translations inline in your components.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install inline-i18n-multi-react
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```tsx
16
+ import { LocaleProvider, it, T, useT } from 'inline-i18n-multi-react'
17
+
18
+ function App() {
19
+ return (
20
+ <LocaleProvider locale="ko">
21
+ <MyComponent />
22
+ </LocaleProvider>
23
+ )
24
+ }
25
+
26
+ function MyComponent() {
27
+ return (
28
+ <div>
29
+ {/* Inline function */}
30
+ <p>{it('안녕하세요', 'Hello')}</p>
31
+
32
+ {/* T component */}
33
+ <T ko="환영합니다" en="Welcome" ja="ようこそ" />
34
+
35
+ {/* With variables */}
36
+ <T ko="{count}개" en="{count} items" count={5} />
37
+ </div>
38
+ )
39
+ }
40
+ ```
41
+
42
+ ## Key-Based Translation with useT
43
+
44
+ ```tsx
45
+ import { useT, loadDictionaries } from 'inline-i18n-multi-react'
46
+
47
+ loadDictionaries({
48
+ en: { nav: { home: 'Home', about: 'About' } },
49
+ ko: { nav: { home: '홈', about: '소개' } },
50
+ })
51
+
52
+ function Nav() {
53
+ const t = useT()
54
+ return (
55
+ <nav>
56
+ <a href="/">{t('nav.home')}</a>
57
+ <a href="/about">{t('nav.about')}</a>
58
+ </nav>
59
+ )
60
+ }
61
+ ```
62
+
63
+ ## API
64
+
65
+ - `LocaleProvider` - Context provider for locale
66
+ - `useLocale()` - Get/set current locale
67
+ - `it(ko, en, vars?)` - Inline translation function
68
+ - `T` - Translation component with language props
69
+ - `useT()` - Hook returning key-based `t()` function
70
+ - `loadDictionaries(dict)` - Load translation dictionaries
71
+
72
+ ## Documentation
73
+
74
+ **Please read the [full documentation on GitHub](https://github.com/exiivy98/inline-i18n-multi)** for complete API reference, advanced patterns, and best practices.
75
+
76
+ ## License
77
+
78
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inline-i18n-multi-react",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "React integration for inline-i18n-multi",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -34,7 +34,7 @@
34
34
  "react": "^18.0.0 || ^19.0.0"
35
35
  },
36
36
  "dependencies": {
37
- "inline-i18n-multi": "0.1.0"
37
+ "inline-i18n-multi": "0.1.2"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/react": "^19.0.2",