handlebars-i18n 1.6.3 → 1.6.4

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/package.json +4 -5
  2. package/readme.md +18 -11
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "handlebars-i18n",
3
- "version": "1.6.3",
4
- "description": "handlebars-i18n adds internationlization to handlebars.js using i18next and Intl",
3
+ "version": "1.6.4",
4
+ "description": "handlebars-i18n adds internationalization to handlebars.js using i18next and Intl",
5
5
  "main": "dist/handlebars-i18n.js",
6
6
  "scripts": {
7
7
  "test": "nyc mocha",
@@ -17,16 +17,15 @@
17
17
  "url": "https://github.com/aller-couleur/handlebars-i18n.git"
18
18
  },
19
19
  "keywords": [
20
- "handlebars-i18n",
20
+ "Translation",
21
+ "Multi-language",
21
22
  "Internationalization",
22
23
  "Localization",
23
24
  "Globalization",
24
- "Translation",
25
25
  "Date Formatting",
26
26
  "Currency Formatting",
27
27
  "Number Formatting",
28
28
  "Handlebars",
29
- "Handlebars.js",
30
29
  "i18next",
31
30
  "i18n",
32
31
  "Intl",
package/readme.md CHANGED
@@ -13,10 +13,10 @@ Handlebars-i18n is listed amongst i18next’s [framework helpers](https://www.i1
13
13
  ![npm](https://img.shields.io/npm/dt/handlebars-i18n)
14
14
  ![npm](https://img.shields.io/npm/dm/handlebars-i18n)
15
15
 
16
-
17
16
  ## License
18
17
 
19
- Copyright (c) 2020 Florian Walzel,
18
+ Copyright (c) 2020–24 Florian Walzel,
19
+
20
20
  MIT License
21
21
 
22
22
  If you use handlebars-i18n in a professional context, you could
@@ -122,43 +122,48 @@ Finally use in template:
122
122
  ```
123
123
  <p> {{__ "phrase1"}} </p>
124
124
  ```
125
+
125
126
  * returns for "en" &#x2192; **What is good?**
126
127
 
127
128
  ```
128
129
  <p> {{__ "phrase2" thing=myItem}} </p>
129
130
  ```
131
+
130
132
  * returns for "en" &#x2192; **handlebars-i18n is good.**
131
133
 
132
134
  ```
133
135
  <p> {{_date myDate}} </p>
134
136
  ```
137
+
135
138
  * returns for "en" &#x2192; **March 11, 2020, 4:24 AM**
136
139
 
137
140
  ```
138
141
  <p> {{_price myPrice}} </p>
139
142
  ```
143
+
140
144
  * returns for "en" &#x2192; **$1,200.99**
141
145
 
142
146
  ## Further examples
143
147
 
144
148
  :point_right: See the *examples folder* in the repo for more use cases and details.
145
149
 
150
+ - Open `examples/browser-example/index.html` in your Web browser to see an implementation with a simple UI
151
+ - Run `$ npm run example:js` in the console to get a very basic node example logged
152
+ - Run `$ npm run example:ts` to compile and log a typescript example
146
153
 
147
- ## NEW! :star_struck: Additional CLI Helper for Handlebars-i18n
154
+ ## Additional CLI Helper for Handlebars-i18n available :metal:
148
155
 
149
- Handlebars-i18n has its own command line interface [handlebars-i18n-cli](https://www.npmjs.com/package/handlebars-i18n-cli) by now.
156
+ Handlebars-i18n has its own command line interface [handlebars-i18n-cli](https://www.npmjs.com/package/handlebars-i18n-cli).
150
157
 
151
158
  ```bash
152
159
  $ npm i handlebars-i18n-cli --save-dev
153
160
  ```
154
161
 
155
162
  Automatically extract translation strings from handlebars templates and generate i18next conform json files from it.
156
- Handlebars-i18n-cli also helps to keep your translations up to date when changes are made in the templates over time.
157
-
163
+ Handlebars-i18n-cli also helps to keep[](https://) your translations up to date when changes are made in the templates over time.
158
164
 
159
165
  ## API
160
166
 
161
-
162
167
  ### __
163
168
 
164
169
  Returns the phrase associated with the given key for the selected language. __ will take all options i18next’s [t-function](https://www.i18next.com/overview/api#t) would take.
@@ -167,6 +172,7 @@ The primary key can be passed hard encoded in the template when written in quote
167
172
  ```
168
173
  {{__ "keyToTranslationPhrase"}}
169
174
  ```
175
+
170
176
  … or it can be referenced via a handlebars variable:
171
177
 
172
178
  ```
@@ -216,8 +222,6 @@ Will output the contents for "**de**" even though other language is selected.
216
222
 
217
223
  ---
218
224
 
219
-
220
-
221
225
  ### _locale
222
226
 
223
227
  Returns the shortcode of i18next’s currently selected language such as "**en**", "**de**", "**fr**", "**fi**" … etc.
@@ -225,6 +229,7 @@ Returns the shortcode of i18next’s currently selected language such as "**en**
225
229
  ```
226
230
  {{_locale}}
227
231
  ```
232
+
228
233
  ---
229
234
 
230
235
  ### localeIs
@@ -234,6 +239,7 @@ Checks a string against i18next’s currently selected language. Returns **true*
234
239
  ```
235
240
  {{#if (localeIs "en")}} ... {{/if}}
236
241
  ```
242
+
237
243
  ---
238
244
 
239
245
  ### _date
@@ -277,6 +283,7 @@ You can add multiple arguments for individual formatting. See [Intl DateTimeForm
277
283
  ```
278
284
  {{_date 1583922952743 year="2-digit" day="2-digit" timeZone="America/Los_Angeles"}}
279
285
  ```
286
+
280
287
  ---
281
288
 
282
289
  ### _num
@@ -294,6 +301,7 @@ You can add multiple arguments for individual formatting. See [Intl NumberFormat
294
301
  ```
295
302
  {{_num 3.14159 maximumFractionDigits=2}}
296
303
  ```
304
+
297
305
  Will output **3.14** for "**en**", but **3,14** for "**de**".
298
306
 
299
307
  ---
@@ -302,7 +310,6 @@ Will output **3.14** for "**en**", but **3,14** for "**de**".
302
310
 
303
311
  Outputs a formatted currency string according to the language specific conventions of price representation, e.g. **€9,999.99** for "**en**", but **9.999,99 €** for "**de**".
304
312
 
305
-
306
313
  ```
307
314
  {{_price 9999.99}}
308
315
  ```
@@ -422,4 +429,4 @@ For your contribution, I would like to thank [@MickL](https://github.com/MickL),
422
429
 
423
430
  ## Note
424
431
 
425
- There is a *different* package named [handlebars-i18next](https://www.npmjs.com/package/handlebars-i18next) by [Julian Gonggrijp](https://github.com/jgonggrijp) which might also suit your needs. Cheers!
432
+ There is a *different* package named [handlebars-i18next](https://www.npmjs.com/package/handlebars-i18next) by [@jgonggrijp](https://github.com/jgonggrijp) which might also suit your needs. Cheers!