inline-i18n-multi-react 0.8.0 → 0.10.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.
Files changed (2) hide show
  1. package/README.md +32 -0
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -183,6 +183,38 @@ function ProfileForm() {
183
183
  }
184
184
  ```
185
185
 
186
+ ## Context System (v0.9.0)
187
+
188
+ Select translations based on context. Pass `_context` to `t()` to choose between contextual variants defined in your dictionaries.
189
+
190
+ ```tsx
191
+ import { useT, loadDictionaries } from 'inline-i18n-multi-react'
192
+
193
+ loadDictionaries({
194
+ en: {
195
+ greeting: 'Hello',
196
+ 'greeting#formal': 'Good day',
197
+ 'greeting#casual': 'Hey',
198
+ },
199
+ ko: {
200
+ greeting: '안녕하세요',
201
+ 'greeting#formal': '안녕하십니까',
202
+ 'greeting#casual': '안녕',
203
+ },
204
+ })
205
+
206
+ function Greeting() {
207
+ const t = useT()
208
+ return (
209
+ <div>
210
+ <p>{t('greeting')}</p> {/* "Hello" */}
211
+ <p>{t('greeting', { _context: 'formal' })}</p> {/* "Good day" */}
212
+ <p>{t('greeting', { _context: 'casual' })}</p> {/* "Hey" */}
213
+ </div>
214
+ )
215
+ }
216
+ ```
217
+
186
218
  ## Automatic Locale Detection
187
219
 
188
220
  ```tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inline-i18n-multi-react",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
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.8.0"
37
+ "inline-i18n-multi": "0.10.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/react": "^19.0.2",