@zachhandley/ez-i18n 0.3.4 → 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,70 +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
- /** Display names for each locale (in native language) */
16
- export const localeNames: Record<string, string>;
17
- /** BCP47 language tags for each locale */
18
- export const localeToBCP47: Record<string, string>;
19
- /** Text direction for each locale ('ltr' or 'rtl') */
20
- export const localeDirections: Record<string, 'ltr' | 'rtl'>;
21
- }
22
-
23
- declare module 'ez-i18n:runtime' {
24
- import type { ReadableAtom } from 'nanostores';
25
-
26
- /** Reactive store containing the current locale */
27
- export const locale: ReadableAtom<string>;
28
-
29
- /**
30
- * Translate a key to the current locale
31
- * @param key - Dot-notation key (e.g., 'common.welcome')
32
- * @param params - Optional interpolation params for {placeholder} syntax
33
- */
34
- export function t(key: string, params?: Record<string, string | number>): string;
35
-
36
- /**
37
- * Set the current locale and persist to cookie/localStorage
38
- * @param locale - Locale code to switch to
39
- * @param options - Cookie name string or options object
40
- */
41
- export function setLocale(
42
- locale: string,
43
- options?: string | {
44
- cookieName?: string;
45
- loadTranslations?: () => Promise<{ default?: Record<string, unknown> } | Record<string, unknown>>;
46
- }
47
- ): Promise<void>;
48
-
49
- /**
50
- * Initialize the locale store with translations
51
- * @param locale - Initial locale code
52
- * @param translations - Optional initial translations object
53
- */
54
- export function initLocale(locale: string, translations?: Record<string, unknown>): void;
55
- }
56
-
57
- declare module 'ez-i18n:translations' {
58
- /** Map of locale codes to their translation loaders */
59
- export const translationLoaders: Record<
60
- string,
61
- () => Promise<{ default?: Record<string, unknown> } | Record<string, unknown>>
62
- >;
63
-
64
- /**
65
- * Load translations for a specific locale
66
- * @param locale - Locale code to load translations for
67
- * @returns Translations object or empty object if not found
68
- */
69
- export function loadTranslations(locale: string): Promise<Record<string, unknown>>;
70
- }