@zachhandley/ez-i18n 0.3.3 → 0.3.5

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/src/virtual.d.ts DELETED
@@ -1,64 +0,0 @@
1
- /**
2
- * Type declarations for ez-i18n virtual modules
3
- *
4
- * Note: These are also injected via injectTypes() for consumer projects.
5
- * This file provides types during package development.
6
- */
7
-
8
- declare module 'ez-i18n:config' {
9
- /** List of all supported locale codes */
10
- export const locales: readonly string[];
11
- /** Default locale when no preference is detected */
12
- export const defaultLocale: string;
13
- /** Cookie name used to store locale preference */
14
- export const cookieName: string;
15
- }
16
-
17
- declare module 'ez-i18n:runtime' {
18
- import type { ReadableAtom } from 'nanostores';
19
-
20
- /** Reactive store containing the current locale */
21
- export const locale: ReadableAtom<string>;
22
-
23
- /**
24
- * Translate a key to the current locale
25
- * @param key - Dot-notation key (e.g., 'common.welcome')
26
- * @param params - Optional interpolation params for {placeholder} syntax
27
- */
28
- export function t(key: string, params?: Record<string, string | number>): string;
29
-
30
- /**
31
- * Set the current locale and persist to cookie/localStorage
32
- * @param locale - Locale code to switch to
33
- * @param options - Cookie name string or options object
34
- */
35
- export function setLocale(
36
- locale: string,
37
- options?: string | {
38
- cookieName?: string;
39
- loadTranslations?: () => Promise<{ default?: Record<string, unknown> } | Record<string, unknown>>;
40
- }
41
- ): Promise<void>;
42
-
43
- /**
44
- * Initialize the locale store with translations
45
- * @param locale - Initial locale code
46
- * @param translations - Optional initial translations object
47
- */
48
- export function initLocale(locale: string, translations?: Record<string, unknown>): void;
49
- }
50
-
51
- declare module 'ez-i18n:translations' {
52
- /** Map of locale codes to their translation loaders */
53
- export const translationLoaders: Record<
54
- string,
55
- () => Promise<{ default?: Record<string, unknown> } | Record<string, unknown>>
56
- >;
57
-
58
- /**
59
- * Load translations for a specific locale
60
- * @param locale - Locale code to load translations for
61
- * @returns Translations object or empty object if not found
62
- */
63
- export function loadTranslations(locale: string): Promise<Record<string, unknown>>;
64
- }