imba-localization 0.4.9 โ 0.4.10
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 +2 -1
- package/index.d.ts +33 -0
- package/package.json +17 -3
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ A lightweight Imba module for loading and handling JSON-based localization files
|
|
|
10
10
|
- ๐ **Smart fallback system** - Falls back to a default language when needed
|
|
11
11
|
- ๐ง **Intuitive access** - Proxy-based access to translation strings
|
|
12
12
|
- ๐ก **Event handling** - Support for `onready`, `onchange`, and `onerror` events
|
|
13
|
+
- ๐งพ **Type declarations** - Includes package-level TypeScript declarations for editor and language-server imports
|
|
13
14
|
- ๐ **Simple integration** - Easy to use in any Imba-based web application
|
|
14
15
|
- ๐งฉ **`<language-selector>`** - Plug and play tag component for switching languages
|
|
15
16
|
|
|
@@ -310,4 +311,4 @@ tag App
|
|
|
310
311
|
css w:20px h:20px stroke:red
|
|
311
312
|
<{svg-arrow-down}>
|
|
312
313
|
|
|
313
|
-
```
|
|
314
|
+
```
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type LocalizationLanguage = Record<string, any>;
|
|
2
|
+
export type LocalizationLanguages = Record<string, LocalizationLanguage>;
|
|
3
|
+
|
|
4
|
+
export interface LocalizationErrorState {
|
|
5
|
+
cache: Record<string, boolean>;
|
|
6
|
+
throw(code: string, details?: any): void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export class Localization {
|
|
10
|
+
constructor(url: string, fallback?: string);
|
|
11
|
+
|
|
12
|
+
onready?: () => void;
|
|
13
|
+
onerror?: (error: string, details?: any) => void;
|
|
14
|
+
onchange?: (language: string) => void;
|
|
15
|
+
|
|
16
|
+
languages: LocalizationLanguages;
|
|
17
|
+
preferred: string;
|
|
18
|
+
default: string;
|
|
19
|
+
ready: boolean;
|
|
20
|
+
err: LocalizationErrorState;
|
|
21
|
+
|
|
22
|
+
active: string;
|
|
23
|
+
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const flags: Record<string, string>;
|
|
28
|
+
|
|
29
|
+
declare global {
|
|
30
|
+
interface HTMLElementTagNameMap {
|
|
31
|
+
"language-selector": HTMLElement;
|
|
32
|
+
}
|
|
33
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "imba-localization",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/HeapVoid/imba-localization.git"
|
|
@@ -8,11 +8,25 @@
|
|
|
8
8
|
"main": "localization.imba",
|
|
9
9
|
"module": "localization.imba",
|
|
10
10
|
"browser": "localization.imba",
|
|
11
|
+
"types": "index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./index.d.ts",
|
|
15
|
+
"import": "./localization.imba",
|
|
16
|
+
"default": "./localization.imba"
|
|
17
|
+
},
|
|
18
|
+
"./localization.imba": {
|
|
19
|
+
"types": "./index.d.ts",
|
|
20
|
+
"import": "./localization.imba",
|
|
21
|
+
"default": "./localization.imba"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
11
24
|
"description": "A class to make using language localizations in Imba easier.",
|
|
12
25
|
"keywords": ["imba", "theme", "localization"],
|
|
13
26
|
"license": "MIT",
|
|
14
27
|
"type": "module",
|
|
15
28
|
"files": [
|
|
16
|
-
"localization.imba"
|
|
29
|
+
"localization.imba",
|
|
30
|
+
"index.d.ts"
|
|
17
31
|
]
|
|
18
|
-
}
|
|
32
|
+
}
|