@intlayer/vue-i18n 9.2.0 → 9.3.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/README.md CHANGED
@@ -47,27 +47,27 @@ With **per-locale content files**, **TypeScript autocompletion**, **tree-shakabl
47
47
 
48
48
  ## Keys benefits of Intlayer:
49
49
 
50
- | Feature | Description |
51
- | --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more. |
53
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content) |
54
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file) |
55
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/compiler.jpg?raw=true" alt="Feature" width="700"> | **Compiler**<br><br>The Intlayer Compiler extract automatically the content from the components and generate the dictionary files.<br><br> - [Compiler](https://intlayer.org/doc/compiler) |
56
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true" alt="Feature" width="700"> | **Type-Safe Environment**<br><br>Leverage TypeScript to ensure your content definitions and code are error-free, while also benefiting from IDE autocompletion.<br><br> - [TypeScript configuration](https://intlayer.org/doc/environment/vite-and-react#configure-typescript) |
57
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/config_file.png?raw=true" alt="Feature" width="700"> | **Simplified Setup**<br><br>Get up and running quickly with minimal configuration. Adjust settings for internationalization, routing, AI, build, and content handling with ease. <br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
58
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/content_retrieval.png?raw=true" alt="Feature" width="700"> | **Simplified Content Retrieval**<br><br>No need to call your `t` function for each piece of content. Retrieve all your content directly using a single hook.<br><br> - [React integration](https://intlayer.org/doc/environment/create-react-app) |
59
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/server_component.png?raw=true" alt="Feature" width="700"> | **Consistent Server Component Implementation**<br><br>Perfectly suited for Next.js server components, use the same implementation for both client and server components, no need to pass your `t` function across each server component. <br><br> - [Server Components](https://intlayer.org/doc/environment/nextjs#step-7-utilize-content-in-your-code) |
60
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/file_tree.png?raw=true" alt="Feature" width="700"> | **Organized Codebase**<br><br>Keep your codebase more organized: 1 component = 1 dictionary in the same folder. Translations close to their respective components, enhance maintainability and clarity. <br><br> - [How Intlayer works](https://intlayer.org/doc/concept/how-works-intlayer) |
61
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/url_routing.png?raw=true" alt="Feature" width="700"> | **Enhanced Routing**<br><br>Full support of app routing, adapting seamlessly to complex application structures, for Next.js, React, Vite, Vue.js, etc.<br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
62
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/markdown.png?raw=true" alt="Feature" width="700"> | **Markdown Support**<br><br>Import and interpret, locale files and remote Markdown for multilingual content like privacy policies, documentation, etc. Interpret and make Markdown metadata accessible in your code.<br><br> - [Content files](https://intlayer.org/doc/concept/content/file) |
63
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/visual_editor.png?raw=true" alt="Feature" width="700"> | **Free Visual Editor & CMS**<br><br>A free visual editor and CMS are available for content writers, removing the need for a localization platform. Keep your content synchronized using Git, or externalize it totally or partially with the CMS.<br><br> - [Intlayer Editor](https://intlayer.org/doc/concept/editor) <br> - [Intlayer CMS](https://intlayer.org/doc/concept/cms) |
64
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.png?raw=true" alt="Feature" width="700"> | **Tree-shakable Content**<br><br>Tree-shakable content, reducing the size of the final bundle. Loads content per component, excluding any unused content from your bundle. Supports lazy loading to enhance app loading efficiency. <br><br> - [App build optimization](https://intlayer.org/doc/concept/how-works-intlayer#app-build-optimization) |
65
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/static_rendering.png?raw=true" alt="Feature" width="700"> | **Static Rendering**<br><br>Doesn't block Static Rendering. <br><br> - [Next.js integration](https://intlayer.org/doc/environment/nextjs) |
66
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/AI_translation.png?raw=true" alt="Feature" width="700"> | **AI-Powered Translation**<br><br>Transform your website into 231 languages with just one click using Intlayer's advanced AI-powered translation tools using your own AI provider / API key. <br><br> - [CI/CD integration](https://intlayer.org/doc/concept/ci-cd) <br> - [Intlayer CLI](https://intlayer.org/doc/concept/cli) <br> - [Auto fill](https://intlayer.org/doc/concept/auto-fill) |
67
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/mcp.png?raw=true" alt="Feature" width="700"> | **MCP Server Integration**<br><br>Provides an MCP (Model Context Protocol) server for IDE automation, enabling seamless content management and i18n workflows directly within your development environment. <br><br> - [MCP Server](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/mcp_server.md) |
68
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/vscode_extension.png?raw=true" alt="Feature" width="700"> | **VSCode Extension**<br><br>Intlayer provides a VSCode extension to help you manage your content and translations, building your dictionaries, translating your content, and more. <br><br> - [VSCode Extension](https://intlayer.org/doc/vs-code-extension) |
69
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/interoperability.png?raw=true" alt="Feature" width="700"> | **Interoperability**<br><br>Allow interoperability with react-i18next, next-i18next, next-intl, react-intl, vue-i18n. <br><br> - [Intlayer and react-intl](https://intlayer.org/blog/intlayer-with-react-intl) <br> - [Intlayer and next-intl](https://intlayer.org/blog/intlayer-with-next-intl) <br> - [Intlayer and next-i18next](https://intlayer.org/blog/intlayer-with-next-i18next) <br> - [Intlayer and vue-i18n](https://intlayer.org/blog/intlayer-with-vue-i18n) |
70
- | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/benchmark.png?raw=true" alt="Feature" width="700"> | **Performances & Benchmark**<br><br>Uses advanced tree-shaking and dynamic loading to boost performances and keep the solution as light as possible. <br><br> - [Performances & Benchmark](https://intlayer.org/doc/benchmark) |
50
+ | Feature | Description |
51
+ | --------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
52
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more. |
53
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content) |
54
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file) |
55
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/compiler.jpg?raw=true" alt="Feature" width="700"> | **Compiler**<br><br>The Intlayer Compiler extract automatically the content from the components and generate the dictionary files.<br><br> - [Compiler](https://intlayer.org/doc/compiler) |
56
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true" alt="Feature" width="700"> | **Type-Safe Environment**<br><br>Leverage TypeScript to ensure your content definitions and code are error-free, while also benefiting from IDE autocompletion.<br><br> - [TypeScript configuration](https://intlayer.org/doc/environment/vite-and-react#configure-typescript) |
57
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/config_file.png?raw=true" alt="Feature" width="700"> | **Simplified Setup**<br><br>Get up and running quickly with minimal configuration. Adjust settings for internationalization, routing, AI, build, and content handling with ease. <br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
58
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/content_retrieval.png?raw=true" alt="Feature" width="700"> | **Simplified Content Retrieval**<br><br>No need to call your `t` function for each piece of content. Retrieve all your content directly using a single hook.<br><br> - [React integration](https://intlayer.org/doc/environment/create-react-app) |
59
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/server_component.png?raw=true" alt="Feature" width="700"> | **Consistent Server Component Implementation**<br><br>Perfectly suited for Next.js server components, use the same implementation for both client and server components, no need to pass your `t` function across each server component. <br><br> - [Server Components](https://intlayer.org/doc/environment/nextjs#step-7-utilize-content-in-your-code) |
60
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/file_tree.png?raw=true" alt="Feature" width="700"> | **Organized Codebase**<br><br>Keep your codebase more organized: 1 component = 1 dictionary in the same folder. Translations close to their respective components, enhance maintainability and clarity. <br><br> - [How Intlayer works](https://intlayer.org/doc/concept/how-works-intlayer) |
61
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/url_routing.png?raw=true" alt="Feature" width="700"> | **Enhanced Routing**<br><br>Full support of app routing, adapting seamlessly to complex application structures, for Next.js, React, Vite, Vue.js, etc.<br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
62
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/markdown.png?raw=true" alt="Feature" width="700"> | **Markdown Support**<br><br>Import and interpret, locale files and remote Markdown for multilingual content like privacy policies, documentation, etc. Interpret and make Markdown metadata accessible in your code.<br><br> - [Content files](https://intlayer.org/doc/concept/content/file) |
63
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/visual_editor.png?raw=true" alt="Feature" width="700"> | **Free Visual Editor & CMS**<br><br>A free visual editor and CMS are available for content writers, removing the need for a localization platform. Keep your content synchronized using Git, or externalize it totally or partially with the CMS.<br><br> - [Intlayer Editor](https://intlayer.org/doc/concept/editor) <br> - [Intlayer CMS](https://intlayer.org/doc/concept/cms) |
64
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.png?raw=true" alt="Feature" width="700"> | **Tree-shakable Content**<br><br>Tree-shakable content, reducing the size of the final bundle. Loads content per component, excluding any unused content from your bundle. Supports lazy loading to enhance app loading efficiency. <br><br> - [App build optimization](https://intlayer.org/doc/concept/how-works-intlayer#app-build-optimization) |
65
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/static_rendering.png?raw=true" alt="Feature" width="700"> | **Static Rendering**<br><br>Doesn't block Static Rendering. <br><br> - [Next.js integration](https://intlayer.org/doc/environment/nextjs) |
66
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/AI_translation.png?raw=true" alt="Feature" width="700"> | **AI-Powered Translation**<br><br>Transform your website into 231 languages with just one click using Intlayer's advanced AI-powered translation tools using your own AI provider / API key. <br><br> - [CI/CD integration](https://intlayer.org/doc/concept/ci-cd) <br> - [Intlayer CLI](https://intlayer.org/doc/concept/cli) <br> - [Auto fill](https://intlayer.org/doc/concept/auto-fill) |
67
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/mcp.png?raw=true" alt="Feature" width="700"> | **MCP Server Integration**<br><br>Provides an MCP (Model Context Protocol) server for IDE automation, enabling seamless content management and i18n workflows directly within your development environment. <br><br> - [MCP Server](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/mcp_server.md) |
68
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/vscode_extension.png?raw=true" alt="Feature" width="700"> | **VSCode Extension**<br><br>Intlayer provides a VSCode extension to help you manage your content and translations, building your dictionaries, translating your content, and more. <br><br> - [VSCode Extension](https://intlayer.org/doc/vs-code-extension) |
69
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/interoperability.png?raw=true" alt="Feature" width="700"> | **Interoperability**<br><br>Allow interoperability with react-i18next, next-i18next, next-intl, react-intl, vue-i18n. <br><br> - [Intlayer and react-intl](https://intlayer.org/blog/intlayer-with-react-intl) <br> - [Intlayer and next-intl](https://intlayer.org/blog/intlayer-with-next-intl) <br> - [Intlayer and next-i18next](https://intlayer.org/blog/intlayer-with-next-i18next) <br> - [Intlayer and vue-i18n](https://intlayer.org/blog/intlayer-with-vue-i18n) <br> - [Intlayer compat adapters](https://intlayer.org/doc/compatibility) |
70
+ | <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/benchmark.png?raw=true" alt="Feature" width="700"> | **Performances & Benchmark**<br><br>Uses advanced tree-shaking and dynamic loading to boost performances and keep the solution as light as possible. <br><br> - [Performances & Benchmark](https://intlayer.org/doc/benchmark) |
71
71
 
