@fluenti/vue-i18n-compat 0.2.1 → 0.3.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
@@ -53,7 +53,7 @@ app.mount('#app')
53
53
  ```ts
54
54
  import { createApp } from 'vue'
55
55
  import { createI18n } from 'vue-i18n'
56
- import { createFluentVue } from '@fluenti/vue'
56
+ import { createFluenti } from '@fluenti/vue'
57
57
  import { createFluentBridge } from '@fluenti/vue-i18n-compat'
58
58
 
59
59
  // Your existing vue-i18n setup -- nothing changes here
@@ -67,7 +67,7 @@ const i18n = createI18n({
67
67
  })
68
68
 
69
69
  // Fluenti setup (empty for now -- you will add messages here over time)
70
- const fluenti = createFluentVue({
70
+ const fluenti = createFluenti({
71
71
  locale: 'en',
72
72
  fallbackLocale: 'en',
73
73
  messages: { en: {}, ja: {} },
@@ -115,7 +115,7 @@ Once a key is in Fluenti, delete it from the vue-i18n messages object. When ever
115
115
 
116
116
  ```diff
117
117
  - import { createFluentBridge } from '@fluenti/vue-i18n-compat'
118
- + import { createFluentVue } from '@fluenti/vue'
118
+ + import { createFluenti } from '@fluenti/vue'
119
119
 
120
120
  - app.use(bridge)
121
121
  + app.use(fluenti)
@@ -177,7 +177,7 @@ Creates the bridge plugin. Call `app.use(bridge)` instead of `app.use(i18n)`.
177
177
  | Option | Type | Default | Description |
178
178
  |--------|------|---------|-------------|
179
179
  | `vueI18n` | `VueI18nInstance` | **required** | vue-i18n instance from `createI18n()` |
180
- | `fluenti` | `FluentVuePlugin` | **required** | Fluenti plugin from `createFluentVue()` |
180
+ | `fluenti` | `FluentiPlugin` | **required** | Fluenti plugin from `createFluenti()` |
181
181
  | `priority` | `'fluenti-first' \| 'vue-i18n-first'` | `'fluenti-first'` | Which library to check first for translations |
182
182
 
183
183
  ### `useI18n()`
@@ -199,7 +199,7 @@ Returns the `BridgeContext`. Must be called inside a component where the bridge
199
199
  | `setLocale(locale)` | `Promise<void>` | Change locale (syncs to both libraries) |
200
200
  | `availableLocales` | `ComputedRef<string[]>` | Merged locales from both libraries |
201
201
  | `isLoading` | `Ref<boolean>` | Whether Fluenti is loading a locale chunk |
202
- | `fluenti` | `FluentVueContext` | Access the underlying Fluenti context |
202
+ | `fluenti` | `FluentiContext` | Access the underlying Fluenti context |
203
203
  | `vueI18n` | `VueI18nGlobal` | Access the underlying vue-i18n global composer |
204
204
 
205
205
  ## Compatibility Matrix
package/dist/types.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { ComputedRef, Ref } from 'vue';
2
- import { FluentVuePlugin, FluentVueContext } from '@fluenti/vue';
2
+ import { FluentiPlugin, FluentiContext } from '@fluenti/vue';
3
3
  /** Lookup priority when resolving translations across both libraries */
4
4
  export type BridgePriority = 'fluenti-first' | 'vue-i18n-first';
5
5
  /** Options for creating the bridge plugin */
6
6
  export interface BridgeOptions {
7
7
  /** The vue-i18n instance (from createI18n()) */
8
8
  vueI18n: VueI18nInstance;
9
- /** The fluenti Vue plugin (from createFluentVue()) */
10
- fluenti: FluentVuePlugin;
9
+ /** The fluenti Vue plugin (from createFluenti()) */
10
+ fluenti: FluentiPlugin;
11
11
  /** Which library to check first when resolving translations (default: 'fluenti-first') */
12
12
  priority?: BridgePriority;
13
13
  }
