@feugene/fint-i18n 0.2.0 → 0.2.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
@@ -25,6 +25,7 @@ You can find detailed information about the library in the relevant sections:
25
25
 
26
26
  - 📦 **[Installation and Getting Started](./docs/en/installation.md)**: How to install the package and configure it in a Vue application.
27
27
  - 📂 **[Defining Messages](./docs/en/defining-messages.md)**: JSON formats, loaders, and dynamic merging.
28
+ - 🌐 **[Authoring localization packages](./docs/en/authoring-localization-packages.md)**: Per-locale export contract for tree-shakable donor packages.
28
29
  - 🚀 **[Usage](./docs/en/usage.md)**: How to use `t()`, `$t`, and the `v-t` directive.
29
30
  - 📘 **[API Reference](./docs/en/api.md)**: Detailed description of all functions, methods, and composables.
30
31
  - 🔌 **[Plugins](./docs/en/plugins.md)**: Extending functionality via the hook system and built-in plugins.
@@ -41,13 +42,14 @@ You can find detailed information about the library in the relevant sections:
41
42
  import { createApp } from 'vue'
42
43
  import { createFintI18n } from '@feugene/fint-i18n/core'
43
44
  import { installI18n } from '@feugene/fint-i18n/vue'
44
- import { appLocaleLoaders } from './i18n/messages'
45
- import { fintDsLocaleLoaders } from '@feugene/fint-ds/i18n'
46
-
45
+ import { en as appEn, ru as appRu } from './i18n/messages'
46
+ import { en as granularityEn, ru as granularityRu } from '@feugene/granularity/i18n'
47
47
  const i18n = createFintI18n({
48
48
  locale: 'en',
49
49
  fallbackLocale: 'en',
50
- loaders: [appLocaleLoaders, fintDsLocaleLoaders],
50
+ // Import only the locales the application actually ships — bundlers will
51
+ // tree-shake the rest out of the final build.
52
+ loaders: [appEn, appRu, granularityEn, granularityRu],
51
53
  })
52
54
 
53
55
  const app = createApp(App)
package/README.ru.md CHANGED
@@ -20,6 +20,7 @@
20
20
 
21
21
  - 📦 **[Установка и начало работы](./docs/ru/installation.md)**: Как установить пакет и настроить его в приложении Vue.
22
22
  - 📂 **[Определение сообщений](./docs/ru/defining-messages.md)**: Форматы JSON, лоадеры и динамический мердж.
23
+ - 🌐 **[Гайд для авторов локализационных пакетов](./docs/ru/authoring-localization-packages.md)**: Контракт per-locale экспортов для tree-shakable пакетов-доноров.
23
24
  - 🚀 **[Использование](./docs/ru/usage.md)**: Как использовать `t()`, `$t` и директиву `v-t`.
24
25
  - 📘 **[Справочник API](./docs/ru/api.md)**: Подробное описание всех функций, методов и композаблов.
25
26
  - 🔌 **[Плагины](./docs/ru/plugins.md)**: Расширение функционала через систему хуков и встроенные плагины.
@@ -36,13 +37,14 @@
36
37
  import { createApp } from 'vue'
37
38
  import { createFintI18n } from '@feugene/fint-i18n/core'
38
39
  import { installI18n } from '@feugene/fint-i18n/vue'
39
- import { appLocaleLoaders } from './i18n/messages'
40
- import { fintDsLocaleLoaders } from '@feugene/fint-ds/i18n'
41
-
40
+ import { en as appEn, ru as appRu } from './i18n/messages'
41
+ import { en as granularityEn, ru as granularityRu } from '@feugene/granularity/i18n'
42
42
  const i18n = createFintI18n({
43
43
  locale: 'en',
44
44
  fallbackLocale: 'en',
45
- loaders: [appLocaleLoaders, fintDsLocaleLoaders],
45
+ // Импортируйте только те локали, которые реально нужны приложению —
46
+ // остальные сборщик удалит при tree-shaking.
47
+ loaders: [appEn, appRu, granularityEn, granularityRu],
46
48
  })
47
49
 
48
50
  const app = createApp(App)
@@ -1,5 +1,15 @@
1
1
  import type { App } from 'vue';
2
2
  import type { FintI18n } from '@/core';
3
- export declare function installI18n(app: App, i18n: FintI18n, options?: {
3
+ export type GlobalInstallFn = (app: App, i18n: FintI18n) => void;
4
+ export interface InstallI18nOptions {
4
5
  directive?: string | boolean;
5
- }): void;
6
+ /**
7
+ * Управляет регистрацией глобальных свойств ($t, $i18n).
8
+ * - функция: вызывается вместо стандартной регистрации;
9
+ * - `true`: выполняется стандартная регистрация (по умолчанию, если у инстанса `globalInstall === true`);
10
+ * - `false`: ничего не происходит.
11
+ * Если опция не передана — используется значение `i18n.globalInstall`.
12
+ */
13
+ globalInstall?: boolean | GlobalInstallFn;
14
+ }
15
+ export declare function installI18n(app: App, i18n: FintI18n, options?: InstallI18nOptions): void;
package/dist/vue.js CHANGED
@@ -42,10 +42,15 @@ function o(e, t, n) {
42
42
  }
43
43
  //#endregion
44
44
  //#region src/vue/plugin.ts
45
- function s(e, t, r = {}) {
46
- e.provide(n, t), t.globalInstall && (e.config.globalProperties.$t = t.t, e.config.globalProperties.$i18n = t);
47
- let i = r.directive === !1 ? null : typeof r.directive == "string" ? r.directive : "t";
48
- i && e.directive(i, a(t));
45
+ function s(e, t) {
46
+ e.config.globalProperties.$t = t.t, e.config.globalProperties.$i18n = t;
47
+ }
48
+ function c(e, t, r = {}) {
49
+ e.provide(n, t);
50
+ let i = r.globalInstall ?? t.globalInstall;
51
+ typeof i == "function" ? i(e, t) : i && s(e, t);
52
+ let o = r.directive === !1 ? null : typeof r.directive == "string" ? r.directive : "t";
53
+ o && e.directive(o, a(t));
49
54
  }
50
55
  //#endregion
51
- export { n as FINT_I18N_KEY, a as createVTDirective, s as installI18n, r as useFintI18n, i as useI18nScope };
56
+ export { n as FINT_I18N_KEY, a as createVTDirective, c as installI18n, r as useFintI18n, i as useI18nScope };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feugene/fint-i18n",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Lightweight Vue 3 i18n library with lazy-loading blocks and template caching",
5
5
  "author": "feugene <feugene@example.com>",
6
6
  "license": "MIT",