imba-localization 0.2.3 → 0.2.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/README.md CHANGED
@@ -54,10 +54,10 @@ Add this to your HTML head to load the localization file simultaneously with you
54
54
 
55
55
  ```imba
56
56
  # app.imba
57
- import { Localization } from 'imba-localization'
57
+ import { LocalizationState } from 'imba-localization'
58
58
 
59
59
  # Create an instance with the JSON URL and optional default language
60
- const loc = new Localization("path/to/lang.json", "en")
60
+ const loc = new LocalizationState("path/to/lang.json", "en")
61
61
 
62
62
  # Set up event handlers
63
63
  loc.onready = do
@@ -69,7 +69,7 @@ loc.onready = do
69
69
  console.log loc['user']['profile'] # Accessing nested properties
70
70
 
71
71
  loc.onerror = do(error, details)
72
- # The Localization object can return following types of errors:
72
+ # The LocalizationState object can return following types of errors:
73
73
  # 'no_localization_file' - if there were a problem when downloading JSON file
74
74
  # 'no_default_localization' - if there is no localization in the file for the default language
75
75
  # 'no_localization_key' - if there is no requiered (from the interface) key in the file
@@ -123,7 +123,7 @@ Your localization file should follow this format:
123
123
  ### Constructor
124
124
 
125
125
  ```imba
126
- new Localization(url, default = 'en')
126
+ new LocalizationState(url, default = 'en')
127
127
  ```
128
128
 
129
129
  - `url`: Path to your JSON localization file
@@ -148,8 +148,8 @@ new Localization(url, default = 'en')
148
148
  A customizable dropdown component that allows users to select from available in the JSON localization file languages.
149
149
 
150
150
  ```imba
151
- import { Localization, LanguageSelector } from 'imba-localization'
152
- const loc = new Localization("path/to/lang.json", "en")
151
+ import { LocalizationState, LanguageSelector } from 'imba-localization'
152
+ const loc = new LocalizationState("path/to/lang.json", "en")
153
153
 
154
154
  # In your UI component
155
155
  tag AppHeader
@@ -209,8 +209,8 @@ css
209
209
  LanguageSelector can be easily customized through CSS and Imba tag (class) inheritance. Here how the above classes can be adjusted via the inheritance:
210
210
 
211
211
  ```imba
212
- import { Localization, LanguageSelector } from 'imba-localization'
213
- const loc = new Localization("path/to/lang.json", "en")
212
+ import { LocalizationState, LanguageSelector } from 'imba-localization'
213
+ const loc = new LocalizationState("path/to/lang.json", "en")
214
214
 
215
215
  # Create an inheritent class
216
216
  tag Languages < LanguageSelector
@@ -1,4 +1,4 @@
1
- export class Localization
1
+ export class LocalizationState
2
2
  onready
3
3
  onerror
4
4
  onchange
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "imba-localization",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/HeapVoid/imba-localization.git"
7
7
  },
8
- "main": "index.imba",
9
- "module": "index.imba",
10
- "browser": "index.imba",
8
+ "main": "localization.imba",
9
+ "module": "localization.imba",
10
+ "browser": "localization.imba",
11
11
  "description": "A class to make using language localizations in Imba easier.",
12
12
  "keywords": ["imba", "theme", "localization"],
13
13
  "license": "MIT",
14
14
  "type": "module",
15
15
  "files": [
16
- "index.imba"
16
+ "localization.imba"
17
17
  ]
18
18
  }