@@ -58,7 +58,7 @@ export interface BridgeContext {
58
58
  /** Whether fluenti is loading a locale chunk */
59
59
  isLoading: Readonly<Ref<boolean>>;
60
60
  /** Access the underlying fluenti context */
61
- fluenti: FluentVueContext;
61
+ fluenti: FluentiContext;
62
62
  /** Access the underlying vue-i18n global composer */
63
63
  vueI18n: VueI18nGlobal;
64
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAErE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SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACxC,gDAAgD;IAChD,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAA;IACvC,gDAAgD;IAChD,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IACjC,4CAA4C;IAC5C,OAAO,EAAE,cAAc,CAAA;IACvB,qDAAqD;IACrD,OAAO,EAAE,aAAa,CAAA;CACvB;AAED,0CAA0C;AAC1C,MAAM,WAAW,YAAY;IAC3B,gCAAgC;IAChC,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAAA;IACvB,gCAAgC;IAChC,MAAM,EAAE,aAAa,CAAA;CACtB"}
package/llms-full.txt ADDED
@@ -0,0 +1,204 @@
1
+ # @fluenti/vue-i18n-compat — Full API Reference
2
+
3
+ > Progressive migration bridge between vue-i18n and Fluenti. Allows both libraries to coexist in the same Vue 3 app with shared locale state, unified translation lookups, and configurable priority. Migrate file-by-file from vue-i18n to Fluenti without breaking existing code.
4
+
5
+ - Package: `@fluenti/vue-i18n-compat`
6
+ - Peer dependencies: `vue ^3.5`, `vue-i18n ^9 || ^10`
7
+ - Dependencies: `@fluenti/core`, `@fluenti/vue`
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pnpm add @fluenti/vue-i18n-compat @fluenti/core @fluenti/vue
13
+ ```
14
+
15
+ ## Setup
16
+
17
+ ```ts
18
+ import { createI18n } from 'vue-i18n'
19
+ import { createFluenti } from '@fluenti/vue'
20
+ import { createFluentBridge } from '@fluenti/vue-i18n-compat'
21
+
22
+ // Existing vue-i18n setup
23
+ const i18n = createI18n({
24
+ legacy: false,
25
+ locale: 'en',
26
+ messages: { en: { greeting: 'Hello' } },
27
+ })
28
+
29
+ // New Fluenti setup
30
+ const fluent = createFluenti({
31
+ locale: 'en',
32
+ messages: { en: compiledMessages },
33
+ })
34
+
35
+ // Bridge them together
36
+ const bridge = createFluentBridge({
37
+ vueI18n: i18n,
38
+ fluenti: fluent,
39
+ priority: 'fluenti-first', // check Fluenti catalogs first
40
+ })
41
+
42
+ // Install the bridge (installs both libraries automatically)
43
+ app.use(bridge)
44
+ ```
45
+
46
+ ## createFluentBridge(options)
47
+
48
+ Factory function that creates a Vue plugin connecting vue-i18n and Fluenti.
49
+
50
+ **Parameters:**
51
+
52
+ | Option | Type | Default | Description |
53
+ |--------|------|---------|-------------|
54
+ | `vueI18n` | `VueI18nInstance` | — | The vue-i18n instance from `createI18n()` (required) |
55
+ | `fluenti` | `FluentiPlugin` | — | The Fluenti plugin from `createFluenti()` (required) |
56
+ | `priority` | `BridgePriority` | `'fluenti-first'` | Which library to check first for translations |
57
+
58
+ **Returns:** `BridgePlugin` — object with `install(app)` method and `global` context.
59
+
60
+ **Behavior:**
61
+ - Calls `app.use(vueI18n)` and `app.use(fluenti)` during install
62
+ - Sets up bidirectional locale watchers with loop guard
63
+ - Overrides `$t`, `$te`, `$tc` global properties with bridged versions
64
+ - Provides `BridgeContext` via Vue's `provide`/`inject`
65
+
66
+ ## useI18n()
67
+
68
+ Composable that injects the bridge context. Must be called inside a component where the bridge plugin is installed.
69
+
70
+ ```ts
71
+ import { useI18n } from '@fluenti/vue-i18n-compat'
72
+
73
+ const { t, tc, te, locale, setLocale, fluenti, vueI18n } = useI18n()
74
+ ```
75
+
76
+ **Throws:** Error if the bridge plugin is not installed.
77
+
78
+ ## BridgeContext
79
+
80
+ The context object returned by `useI18n()` and available on `bridge.global`.
81
+
82
+ ### Translation Methods
83
+
84
+ #### `t(key, values?)`
85
+
86
+ Translate a message key. Checks both libraries according to the `priority` setting.
87
+
88
+ ```ts
89
+ // String key
90
+ t('greeting')
91
+
92
+ // MessageDescriptor (from Fluenti's msg/t)
93
+ t({ id: 'abc123', message: 'Hello {name}' }, { name: 'World' })
94
+ ```
95
+
96
+ - `priority: 'fluenti-first'` — checks Fluenti with `te()`, falls back to vue-i18n
97
+ - `priority: 'vue-i18n-first'` — checks vue-i18n with `te()`, falls back to Fluenti
98
+
99
+ #### `tc(key, count, values?)`
100
+
101
+ Pluralized translation. Delegates to Fluenti ICU plurals or vue-i18n pipe-separated plurals depending on priority and key availability.
102
+
103
+ ```ts
104
+ tc('items', 3) // "3 items"
105
+ tc('items', 3, { category: 'books' })
106
+ ```
107
+
108
+ - If Fluenti has the key (fluenti-first): uses ICU `{count, plural, ...}` via `t(key, { count })`
109
+ - Otherwise: delegates to vue-i18n's `tc()` (v9) or `t()` with count (v10+)
110
+
111
+ #### `te(key, locale?)`
112
+
113
+ Check if a translation exists in either library. Returns `true` if found in either.
114
+
115
+ #### `tm(key)`
116
+
117
+ Get raw message object. Prefers Fluenti when `priority: 'fluenti-first'`, falls back to vue-i18n.
118
+
119
+ #### `d(value, style?)`
120
+
121
+ Format a date. Delegates to Fluenti's date formatter.
122
+
123
+ ```ts
124
+ d(new Date(), 'short') // "3/20/26"
125
+ ```
126
+
127
+ #### `n(value, style?)`
128
+
129
+ Format a number. Delegates to Fluenti's number formatter.
130
+
131
+ ```ts
132
+ n(1234.5, 'currency') // "$1,234.50"
133
+ ```
134
+
135
+ #### `format(message, values?)`
136
+
137
+ Format an ICU message string directly (Fluenti only).
138
+
139
+ ```ts
140
+ format('{count, plural, one {# item} other {# items}}', { count: 5 })
141
+ ```
142
+
143
+ ### Locale Management
144
+
145
+ #### `locale`
146
+
147
+ `Readonly<Ref<string>>` — Reactive locale, synced across both libraries.
148
+
149
+ #### `setLocale(locale)`
150
+
151
+ `(locale: string) => Promise<void>` — Change locale. Updates Fluenti first (which may trigger async chunk loading), then syncs to vue-i18n.
152
+
153
+ #### `availableLocales`
154
+
155
+ `ComputedRef<string[]>` — Sorted union of locales from both libraries.
156
+
157
+ #### `isLoading`
158
+
159
+ `Readonly<Ref<boolean>>` — Whether Fluenti is loading a locale chunk.
160
+
161
+ ### Underlying Instances
162
+
163
+ #### `fluenti`
164
+
165
+ Direct access to the Fluenti context (`FluentiContext`).
166
+
167
+ #### `vueI18n`
168
+
169
+ Direct access to the vue-i18n global composer (`VueI18nGlobal`).
170
+
171
+ ## BRIDGE_KEY
172
+
173
+ ```ts
174
+ import { BRIDGE_KEY } from '@fluenti/vue-i18n-compat'
175
+ ```
176
+
177
+ Vue injection key (`InjectionKey<BridgeContext>`) for manual `inject()` usage.
178
+
179
+ ## Global Property Overrides
180
+
181
+ When the bridge is installed, it overrides these Vue global properties:
182
+
183
+ - `$t` → `bridgedT` (checks both libraries)
184
+ - `$te` → `bridgedTe` (checks both libraries)
185
+ - `$tc` → `bridgedTc` (checks both libraries)
186
+
187
+ This means existing `{{ $t('key') }}` in templates will automatically use the bridged lookup.
188
+
189
+ ## Bidirectional Locale Sync
190
+
191
+ The bridge watches both `fluenti.locale` and `vueI18n.global.locale`. When either changes, the other is updated. A guard variable prevents infinite watch loops.
192
+
193
+ ## Migration Strategy
194
+
195
+ 1. Install the bridge alongside existing vue-i18n
196
+ 2. Set `priority: 'fluenti-first'` to prefer new Fluenti translations
197
+ 3. Migrate messages file-by-file to Fluenti's ICU format
198
+ 4. As each file is migrated, Fluenti handles its lookups while vue-i18n handles the rest
199
+ 5. When all messages are migrated, remove vue-i18n and the bridge
200
+
201
+ ## Documentation
202
+
203
+ - Full docs: https://fluenti.dev
204
+ - Source: https://github.com/usefluenti/fluenti
package/llms.txt ADDED
@@ -0,0 +1,59 @@
1
+ # @fluenti/vue-i18n-compat
2
+
3
+ > Progressive migration bridge between vue-i18n and Fluenti — share locale state, translate across both libraries with configurable lookup priority.
4
+
5
+ - Package: `@fluenti/vue-i18n-compat`
6
+ - Peer dependencies: `vue ^3.5`, `vue-i18n ^9 || ^10`
7
+ - Dependencies: `@fluenti/core`, `@fluenti/vue`
8
+ - Docs: https://fluenti.dev
9
+ - Source: https://github.com/usefluenti/fluenti/tree/main/packages/vue-i18n-compat
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ pnpm add @fluenti/vue-i18n-compat @fluenti/core @fluenti/vue
15
+ ```
16
+
17
+ ## Key Exports
18
+
19
+ - `createFluentBridge(options)` — Factory that creates a Vue plugin connecting vue-i18n and Fluenti. Installs both libraries, syncs locale bidirectionally, and overrides `$t`/`$te`/`$tc` global properties with bridged versions.
20
+ - `useI18n()` — Composable returning the `BridgeContext` with unified translation methods. Throws if the bridge plugin is not installed.
21
+ - `BRIDGE_KEY` — Vue injection key (`InjectionKey<BridgeContext>`) for the bridge context.
22
+
23
+ ## BridgeOptions
24
+
25
+ | Option | Type | Default | Description |
26
+ |--------|------|---------|-------------|
27
+ | `vueI18n` | `VueI18nInstance` | — | The vue-i18n instance from `createI18n()` |
28
+ | `fluenti` | `FluentiPlugin` | — | The Fluenti plugin from `createFluenti()` |
29
+ | `priority` | `'fluenti-first' \| 'vue-i18n-first'` | `'fluenti-first'` | Which library to check first for translations |
30
+
31
+ ## BridgeContext (returned by useI18n())
32
+
33
+ - `t(key, values?)` — Translate a message, checking both libraries per priority
34
+ - `tc(key, count, values?)` — Pluralized translation (ICU via Fluenti, pipe-separated via vue-i18n)
35
+ - `te(key, locale?)` — Check if a key exists in either library
36
+ - `tm(key)` — Get raw message (from vue-i18n)
37
+ - `d(value, style?)` — Format a date
38
+ - `n(value, style?)` — Format a number
39
+ - `format(message, values?)` — Format an ICU message string directly
40
+ - `locale` — Reactive locale ref (synced across both libraries)
41
+ - `setLocale(locale)` — Change locale (syncs to both libraries)
42
+ - `availableLocales` — Computed union of locales from both libraries
43
+ - `isLoading` — Whether Fluenti is loading a locale chunk
44
+ - `fluenti` — Access the underlying Fluenti context
45
+ - `vueI18n` — Access the underlying vue-i18n global composer
46
+
47
+ ## Key Types
48
+
49
+ - `BridgeOptions` — Options for `createFluentBridge()`
50
+ - `BridgeContext` — Context returned by `useI18n()`
51
+ - `BridgePlugin` — Return type of `createFluentBridge()` (has `install()` and `global`)
52
+ - `BridgePriority` — `'fluenti-first' | 'vue-i18n-first'`
53
+ - `VueI18nInstance` — Minimal vue-i18n instance interface
54
+ - `VueI18nGlobal` — Minimal vue-i18n global composer interface
55
+
56
+ ## Documentation
57
+
58
+ - Full docs: https://fluenti.dev
59
+ - llms-full.txt: Detailed reference with code examples
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluenti/vue-i18n-compat",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Progressive migration bridge between vue-i18n and Fluenti — share locale, translate across both libraries",
6
6
  "homepage": "https://fluenti.dev",
@@ -41,15 +41,16 @@
41
41
  }
42
42
  },
43
43
  "files": [
44
- "dist"
44
+ "dist",
45
+ "llms*.txt"
45
46
  ],
46
47
  "peerDependencies": {
47
48
  "vue": "^3.5",
48
49
  "vue-i18n": "^9 || ^10"
49
50
  },
50
51
  "dependencies": {
51
- "@fluenti/core": "0.2.1",
52
- "@fluenti/vue": "0.2.1"
52
+ "@fluenti/core": "0.3.0",
53
+ "@fluenti/vue": "0.3.0"
53
54
  },
54
55
  "devDependencies": {
55
56
  "@vitest/coverage-v8": "^4",