inline-i18n-multi-next 0.7.0 → 0.8.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/README.md CHANGED
@@ -15,7 +15,7 @@ npm install inline-i18n-multi-next
15
15
  | Entry point | Environment | Key exports |
16
16
  |---|---|---|
17
17
  | `inline-i18n-multi-next/server` | Server Components | `it`, `t`, `configureI18n`, `generateLocaleParams`, `createMetadata`, `getAlternates`, `createI18nMiddleware` |
18
- | `inline-i18n-multi-next/client` | Client Components | `LocaleProvider`, `useLocale`, `useT`, `it`, `T`, `RichText`, `useRichText`, `useLoadDictionaries`, `useDetectedLocale`, `registerFormatter`, `clearFormatters`, `detectLocale`, `clearICUCache`, `restoreLocale`, `configure`, `resetConfig` |
18
+ | `inline-i18n-multi-next/client` | Client Components | `LocaleProvider`, `useLocale`, `useT`, `useScopedT`, `it`, `T`, `RichText`, `useRichText`, `useLoadDictionaries`, `useDetectedLocale`, `registerFormatter`, `clearFormatters`, `detectLocale`, `clearICUCache`, `restoreLocale`, `configure`, `resetConfig`, `createScope` |
19
19
 
20
20
  ## Quick Start
21
21
 
