@minejs/i18n 0.0.9 → 0.1.0

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.
Files changed (2) hide show
  1. package/README.md +12 -8
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  </div>
9
9
 
10
10
  <div align="center">
11
- <img src="https://img.shields.io/badge/v-0.0.9-black"/>
11
+ <img src="https://img.shields.io/badge/v-0.1.0-black"/>
12
12
  <a href="https://github.com/minejs-org"><img src="https://img.shields.io/badge/🔥-@minejs-black"/></a>
13
13
  <br>
14
14
  <img src="https://img.shields.io/badge/coverage-94.12%25-brightgreen" alt="Test Coverage" />
@@ -56,14 +56,18 @@
56
56
  ```jsonc
57
57
  // ./src/shared/dist/u18n/en.json
58
58
  {
59
- "key": "value"
59
+ "group": {
60
+ "key": "value"
61
+ }
60
62
  }
61
63
  ```
62
64
 
63
65
  ```jsonc
64
66
  // ./src/shared/dist/u18n/ar.json
65
67
  {
66
- "key": "قيـمة"
68
+ "group": {
69
+ "key": "قيـمة"
70
+ }
67
71
  }
68
72
  ```
69
73
 
@@ -130,7 +134,7 @@
130
134
  ```
131
135
 
132
136
  ```typescript
133
- t('greeting', { name: 'John', count: '5' })
137
+ t('group.greeting', { name: 'John', count: '5' })
134
138
  // "Hello John, you have 5 messages"
135
139
  ```
136
140
 
@@ -143,7 +147,7 @@
143
147
  ```
144
148
 
145
149
  ```typescript
146
- const tokens = tParse('terms');
150
+ const tokens = tParse('group.terms');
147
151
  // [
148
152
  // { type: 'text', content: 'I agree to the ' },
149
153
  // { type: 'tag', tag: 'link', content: 'Terms of Service' }
@@ -205,7 +209,7 @@
205
209
  > Translate with parameter replacement
206
210
 
207
211
  ```typescript
208
- t('greeting', { name: 'John' }) // "Hello John"
212
+ t('group.greeting', { name: 'John' }) // "Hello John"
209
213
  ```
210
214
 
211
215
  - #### `tLang(key, lang, params?)`
@@ -213,7 +217,7 @@
213
217
  > Translate with specific language
214
218
 
215
219
  ```typescript
216
- tLang('greeting', 'ar', { name: 'أحمد' })
220
+ tLang('group.greeting', 'ar', { name: 'أحمد' })
217
221
  ```
218
222
 
219
223
  - #### `tParse(key, params?)`
@@ -221,7 +225,7 @@
221
225
  > Parse translation with HTML tags
222
226
 
223
227
  ```typescript
224
- tParse('message') // Returns TokenArray
228
+ tParse('group.message') // Returns TokenArray
225
229
  ```
226
230
 
227
231
  - #### `setLanguage(lang)`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minejs/i18n",
3
- "version": "0.0.9",
3
+ "version": "0.1.0",
4
4
  "description": "A lightweight, production-ready internationalization (i18n) library with zero dependencies.",
5
5
  "keywords": ["minejs", "i18n"],
6
6
  "license": "MIT",