72
72
  ---
73
73
 
@@ -162,7 +162,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
162
162
  <li><a href="https://intlayer.org/doc/concept/cms" rel=''>Intlayer CMS</a></li>
163
163
  <li><a href="https://intlayer.org/doc/concept/content" rel=''>Dictionary</a>
164
164
  <ul>
165
- <li><a href="https://intlayer.org/doc/concept/content/per-locale-file" rel=''>Per-Locale Content Declaration File</a></li>
165
+ <li><a href="https://intlayer.org/doc/concept/per-locale-file" rel=''>Per-Locale Content Declaration File</a></li>
166
166
  <li><a href="https://intlayer.org/doc/concept/content/translation" rel=''>Translation</a></li>
167
167
  <li><a href="https://intlayer.org/doc/concept/content/enumeration" rel=''>Enumeration</a></li>
168
168
  <li><a href="https://intlayer.org/doc/concept/content/condition" rel=''>Condition</a></li>
@@ -183,7 +183,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
183
183
  <ul>
184
184
  <li><a href="https://intlayer.org/doc/environment/nextjs/15" rel=''>Next.js 15</a></li>
185
185
  <li><a href="https://intlayer.org/doc/environment/nextjs/14" rel=''>Next.js 14 (App Router)</a></li>
186
- <li><a href="https://intlayer.org/doc/environment/nextjs/next-with-Page-Router" rel=''>Next.js Page Router</a></li>
186
+ <li><a href="https://intlayer.org/doc/environment/nextjs/next-with-page-router" rel=''>Next.js Page Router</a></li>
187
187
  <li><a href="https://intlayer.org/doc/environment/nextjs/compiler" rel=''>Next.js using Compiler</a></li>
188
188
  </ul>
189
189
  </li>
@@ -212,7 +212,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
212
212
  <li><a href="https://intlayer.org/doc/environment/sveltekit" rel=''>SvelteKit</a></li>
213
213
  <li><a href="https://intlayer.org/doc/environment/vite-and-preact" rel=''>Vite + Preact</a></li>
214
214
  <li><a href="https://intlayer.org/doc/environment/vite-and-vue" rel=''>Vite + Vue</a></li>
215
- <li><a href="https://intlayer.org/doc/environment/vite-and-nuxt" rel=''>Vite + Nuxt</a></li>
215
+ <li><a href="https://intlayer.org/doc/environment/nuxt-and-vue" rel=''>Vite + Nuxt</a></li>
216
216
  <li><a href="https://intlayer.org/doc/environment/vite-and-solid" rel=''>Vite + Solid</a></li>