@@ -266,6 +266,40 @@ configure({
266
266
  const saved = restoreLocale() // returns locale string or undefined
267
267
  ```
268
268
 
269
+ ## Translation Scope (v0.8.0)
270
+
271
+ Scope translations to a key prefix with `useScopedT`. Useful for large apps where each component only needs a subset of the dictionary.
272
+
273
+ ```tsx
274
+ 'use client'
275
+ import { useScopedT } from 'inline-i18n-multi-next/client'
276
+
277
+ export function Dashboard() {
278
+ const t = useScopedT('dashboard')
279
+ return (
280
+ <div>
281
+ <h1>{t('title')}</h1> {/* resolves to 'dashboard.title' */}
282
+ <p>{t('subtitle')}</p> {/* resolves to 'dashboard.subtitle' */}
283
+ </div>
284
+ )
285
+ }
286
+ ```
287
+
288
+ You can also create a reusable scope with `createScope`:
289
+
290
+ ```tsx
291
+ 'use client'
292
+ import { useScopedT } from 'inline-i18n-multi-next/client'
293
+ import { createScope } from 'inline-i18n-multi-next/client'
294
+
295
+ const scope = createScope('settings.profile')
296
+
297
+ export function ProfileForm() {
298
+ const t = useScopedT(scope)
299
+ return <label>{t('name')}</label> {/* resolves to 'settings.profile.name' */}
300
+ }
301
+ ```
302
+
269
303
  ## Custom Formatters
270
304
 
271
305
  Register custom ICU formatters via the core re-exports.
package/dist/client.d.mts CHANGED
@@ -1 +1 @@
1
- export { CustomFormatter, DetectLocaleOptions, DetectSource, Dictionaries, Dictionary, Locale, LocaleProvider, PluralRules, RichText, RichTextSegment, T, TranslationVars, Translations, clearDictionaries, clearFormatters, clearICUCache, detectLocale, en_de, en_es, en_fr, en_ja, en_zh, getDictionary, getLoadedLocales, getLocale, hasTranslation, isLoaded, it, it_de, it_es, it_fr, it_ja, it_zh, ja_es, ja_zh, loadAsync, loadDictionaries, loadDictionary, parseRichText, registerFormatter, restoreLocale, setLocale, t, useDetectedLocale, useLoadDictionaries, useLocale, useRichText, useT, zh_es } from 'inline-i18n-multi-react';
1
+ export { CustomFormatter, DetectLocaleOptions, DetectSource, Dictionaries, Dictionary, Locale, LocaleProvider, PluralRules, RichText, RichTextSegment, T, TranslationVars, Translations, clearDictionaries, clearFormatters, clearICUCache, createScope, detectLocale, en_de, en_es, en_fr, en_ja, en_zh, getDictionary, getLoadedLocales, getLocale, hasTranslation, isLoaded, it, it_de, it_es, it_fr, it_ja, it_zh, ja_es, ja_zh, loadAsync, loadDictionaries, loadDictionary, parseRichText, registerFormatter, restoreLocale, setLocale, t, useDetectedLocale, useLoadDictionaries, useLocale, useRichText, useScopedT, useT, zh_es } from 'inline-i18n-multi-react';
package/dist/client.d.ts CHANGED
@@ -1 +1 @@
1
- export { CustomFormatter, DetectLocaleOptions, DetectSource, Dictionaries, Dictionary, Locale, LocaleProvider, PluralRules, RichText, RichTextSegment, T, TranslationVars, Translations, clearDictionaries, clearFormatters, clearICUCache, detectLocale, en_de, en_es, en_fr, en_ja, en_zh, getDictionary, getLoadedLocales, getLocale, hasTranslation, isLoaded, it, it_de, it_es, it_fr, it_ja, it_zh, ja_es, ja_zh, loadAsync, loadDictionaries, loadDictionary, parseRichText, registerFormatter, restoreLocale, setLocale, t, useDetectedLocale, useLoadDictionaries, useLocale, useRichText, useT, zh_es } from 'inline-i18n-multi-react';
1
+ export { CustomFormatter, DetectLocaleOptions, DetectSource, Dictionaries, Dictionary, Locale, LocaleProvider, PluralRules, RichText, RichTextSegment, T, TranslationVars, Translations, clearDictionaries, clearFormatters, clearICUCache, createScope, detectLocale, en_de, en_es, en_fr, en_ja, en_zh, getDictionary, getLoadedLocales, getLocale, hasTranslation, isLoaded, it, it_de, it_es, it_fr, it_ja, it_zh, ja_es, ja_zh, loadAsync, loadDictionaries, loadDictionary, parseRichText, registerFormatter, restoreLocale, setLocale, t, useDetectedLocale, useLoadDictionaries, useLocale, useRichText, useScopedT, useT, zh_es } from 'inline-i18n-multi-react';
package/dist/client.js CHANGED
@@ -28,6 +28,10 @@ Object.defineProperty(exports, "clearICUCache", {
28
28
  enumerable: true,
29
29
  get: function () { return inlineI18nMultiReact.clearICUCache; }
30
30
  });
31
+ Object.defineProperty(exports, "createScope", {
32
+ enumerable: true,
33
+ get: function () { return inlineI18nMultiReact.createScope; }
34
+ });
31
35
  Object.defineProperty(exports, "detectLocale", {
32
36
  enumerable: true,
33
37
  get: function () { return inlineI18nMultiReact.detectLocale; }
@@ -152,6 +156,10 @@ Object.defineProperty(exports, "useRichText", {
152
156
  enumerable: true,
153
157
  get: function () { return inlineI18nMultiReact.useRichText; }
154
158
  });
159
+ Object.defineProperty(exports, "useScopedT", {
160
+ enumerable: true,
161
+ get: function () { return inlineI18nMultiReact.useScopedT; }
162
+ });
155
163
  Object.defineProperty(exports, "useT", {
156
164
  enumerable: true,
157
165
  get: function () { return inlineI18nMultiReact.useT; }
package/dist/client.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { LocaleProvider, RichText, T, clearDictionaries, clearFormatters, clearICUCache, detectLocale, en_de, en_es, en_fr, en_ja, en_zh, getDictionary, getLoadedLocales, getLocale, hasTranslation, isLoaded, it, it_de, it_es, it_fr, it_ja, it_zh, ja_es, ja_zh, loadAsync, loadDictionaries, loadDictionary, parseRichText, registerFormatter, restoreLocale, setLocale, t, useDetectedLocale, useLoadDictionaries, useLocale, useRichText, useT, zh_es } from 'inline-i18n-multi-react';
1
+ export { LocaleProvider, RichText, T, clearDictionaries, clearFormatters, clearICUCache, createScope, detectLocale, en_de, en_es, en_fr, en_ja, en_zh, getDictionary, getLoadedLocales, getLocale, hasTranslation, isLoaded, it, it_de, it_es, it_fr, it_ja, it_zh, ja_es, ja_zh, loadAsync, loadDictionaries, loadDictionary, parseRichText, registerFormatter, restoreLocale, setLocale, t, useDetectedLocale, useLoadDictionaries, useLocale, useRichText, useScopedT, useT, zh_es } from 'inline-i18n-multi-react';
2
2
  //# sourceMappingURL=client.mjs.map
3
3
  //# sourceMappingURL=client.mjs.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "inline-i18n-multi-next",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Next.js integration for inline-i18n-multi",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -51,8 +51,8 @@
51
51
  "react": "^18.0.0 || ^19.0.0"
52
52
  },
53
53
  "dependencies": {
54
- "inline-i18n-multi": "0.7.0",
55
- "inline-i18n-multi-react": "0.7.0"
54
+ "inline-i18n-multi": "0.8.0",
55
+ "inline-i18n-multi-react": "0.8.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/react": "^19.0.2",