@i18n-micro/vue 1.3.2 → 1.3.4

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.
@@ -1,38 +0,0 @@
1
- import { BaseI18n, TranslationStorage } from '@i18n-micro/core';
2
- import { PluralFunc, Translations } from '@i18n-micro/types';
3
- import { Ref } from 'vue';
4
- export interface VueI18nOptions {
5
- locale: string;
6
- fallbackLocale?: string;
7
- messages?: Record<string, Translations>;
8
- plural?: PluralFunc;
9
- missingWarn?: boolean;
10
- missingHandler?: (locale: string, key: string, routeName: string) => void;
11
- }
12
- export declare class VueI18n extends BaseI18n {
13
- private _locale;
14
- private _fallbackLocale;
15
- private _currentRoute;
16
- private _revision;
17
- readonly storage: TranslationStorage;
18
- private listeners;
19
- constructor(options: VueI18nOptions);
20
- get locale(): Ref<string>;
21
- set locale(val: Ref<string> | string);
22
- get fallbackLocale(): Ref<string>;
23
- set fallbackLocale(val: Ref<string> | string);
24
- get currentRoute(): Ref<string>;
25
- setRoute(routeName: string): void;
26
- getLocale(): string;
27
- getFallbackLocale(): string;
28
- getRoute(): string;
29
- addTranslations(locale: string, translations: Translations, merge?: boolean): void;
30
- addRouteTranslations(locale: string, routeName: string, translations: Translations, merge?: boolean): void;
31
- mergeTranslations(locale: string, routeName: string, translations: Translations): void;
32
- clearCache(): void;
33
- subscribeToChanges(cb: () => void): () => void;
34
- private notifyListeners;
35
- getAllTranslations(): Record<string, Translations>;
36
- getStorage(): TranslationStorage;
37
- getRouteCache(): Record<string, Translations>;
38
- }
@@ -1,8 +0,0 @@
1
- import { Locale } from '@i18n-micro/types';
2
- import { InjectionKey } from 'vue';
3
- import { VueI18n } from './composer';
4
- import { I18nRoutingStrategy } from './router/types';
5
- export declare const I18nInjectionKey: InjectionKey<VueI18n>;
6
- export declare const I18nLocalesKey: InjectionKey<Locale[]>;
7
- export declare const I18nDefaultLocaleKey: InjectionKey<string>;
8
- export declare const I18nRouterKey: InjectionKey<I18nRoutingStrategy>;
package/dist/plugin.d.ts DELETED
@@ -1,22 +0,0 @@
1
- import { Locale } from '@i18n-micro/types';
2
- import { Plugin } from 'vue';
3
- import { VueI18n, VueI18nOptions } from './composer';
4
- import { I18nRoutingStrategy } from './router/types';
5
- export interface CreateI18nOptions extends VueI18nOptions {
6
- routingStrategy?: I18nRoutingStrategy;
7
- /**
8
- * Array of locale configurations
9
- * If provided, will be automatically provided to the app via I18nLocalesKey
10
- */
11
- locales?: Locale[];
12
- /**
13
- * Default locale code
14
- * If provided, will be automatically provided to the app via I18nDefaultLocaleKey
15
- */
16
- defaultLocale?: string;
17
- }
18
- export type I18nPlugin = Plugin & {
19
- global: VueI18n;
20
- setRoutingStrategy: (strategy: I18nRoutingStrategy) => void;
21
- };
22
- export declare function createI18n(options: CreateI18nOptions): I18nPlugin;
@@ -1,9 +0,0 @@
1
- import { Locale } from '@i18n-micro/types';
2
- import { Router } from 'vue-router';
3
- import { I18nRoutingStrategy } from './types';
4
- /**
5
- * Factory for Vue Router adapter
6
- * Implements routing utilities for Vue Router
7
- * Uses vue-router APIs for navigation and path resolution
8
- */
9
- export declare function createVueRouterAdapter(router: Router, locales: Locale[], defaultLocale: string): I18nRoutingStrategy;
@@ -1,43 +0,0 @@
1
- import { Component } from 'vue';
2
- /**
3
- * Routing strategy interface for i18n
4
- * Implement this interface to integrate with any router library
5
- */
6
- export interface I18nRoutingStrategy {
7
- /**
8
- * Returns current path (without locale prefix if needed, or full path)
9
- * Used for determining active classes in links
10
- */
11
- getCurrentPath: () => string;
12
- /**
13
- * Component to use for rendering links (e.g., RouterLink)
14
- */
15
- linkComponent?: string | Component;
16
- /**
17
- * Function to navigate to another route/locale
18
- */
19
- push: (target: {
20
- path: string;
21
- }) => void;
22
- /**
23
- * Function to replace current route
24
- */
25
- replace: (target: {
26
- path: string;
27
- }) => void;
28
- /**
29
- * Generate path for specific locale
30
- */
31
- resolvePath?: (to: string | {
32
- path?: string;
33
- }, locale: string) => string | {
34
- path?: string;
35
- };
36
- /**
37
- * (Optional) Get current route object for SEO/Meta tags
38
- */
39
- getRoute?: () => {
40
- fullPath: string;
41
- query: Record<string, unknown>;
42
- };
43
- }
@@ -1,40 +0,0 @@
1
- import { Locale } from '@i18n-micro/types';
2
- import { VueI18n } from './composer';
3
- export interface UseI18nOptions {
4
- locales?: Locale[];
5
- defaultLocale?: string;
6
- }
7
- /**
8
- * Get the i18n instance from the Vue app context
9
- * Returns the same instance that was created with createI18n()
10
- */
11
- export declare function useI18n(options?: UseI18nOptions): {
12
- instance: VueI18n;
13
- locale: import('vue').WritableComputedRef<string, string>;
14
- getLocales: () => Locale[];
15
- defaultLocale: () => string;
16
- getLocaleName: () => string | null;
17
- localeRoute: (to: string | {
18
- path?: string;
19
- }, localeCode?: string) => string | {
20
- path?: string;
21
- };
22
- localePath: (to: string | {
23
- path?: string;
24
- }, locale?: string) => string;
25
- switchLocale: (newLocale: string) => void;
26
- t: (key: import('@i18n-micro/types').TranslationKey, params?: import('@i18n-micro/types').Params, defaultValue?: string | null, routeName?: string) => import('@i18n-micro/types').CleanTranslation;
27
- ts: (key: import('@i18n-micro/types').TranslationKey, params?: import('@i18n-micro/types').Params, defaultValue?: string, routeName?: string) => string;
28
- tc: (key: import('@i18n-micro/types').TranslationKey, count: number | import('@i18n-micro/types').Params, defaultValue?: string) => string;
29
- tn: (value: number, options?: Intl.NumberFormatOptions) => string;
30
- td: (value: Date | number | string, options?: Intl.DateTimeFormatOptions) => string;
31
- tdr: (value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string;
32
- has: (key: import('@i18n-micro/types').TranslationKey, routeName?: string) => boolean;
33
- setRoute: (routeName: string) => void;
34
- getRoute: () => string;
35
- getLocale: () => string;
36
- addTranslations: (locale: string, translations: import('@i18n-micro/types').Translations, merge?: boolean) => void;
37
- addRouteTranslations: (locale: string, routeName: string, translations: import('@i18n-micro/types').Translations, merge?: boolean) => void;
38
- mergeTranslations: (locale: string, routeName: string, translations: import('@i18n-micro/types').Translations) => void;
39
- clearCache: () => void;
40
- };
@@ -1,14 +0,0 @@
1
- import { Params, CleanTranslation, TranslationKey } from '@i18n-micro/types';
2
- // Extend '@vue/runtime-core' module so types work correctly in all environments
3
- declare module '@vue/runtime-core' {
4
- interface ComponentCustomProperties {
5
- $t: (key: TranslationKey, params?: Params, defaultValue?: string | null, routeName?: string) => CleanTranslation
6
- $ts: (key: TranslationKey, params?: Params, defaultValue?: string, routeName?: string) => string
7
- $tc: (key: TranslationKey, count: number | Params, defaultValue?: string) => string
8
- $tn: (value: number, options?: Intl.NumberFormatOptions) => string
9
- $td: (value: Date | number | string, options?: Intl.DateTimeFormatOptions) => string
10
- $tdr: (value: Date | number | string, options?: Intl.RelativeTimeFormatOptions) => string
11
- $has: (key: TranslationKey, routeName?: string) => boolean
12
- $i18n: any
13
- }
14
- }