217
217
  <li><a href="https://intlayer.org/doc/environment/angular" rel=''>Angular</a></li>
218
218
  <li>
@@ -28,7 +28,8 @@ const DEFAULT_NAMESPACE = "translation";
28
28
  /** Resolves a single dictionary by key and navigates to the given path. */
29
29
  const lookupInDictionary = (locale, dictionaryKey, path) => {
30
30
  try {
31
- const value = navigatePath(getIntlayer(dictionaryKey, locale), path);
31
+ const dictionary = getIntlayer(dictionaryKey, locale);
32
+ const value = navigatePath(dictionary, path);
32
33
  if (value !== void 0 && value !== null) return value;
33
34
  } catch {}
34
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"createI18n.mjs","names":[],"sources":["../../src/createI18n.ts"],"sourcesContent":["import { internationalization, log } from '@intlayer/config/built';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getIntlayer } from '@intlayer/core/interpreter';\nimport { navigatePath } from '@intlayer/core/messageFormat';\nimport type {\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport type {\n App,\n DirectiveBinding,\n InjectionKey,\n WritableComputedRef,\n} from 'vue';\nimport { computed, inject } from 'vue';\nimport type { createI18n as _createI18n, I18n } from 'vue-i18n';\nimport { createIntlayerClient, installIntlayer, useLocale } from 'vue-intlayer';\nimport {\n type DateTimeFormatsConfig,\n formatDateValue,\n formatNumberValue,\n type NumberFormatsConfig,\n} from './formats';\nimport {\n parseTranslateArguments,\n resolveVueMessage,\n} from './resolveVueMessage';\nimport type { LooseComposer, TypedComposer } from './typedComposer';\n\nexport const VERSION = '9.13.1';\nexport const I18nInjectionKey: InjectionKey<I18n> = Symbol('global-i18n');\n\n/**\n * Dictionary key used for keys that carry no explicit namespace and are not\n * dot-namespaced (i18next-style flat keys, e.g. `t('greeting')`).\n */\nconst DEFAULT_NAMESPACE = 'translation';\n\n/**\n * Looks up a raw value for a vue-i18n key against intlayer dictionaries.\n *\n * Resolution order:\n * 1. `ns:key` prefix → dictionary `ns`\n * 2. The default namespace dictionary with the full dot-path\n * 3. The first key segment as the dictionary key (`'home.title'` →\n * dictionary `home`, path `title`)\n */\n/** Resolves a single dictionary by key and navigates to the given path. */\nconst lookupInDictionary = (\n locale: string,\n dictionaryKey: string,\n path: string\n): unknown => {\n try {\n const dictionary = getIntlayer(\n dictionaryKey as DictionaryKeys,\n locale as LocalesValues\n );\n const value = navigatePath(dictionary, path);\n if (value !== undefined && value !== null) return value;\n } catch {}\n return undefined;\n};\n\nconst lookupRaw = (\n locale: string,\n namespace: string | undefined,\n key: string\n): unknown => {\n let targetNamespace = namespace;\n let path = key;\n\n if (key.includes(':')) {\n const separatorIndex = key.indexOf(':');\n targetNamespace = key.slice(0, separatorIndex);\n path = key.slice(separatorIndex + 1);\n }\n\n // 1. Explicit namespace (from `useI18n({ namespace })` or a `ns:key` prefix)\n if (targetNamespace) {\n const value = lookupInDictionary(locale, targetNamespace, path);\n if (value !== undefined) return value;\n }\n\n // 2. First key segment as the dictionary key (`'home.title'` →\n // dictionary `home`, path `title`). This makes the global `t()` work\n // without a namespace, matching how intlayer splits dictionaries by key.\n if (path.includes('.')) {\n const separatorIndex = path.indexOf('.');\n const value = lookupInDictionary(\n locale,\n path.slice(0, separatorIndex),\n path.slice(separatorIndex + 1)\n );\n if (value !== undefined) return value;\n }\n\n // 3. Default `translation` bucket for flat, namespace-less keys.\n if (!targetNamespace) {\n const value = lookupInDictionary(locale, DEFAULT_NAMESPACE, path);\n if (value !== undefined) return value;\n }\n\n return undefined;\n};\n\n/** Translates a key with vue-i18n's polymorphic argument list. */\nconst translateKey = (\n locale: string,\n namespace: string | undefined,\n key: string,\n args: unknown[],\n fallbackMessages?: Record<string, unknown>\n): string => {\n const { values, count, defaultMessage } = parseTranslateArguments(args);\n\n const rawValue = lookupRaw(locale, namespace, key);\n\n if (rawValue === undefined) {\n if (fallbackMessages?.[locale]) {\n // Defer to the user's provided messages if not found in dictionaries\n const targetPath = namespace ? `${namespace}.${key}` : key;\n const fallbackValue = navigatePath(fallbackMessages[locale], targetPath);\n if (fallbackValue !== undefined) {\n return resolveVueMessage(\n fallbackValue,\n values,\n count,\n locale as LocalesValues\n );\n }\n }\n if (defaultMessage !== undefined) {\n return resolveVueMessage(\n defaultMessage,\n values,\n count,\n locale as LocalesValues\n );\n }\n return key;\n }\n\n return resolveVueMessage(rawValue, values, count, locale as LocalesValues);\n};\n\nconst getAvailableLocales = (): string[] =>\n internationalization?.locales?.map(String) ?? [];\n\nconst warnDeprecatedRuntimeMessages = (location: string) => {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize(location, ANSIColors.CYAN)} has no effect with ${colorize('@intlayer/vue-i18n', ANSIColors.MAGENTA)} — translations are managed by the compiled intlayer dictionaries.`\n );\n};\n\n/** Value accepted by the `v-t` directive. */\ntype TranslateDirectiveValue =\n | string\n | { path: string; args?: Record<string, unknown>; choice?: number };\n\nexport const createI18n: typeof _createI18n = ((\n options: Record<string, unknown> = {}\n) => {\n const fallbackMessages = options.messages as\n | Record<string, unknown>\n | undefined;\n\n if (\n options.messages !== undefined &&\n process.env.NODE_ENV === 'development'\n ) {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('createI18n', ANSIColors.CYAN)}: the ${colorize('`messages`', ANSIColors.CYAN)} option is used as a fallback. For optimal bundle size, remove the locale JSON imports and use ${colorize('useDictionary', ANSIColors.CYAN)} or compile your intlayer dictionaries instead:\\n ${colorize('Before:', ANSIColors.GREY)} createI18n({ messages: { en, fr, … } })\\n ${colorize('After: ', ANSIColors.GREY)} createI18n({})`\n );\n }\n\n const client = createIntlayerClient(options.locale as LocalesValues);\n\n const datetimeFormats = options.datetimeFormats as\n | DateTimeFormatsConfig\n | undefined;\n const numberFormats = options.numberFormats as\n | NumberFormatsConfig\n | undefined;\n\n const currentLocale = (): string => String(client.locale.value);\n\n /** Writable ref matching vue-i18n's composition-mode `global.locale`. */\n const localeRef: WritableComputedRef<string> = computed({\n get: () => currentLocale(),\n set: (newLocale: string) => {\n client.setLocale(newLocale as LocalesValues);\n },\n });\n\n const globalTranslate = (key: string, ...args: unknown[]): string =>\n translateKey(currentLocale(), undefined, key, args, fallbackMessages);\n\n const globalDate = (\n value: Date | number | string,\n formatOrOptions?: string | Intl.DateTimeFormatOptions\n ): string =>\n formatDateValue(value, formatOrOptions, currentLocale(), datetimeFormats);\n\n const globalNumber = (\n value: number,\n formatOrOptions?: string | Intl.NumberFormatOptions\n ): string =>\n formatNumberValue(value, formatOrOptions, currentLocale(), numberFormats);\n\n const global = {\n locale: localeRef,\n availableLocales: getAvailableLocales(),\n fallbackLocale: (options.fallbackLocale ??\n internationalization?.defaultLocale) as string,\n t: globalTranslate,\n tc: globalTranslate,\n te: (key: string): boolean =>\n lookupRaw(currentLocale(), undefined, key) !== undefined,\n tm: (key: string): unknown =>\n lookupRaw(currentLocale(), undefined, key) ?? {},\n rt: (message: unknown, ...args: unknown[]): string => {\n const { values, count } = parseTranslateArguments(args);\n return resolveVueMessage(\n message,\n values,\n count,\n currentLocale() as LocalesValues\n );\n },\n d: globalDate,\n n: globalNumber,\n setLocaleMessage: (_locale: string, _messages: unknown) => {\n warnDeprecatedRuntimeMessages('setLocaleMessage');\n },\n mergeLocaleMessage: (_locale: string, _messages: unknown) => {\n warnDeprecatedRuntimeMessages('mergeLocaleMessage');\n },\n getLocaleMessage: (_locale: string): Record<string, unknown> => {\n warnDeprecatedRuntimeMessages('getLocaleMessage');\n // We do not load global dictionaries anymore for bundle optimization.\n // The user should use useDictionary or rely on manually provided messages.\n return {};\n },\n };\n\n /** Legacy Options-API facade (`this.$i18n`) with a string `locale`. */\n const legacyI18n = {\n get locale(): string {\n return currentLocale();\n },\n set locale(newLocale: string) {\n client.setLocale(newLocale as LocalesValues);\n },\n get availableLocales(): string[] {\n return getAvailableLocales();\n },\n t: globalTranslate,\n tc: globalTranslate,\n te: global.te,\n tm: global.tm,\n rt: global.rt,\n d: globalDate,\n n: globalNumber,\n };\n\n const applyTranslateDirective = (\n element: HTMLElement,\n binding: DirectiveBinding<TranslateDirectiveValue>\n ) => {\n const bindingValue = binding.value;\n if (typeof bindingValue === 'string') {\n element.textContent = globalTranslate(bindingValue);\n } else if (bindingValue && typeof bindingValue === 'object') {\n const directiveArgs: unknown[] = [];\n if (bindingValue.args) directiveArgs.push(bindingValue.args);\n if (typeof bindingValue.choice === 'number')\n directiveArgs.push(bindingValue.choice);\n element.textContent = globalTranslate(\n bindingValue.path,\n ...directiveArgs\n );\n }\n };\n\n const i18nInstance = {\n global,\n mode: options.legacy === true ? 'legacy' : 'composition',\n __optionsMessages: fallbackMessages,\n install(app: App) {\n installIntlayer(app, {\n locale: options.locale as LocalesValues,\n });\n\n // Provide under I18nInjectionKey to satisfy inject(I18nInjectionKey) calls\n app.provide(I18nInjectionKey, i18nInstance as unknown as I18n);\n\n // Legacy API support ($t / $tc / $te / $tm / $rt / $d / $n / $i18n)\n app.config.globalProperties.$t = globalTranslate;\n (app.config.globalProperties as Record<string, unknown>).$tc =\n globalTranslate;\n (app.config.globalProperties as Record<string, unknown>).$te = global.te;\n (app.config.globalProperties as Record<string, unknown>).$tm = global.tm;\n (app.config.globalProperties as Record<string, unknown>).$rt = global.rt;\n (app.config.globalProperties as Record<string, unknown>).$d = globalDate;\n (app.config.globalProperties as Record<string, unknown>).$n =\n globalNumber;\n (app.config.globalProperties as Record<string, unknown>).$i18n =\n legacyI18n;\n\n // `v-t` directive support\n app.directive('t', {\n beforeMount: applyTranslateDirective,\n updated: applyTranslateDirective,\n });\n },\n };\n\n return i18nInstance as unknown as I18n;\n}) as typeof _createI18n;\n\n/**\n * Overload set for {@link useI18n}: with a `namespace` option the composer is\n * fully typed against that dictionary (keys and return values); without one\n * the root scope applies — the first segment of each key designates the\n * dictionary (`t('about.title')`).\n */\ntype UseI18n = {\n <N extends DictionaryKeys>(\n options: Record<string, unknown> & { namespace: N }\n ): TypedComposer<N>;\n (\n options?: Record<string, unknown> & { namespace?: undefined }\n ): LooseComposer;\n};\n\n/**\n * Composable providing a typed `t()` function scoped to a dictionary namespace.\n * Pass `{ namespace: 'myDict' }` to restrict keys to valid dot-notation paths\n * within that intlayer dictionary (autocompleted and validated at compile\n * time) and resolve return types from the content at each path.\n *\n * Supports vue-i18n's full message syntax: named (`{name}`) and list (`{0}`)\n * interpolation, pipe choice messages (`'car | cars'` with a count argument),\n * plus `te`/`tm`/`rt` and `Intl`-backed `d()`/`n()` formatters.\n *\n * @example\n * ```ts\n * const { t } = useI18n({ namespace: 'about' });\n * t('counter.label'); // ✓ typed key and return value\n * t('apples', 5); // pipe plural choice\n * ```\n */\nexport const useI18n = ((\n options?: Record<string, unknown> & { namespace?: string }\n) => {\n const { locale: currentLocale, setLocale, availableLocales } = useLocale();\n const instance = inject(I18nInjectionKey) as unknown as\n | Record<string, unknown>\n | undefined;\n const fallbackMessages = instance?.__optionsMessages as\n | Record<string, unknown>\n | undefined;\n\n const namespace = options?.namespace as string | undefined;\n\n const datetimeFormats = options?.datetimeFormats as\n | DateTimeFormatsConfig\n | undefined;\n const numberFormats = options?.numberFormats as\n | NumberFormatsConfig\n | undefined;\n\n const localeRef = computed({\n get: () => currentLocale.value as string,\n set: (newLocale: string) => {\n setLocale(newLocale as LocalesValues);\n },\n });\n\n const translate = (key: string, ...args: unknown[]): string =>\n translateKey(currentLocale.value, namespace, key, args, fallbackMessages);\n\n return {\n locale: localeRef,\n availableLocales: availableLocales as string[],\n t: translate,\n tc: translate,\n te: (key: string): boolean =>\n lookupRaw(currentLocale.value, namespace, key) !== undefined,\n tm: (key: string): unknown =>\n lookupRaw(currentLocale.value, namespace, key) ?? {},\n rt: (message: unknown, ...args: unknown[]): string => {\n const { values, count } = parseTranslateArguments(args);\n return resolveVueMessage(\n message,\n values,\n count,\n currentLocale.value as LocalesValues\n );\n },\n d: (\n value: Date | number | string,\n formatOrOptions?: string | Intl.DateTimeFormatOptions\n ): string =>\n formatDateValue(\n value,\n formatOrOptions,\n currentLocale.value,\n datetimeFormats\n ),\n n: (\n value: number,\n formatOrOptions?: string | Intl.NumberFormatOptions\n ): string =>\n formatNumberValue(\n value,\n formatOrOptions,\n currentLocale.value,\n numberFormats\n ),\n };\n}) as UseI18n;\n"],"mappings":";;;;;;;;;;;AA8BA,MAAa,UAAU;AACvB,MAAa,mBAAuC,OAAO,aAAa;;;;;AAMxE,MAAM,oBAAoB;;;;;;;;;;;AAY1B,MAAM,sBACJ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ACF"}
1
+ {"version":3,"file":"createI18n.mjs","names":[],"sources":["../../src/createI18n.ts"],"sourcesContent":["import { internationalization, log } from '@intlayer/config/built';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getIntlayer } from '@intlayer/core/interpreter';\nimport { navigatePath } from '@intlayer/core/messageFormat';\nimport type {\n DictionaryKeys,\n LocalesValues,\n} from '@intlayer/types/module_augmentation';\nimport type {\n App,\n DirectiveBinding,\n InjectionKey,\n WritableComputedRef,\n} from 'vue';\nimport { computed, inject } from 'vue';\nimport type { createI18n as _createI18n, I18n } from 'vue-i18n';\nimport { createIntlayerClient, installIntlayer, useLocale } from 'vue-intlayer';\nimport {\n type DateTimeFormatsConfig,\n formatDateValue,\n formatNumberValue,\n type NumberFormatsConfig,\n} from './formats';\nimport {\n parseTranslateArguments,\n resolveVueMessage,\n} from './resolveVueMessage';\nimport type { LooseComposer, TypedComposer } from './typedComposer';\n\nexport const VERSION = '9.13.1';\nexport const I18nInjectionKey: InjectionKey<I18n> = Symbol('global-i18n');\n\n/**\n * Dictionary key used for keys that carry no explicit namespace and are not\n * dot-namespaced (i18next-style flat keys, e.g. `t('greeting')`).\n */\nconst DEFAULT_NAMESPACE = 'translation';\n\n/**\n * Looks up a raw value for a vue-i18n key against intlayer dictionaries.\n *\n * Resolution order:\n * 1. `ns:key` prefix → dictionary `ns`\n * 2. The default namespace dictionary with the full dot-path\n * 3. The first key segment as the dictionary key (`'home.title'` →\n * dictionary `home`, path `title`)\n */\n/** Resolves a single dictionary by key and navigates to the given path. */\nconst lookupInDictionary = (\n locale: string,\n dictionaryKey: string,\n path: string\n): unknown => {\n try {\n const dictionary = getIntlayer(\n dictionaryKey as DictionaryKeys,\n locale as LocalesValues\n );\n const value = navigatePath(dictionary, path);\n if (value !== undefined && value !== null) return value;\n } catch {}\n return undefined;\n};\n\nconst lookupRaw = (\n locale: string,\n namespace: string | undefined,\n key: string\n): unknown => {\n let targetNamespace = namespace;\n let path = key;\n\n if (key.includes(':')) {\n const separatorIndex = key.indexOf(':');\n targetNamespace = key.slice(0, separatorIndex);\n path = key.slice(separatorIndex + 1);\n }\n\n // 1. Explicit namespace (from `useI18n({ namespace })` or a `ns:key` prefix)\n if (targetNamespace) {\n const value = lookupInDictionary(locale, targetNamespace, path);\n if (value !== undefined) return value;\n }\n\n // 2. First key segment as the dictionary key (`'home.title'` →\n // dictionary `home`, path `title`). This makes the global `t()` work\n // without a namespace, matching how intlayer splits dictionaries by key.\n if (path.includes('.')) {\n const separatorIndex = path.indexOf('.');\n const value = lookupInDictionary(\n locale,\n path.slice(0, separatorIndex),\n path.slice(separatorIndex + 1)\n );\n if (value !== undefined) return value;\n }\n\n // 3. Default `translation` bucket for flat, namespace-less keys.\n if (!targetNamespace) {\n const value = lookupInDictionary(locale, DEFAULT_NAMESPACE, path);\n if (value !== undefined) return value;\n }\n\n return undefined;\n};\n\n/** Translates a key with vue-i18n's polymorphic argument list. */\nconst translateKey = (\n locale: string,\n namespace: string | undefined,\n key: string,\n args: unknown[],\n fallbackMessages?: Record<string, unknown>\n): string => {\n const { values, count, defaultMessage } = parseTranslateArguments(args);\n\n const rawValue = lookupRaw(locale, namespace, key);\n\n if (rawValue === undefined) {\n if (fallbackMessages?.[locale]) {\n // Defer to the user's provided messages if not found in dictionaries\n const targetPath = namespace ? `${namespace}.${key}` : key;\n const fallbackValue = navigatePath(fallbackMessages[locale], targetPath);\n if (fallbackValue !== undefined) {\n return resolveVueMessage(\n fallbackValue,\n values,\n count,\n locale as LocalesValues\n );\n }\n }\n if (defaultMessage !== undefined) {\n return resolveVueMessage(\n defaultMessage,\n values,\n count,\n locale as LocalesValues\n );\n }\n return key;\n }\n\n return resolveVueMessage(rawValue, values, count, locale as LocalesValues);\n};\n\nconst getAvailableLocales = (): string[] =>\n internationalization?.locales?.map(String) ?? [];\n\nconst warnDeprecatedRuntimeMessages = (location: string) => {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize(location, ANSIColors.CYAN)} has no effect with ${colorize('@intlayer/vue-i18n', ANSIColors.MAGENTA)} — translations are managed by the compiled intlayer dictionaries.`\n );\n};\n\n/** Value accepted by the `v-t` directive. */\ntype TranslateDirectiveValue =\n | string\n | { path: string; args?: Record<string, unknown>; choice?: number };\n\nexport const createI18n: typeof _createI18n = ((\n options: Record<string, unknown> = {}\n) => {\n const fallbackMessages = options.messages as\n | Record<string, unknown>\n | undefined;\n\n if (\n options.messages !== undefined &&\n process.env.NODE_ENV === 'development'\n ) {\n const appLogger = getAppLogger({ log });\n appLogger(\n `${colorize('createI18n', ANSIColors.CYAN)}: the ${colorize('`messages`', ANSIColors.CYAN)} option is used as a fallback. For optimal bundle size, remove the locale JSON imports and use ${colorize('useDictionary', ANSIColors.CYAN)} or compile your intlayer dictionaries instead:\\n ${colorize('Before:', ANSIColors.GREY)} createI18n({ messages: { en, fr, … } })\\n ${colorize('After: ', ANSIColors.GREY)} createI18n({})`\n );\n }\n\n const client = createIntlayerClient(options.locale as LocalesValues);\n\n const datetimeFormats = options.datetimeFormats as\n | DateTimeFormatsConfig\n | undefined;\n const numberFormats = options.numberFormats as\n | NumberFormatsConfig\n | undefined;\n\n const currentLocale = (): string => String(client.locale.value);\n\n /** Writable ref matching vue-i18n's composition-mode `global.locale`. */\n const localeRef: WritableComputedRef<string> = computed({\n get: () => currentLocale(),\n set: (newLocale: string) => {\n client.setLocale(newLocale as LocalesValues);\n },\n });\n\n const globalTranslate = (key: string, ...args: unknown[]): string =>\n translateKey(currentLocale(), undefined, key, args, fallbackMessages);\n\n const globalDate = (\n value: Date | number | string,\n formatOrOptions?: string | Intl.DateTimeFormatOptions\n ): string =>\n formatDateValue(value, formatOrOptions, currentLocale(), datetimeFormats);\n\n const globalNumber = (\n value: number,\n formatOrOptions?: string | Intl.NumberFormatOptions\n ): string =>\n formatNumberValue(value, formatOrOptions, currentLocale(), numberFormats);\n\n const global = {\n locale: localeRef,\n availableLocales: getAvailableLocales(),\n fallbackLocale: (options.fallbackLocale ??\n internationalization?.defaultLocale) as string,\n t: globalTranslate,\n tc: globalTranslate,\n te: (key: string): boolean =>\n lookupRaw(currentLocale(), undefined, key) !== undefined,\n tm: (key: string): unknown =>\n lookupRaw(currentLocale(), undefined, key) ?? {},\n rt: (message: unknown, ...args: unknown[]): string => {\n const { values, count } = parseTranslateArguments(args);\n return resolveVueMessage(\n message,\n values,\n count,\n currentLocale() as LocalesValues\n );\n },\n d: globalDate,\n n: globalNumber,\n setLocaleMessage: (_locale: string, _messages: unknown) => {\n warnDeprecatedRuntimeMessages('setLocaleMessage');\n },\n mergeLocaleMessage: (_locale: string, _messages: unknown) => {\n warnDeprecatedRuntimeMessages('mergeLocaleMessage');\n },\n getLocaleMessage: (_locale: string): Record<string, unknown> => {\n warnDeprecatedRuntimeMessages('getLocaleMessage');\n // We do not load global dictionaries anymore for bundle optimization.\n // The user should use useDictionary or rely on manually provided messages.\n return {};\n },\n };\n\n /** Legacy Options-API facade (`this.$i18n`) with a string `locale`. */\n const legacyI18n = {\n get locale(): string {\n return currentLocale();\n },\n set locale(newLocale: string) {\n client.setLocale(newLocale as LocalesValues);\n },\n get availableLocales(): string[] {\n return getAvailableLocales();\n },\n t: globalTranslate,\n tc: globalTranslate,\n te: global.te,\n tm: global.tm,\n rt: global.rt,\n d: globalDate,\n n: globalNumber,\n };\n\n const applyTranslateDirective = (\n element: HTMLElement,\n binding: DirectiveBinding<TranslateDirectiveValue>\n ) => {\n const bindingValue = binding.value;\n if (typeof bindingValue === 'string') {\n element.textContent = globalTranslate(bindingValue);\n } else if (bindingValue && typeof bindingValue === 'object') {\n const directiveArgs: unknown[] = [];\n if (bindingValue.args) directiveArgs.push(bindingValue.args);\n if (typeof bindingValue.choice === 'number')\n directiveArgs.push(bindingValue.choice);\n element.textContent = globalTranslate(\n bindingValue.path,\n ...directiveArgs\n );\n }\n };\n\n const i18nInstance = {\n global,\n mode: options.legacy === true ? 'legacy' : 'composition',\n __optionsMessages: fallbackMessages,\n install(app: App) {\n installIntlayer(app, {\n locale: options.locale as LocalesValues,\n });\n\n // Provide under I18nInjectionKey to satisfy inject(I18nInjectionKey) calls\n app.provide(I18nInjectionKey, i18nInstance as unknown as I18n);\n\n // Legacy API support ($t / $tc / $te / $tm / $rt / $d / $n / $i18n)\n app.config.globalProperties.$t = globalTranslate;\n (app.config.globalProperties as Record<string, unknown>).$tc =\n globalTranslate;\n (app.config.globalProperties as Record<string, unknown>).$te = global.te;\n (app.config.globalProperties as Record<string, unknown>).$tm = global.tm;\n (app.config.globalProperties as Record<string, unknown>).$rt = global.rt;\n (app.config.globalProperties as Record<string, unknown>).$d = globalDate;\n (app.config.globalProperties as Record<string, unknown>).$n =\n globalNumber;\n (app.config.globalProperties as Record<string, unknown>).$i18n =\n legacyI18n;\n\n // `v-t` directive support\n app.directive('t', {\n beforeMount: applyTranslateDirective,\n updated: applyTranslateDirective,\n });\n },\n };\n\n return i18nInstance as unknown as I18n;\n}) as typeof _createI18n;\n\n/**\n * Overload set for {@link useI18n}: with a `namespace` option the composer is\n * fully typed against that dictionary (keys and return values); without one\n * the root scope applies — the first segment of each key designates the\n * dictionary (`t('about.title')`).\n */\ntype UseI18n = {\n <N extends DictionaryKeys>(\n options: Record<string, unknown> & { namespace: N }\n ): TypedComposer<N>;\n (\n options?: Record<string, unknown> & { namespace?: undefined }\n ): LooseComposer;\n};\n\n/**\n * Composable providing a typed `t()` function scoped to a dictionary namespace.\n * Pass `{ namespace: 'myDict' }` to restrict keys to valid dot-notation paths\n * within that intlayer dictionary (autocompleted and validated at compile\n * time) and resolve return types from the content at each path.\n *\n * Supports vue-i18n's full message syntax: named (`{name}`) and list (`{0}`)\n * interpolation, pipe choice messages (`'car | cars'` with a count argument),\n * plus `te`/`tm`/`rt` and `Intl`-backed `d()`/`n()` formatters.\n *\n * @example\n * ```ts\n * const { t } = useI18n({ namespace: 'about' });\n * t('counter.label'); // ✓ typed key and return value\n * t('apples', 5); // pipe plural choice\n * ```\n */\nexport const useI18n = ((\n options?: Record<string, unknown> & { namespace?: string }\n) => {\n const { locale: currentLocale, setLocale, availableLocales } = useLocale();\n const instance = inject(I18nInjectionKey) as unknown as\n | Record<string, unknown>\n | undefined;\n const fallbackMessages = instance?.__optionsMessages as\n | Record<string, unknown>\n | undefined;\n\n const namespace = options?.namespace as string | undefined;\n\n const datetimeFormats = options?.datetimeFormats as\n | DateTimeFormatsConfig\n | undefined;\n const numberFormats = options?.numberFormats as\n | NumberFormatsConfig\n | undefined;\n\n const localeRef = computed({\n get: () => currentLocale.value as string,\n set: (newLocale: string) => {\n setLocale(newLocale as LocalesValues);\n },\n });\n\n const translate = (key: string, ...args: unknown[]): string =>\n translateKey(currentLocale.value, namespace, key, args, fallbackMessages);\n\n return {\n locale: localeRef,\n availableLocales: availableLocales as string[],\n t: translate,\n tc: translate,\n te: (key: string): boolean =>\n lookupRaw(currentLocale.value, namespace, key) !== undefined,\n tm: (key: string): unknown =>\n lookupRaw(currentLocale.value, namespace, key) ?? {},\n rt: (message: unknown, ...args: unknown[]): string => {\n const { values, count } = parseTranslateArguments(args);\n return resolveVueMessage(\n message,\n values,\n count,\n currentLocale.value as LocalesValues\n );\n },\n d: (\n value: Date | number | string,\n formatOrOptions?: string | Intl.DateTimeFormatOptions\n ): string =>\n formatDateValue(\n value,\n formatOrOptions,\n currentLocale.value,\n datetimeFormats\n ),\n n: (\n value: number,\n formatOrOptions?: string | Intl.NumberFormatOptions\n ): string =>\n formatNumberValue(\n value,\n formatOrOptions,\n currentLocale.value,\n numberFormats\n ),\n };\n}) as UseI18n;\n"],"mappings":";;;;;;;;;;;AA8BA,MAAa,UAAU;AACvB,MAAa,mBAAuC,OAAO,aAAa;;;;;AAMxE,MAAM,oBAAoB;;;;;;;;;;;AAY1B,MAAM,sBACJ,QACA,eACA,SACY;CACZ,IAAI;EACF,MAAM,aAAa,YACjB,eACA,MACF;EACA,MAAM,QAAQ,aAAa,YAAY,IAAI;EAC3C,IAAI,UAAU,UAAa,UAAU,M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BAA6C,MAAM,OAAO;GACtE,AAAC,IAAI,OAAO,iBAA6C,MAAM,OAAO;GACtE,AAAC,IAAI,OAAO,iBAA6C,MAAM,OAAO;GACtE,AAAC,IAAI,OAAO,iBAA6C,KAAK;GAC9D,AAAC,IAAI,OAAO,iBAA6C,KACvD;GACF,AAAC,IAAI,OAAO,iBAA6C,QACvD;GAGF,IAAI,UAAU,KAAK;IACjB,aAAa;IACb,SAAS;GACX,CAAC;EACH;CACF;CAEA,OAAO;AACT;;;;;;;;;;;;;;;;;;AAkCA,MAAa,YACX,YACG;CACH,MAAM,EAAE,QAAQ,eAAe,WAAW,qBAAqB,UAAU;CAIzE,MAAM,mBAHW,OAAO,gBAGQ,CAAC,EAAE;CAInC,MAAM,YAAY,SAAS;CAE3B,MAAM,kBAAkB,SAAS;CAGjC,MAAM,gBAAgB,SAAS;CAI/B,MAAM,YAAY,SAAS;EACzB,WAAW,cAAc;EACzB,MAAM,cAAsB;GAC1B,UAAU,SAA0B;EACtC;CACF,CAAC;CAED,MAAM,aAAa,KAAa,GAAG,SACjC,aAAa,cAAc,OAAO,WAAW,KAAK,MAAM,gBAAgB;CAE1E,OAAO;EACL,QAAQ;EACU;EAClB,GAAG;EACH,IAAI;EACJ,KAAK,QACH,UAAU,cAAc,OAAO,WAAW,GAAG,MAAM;EACrD,KAAK,QACH,UAAU,cAAc,OAAO,WAAW,GAAG,KAAK,CAAC;EACrD,KAAK,SAAkB,GAAG,SAA4B;GACpD,MAAM,EAAE,QAAQ,UAAU,wBAAwB,IAAI;GACtD,OAAO,kBACL,SACA,QACA,OACA,cAAc,KAChB;EACF;EACA,IACE,OACA,oBAEA,gBACE,OACA,iBACA,cAAc,OACd,eACF;EACF,IACE,OACA,oBAEA,kBACE,OACA,iBACA,cAAc,OACd,aACF;CACJ;AACF"}
@@ -16,7 +16,7 @@ const vueI18nVitePlugin = (options) => {
16
16
  const appLogger = getAppLogger(intlayerConfig);
17
17
  runOnce(join(intlayerConfig.system.baseDir, ".intlayer", "cache", "intlayer-issues-invitation.lock"), () => {
18
18
  appLogger([colorize("Please report any issues you met on GitHub:", ANSIColors.GREY), colorize("https://github.com/aymericzip/intlayer/issues", ANSIColors.GREY_LIGHT)]);
19
- }, { cacheTimeoutMs: 1e3 * 60 * 60 });
19
+ }, { cacheTimeoutMs: 36e5 });
20
20
  const basePlugins = intlayer({
21
21
  ...options,
22
22
  compatCallers: [...options?.compatCallers ?? [], ...VUE_I18N_CALLERS]
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugin/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { VUE_I18N_CALLERS } from '@intlayer/config/callers';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { runOnce } from '@intlayer/engine/utils';\nimport type { PluginOption } from 'vite';\nimport { intlayer } from 'vite-intlayer';\n\n/**\n * A Vite plugin for vue-i18n compat that wraps vite-intlayer\n * and configures resolve aliases for vue-i18n.\n */\nexport const vueI18nVitePlugin = (\n options?: Parameters<typeof intlayer>[0]\n): PluginOption[] => {\n const intlayerConfig = getConfiguration();\n const appLogger = getAppLogger(intlayerConfig);\n\n runOnce(\n join(\n intlayerConfig.system.baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-issues-invitation.lock'\n ),\n () => {\n appLogger([\n colorize(\n 'Please report any issues you met on GitHub:',\n ANSIColors.GREY\n ),\n colorize(\n 'https://github.com/aymericzip/intlayer/issues',\n ANSIColors.GREY_LIGHT\n ),\n ]);\n },\n {\n cacheTimeoutMs: 1000 * 60 * 60, // 1 hour\n }\n );\n\n const basePlugins = intlayer({\n ...options,\n compatCallers: [...(options?.compatCallers ?? []), ...VUE_I18N_CALLERS],\n });\n\n const compatPlugin: PluginOption = {\n name: 'vite-vue-i18n-compat-plugin',\n config: () => {\n return {\n resolve: {\n alias: {\n 'vue-i18n': '@intlayer/vue-i18n',\n },\n },\n };\n },\n };\n\n return [\n ...(Array.isArray(basePlugins) ? basePlugins : [basePlugins]),\n compatPlugin,\n ];\n};\n\nexport default vueI18nVitePlugin;\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAa,qBACX,YACmB;CACnB,MAAM,iBAAiB,iBAAiB;CACxC,MAAM,YAAY,aAAa,cAAc;CAE7C,QACE,KACE,eAAe,OAAO,SACtB,aACA,SACA,iCACF,SACM;EACJ,UAAU,CACR,SACE,+CACA,WAAW,IACb,GACA,SACE,iDACA,WAAW,UACb,CACF,CAAC;CACH,GACA,EACE,gBAAgB,MAAO,KAAK,GAC9B,CACF;CAEA,MAAM,cAAc,SAAS;EAC3B,GAAG;EACH,eAAe,CAAC,GAAI,SAAS,iBAAiB,CAAC,GAAI,GAAG,gBAAgB;CACxE,CAAC;CAED,MAAM,eAA6B;EACjC,MAAM;EACN,cAAc;GACZ,OAAO,EACL,SAAS,EACP,OAAO,EACL,YAAY,qBACd,EACF,EACF;EACF;CACF;CAEA,OAAO,CACL,GAAI,MAAM,QAAQ,WAAW,IAAI,cAAc,CAAC,WAAW,GAC3D,YACF;AACF"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/plugin/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { VUE_I18N_CALLERS } from '@intlayer/config/callers';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { runOnce } from '@intlayer/engine/utils';\nimport type { PluginOption } from 'vite';\nimport { intlayer } from 'vite-intlayer';\n\n/**\n * A Vite plugin for vue-i18n compat that wraps vite-intlayer\n * and configures resolve aliases for vue-i18n.\n */\nexport const vueI18nVitePlugin = (\n options?: Parameters<typeof intlayer>[0]\n): PluginOption[] => {\n const intlayerConfig = getConfiguration();\n const appLogger = getAppLogger(intlayerConfig);\n\n runOnce(\n join(\n intlayerConfig.system.baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-issues-invitation.lock'\n ),\n () => {\n appLogger([\n colorize(\n 'Please report any issues you met on GitHub:',\n ANSIColors.GREY\n ),\n colorize(\n 'https://github.com/aymericzip/intlayer/issues',\n ANSIColors.GREY_LIGHT\n ),\n ]);\n },\n {\n cacheTimeoutMs: 1000 * 60 * 60, // 1 hour\n }\n );\n\n const basePlugins = intlayer({\n ...options,\n compatCallers: [...(options?.compatCallers ?? []), ...VUE_I18N_CALLERS],\n });\n\n const compatPlugin: PluginOption = {\n name: 'vite-vue-i18n-compat-plugin',\n config: () => {\n return {\n resolve: {\n alias: {\n 'vue-i18n': '@intlayer/vue-i18n',\n },\n },\n };\n },\n };\n\n return [\n ...(Array.isArray(basePlugins) ? basePlugins : [basePlugins]),\n compatPlugin,\n ];\n};\n\nexport default vueI18nVitePlugin;\n"],"mappings":";;;;;;;;;;;;;AAaA,MAAa,qBACX,YACmB;CACnB,MAAM,iBAAiB,iBAAiB;CACxC,MAAM,YAAY,aAAa,cAAc;CAE7C,QACE,KACE,eAAe,OAAO,SACtB,aACA,SACA,iCACF,SACM;EACJ,UAAU,CACR,SACE,+CACA,WAAW,IACb,GACA,SACE,iDACA,WAAW,UACb,CACF,CAAC;CACH,GACA,EACE,gBAAgB,KAClB,CACF;CAEA,MAAM,cAAc,SAAS;EAC3B,GAAG;EACH,eAAe,CAAC,GAAI,SAAS,iBAAiB,CAAC,GAAI,GAAG,gBAAgB;CACxE,CAAC;CAED,MAAM,eAA6B;EACjC,MAAM;EACN,cAAc;GACZ,OAAO,EACL,SAAS,EACP,OAAO,EACL,YAAY,qBACd,EACF,EACF;EACF;CACF;CAEA,OAAO,CACL,GAAI,MAAM,QAAQ,WAAW,IAAI,cAAc,CAAC,WAAW,GAC3D,YACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/vue-i18n",
3
- "version": "9.2.0",
3
+ "version": "9.3.1",
4
4
  "private": false,
5
5
  "description": "vue-i18n API adapter for intlayer — useI18n, createI18n, and installIntlayer backed by vue-intlayer",
6
6
  "keywords": [
@@ -75,16 +75,16 @@
75
75
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
76
76
  },
77
77
  "dependencies": {
78
- "@intlayer/config": "9.2.0",
79
- "@intlayer/core": "9.2.0",
80
- "@intlayer/dictionaries-entry": "9.2.0",
81
- "@intlayer/engine": "9.2.0",
82
- "@intlayer/types": "9.2.0",
83
- "vite-intlayer": "9.2.0",
84
- "vue-intlayer": "9.2.0"
78
+ "@intlayer/config": "9.3.1",
79
+ "@intlayer/core": "9.3.1",
80
+ "@intlayer/dictionaries-entry": "9.3.1",
81
+ "@intlayer/engine": "9.3.1",
82
+ "@intlayer/types": "9.3.1",
83
+ "vite-intlayer": "9.3.1",
84
+ "vue-intlayer": "9.3.1"
85
85
  },
86
86
  "devDependencies": {
87
- "@types/node": "26.1.2",
87
+ "@types/node": "26.2.0",
88
88
  "@utils/ts-config": "1.0.4",
89
89
  "@utils/ts-config-types": "1.0.4",
90
90
  "@utils/tsdown-config": "1.0.4",