handlebars-i18n 1.8.0 → 1.8.1
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/package.json +1 -1
- package/readme.md +23 -18
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -8,13 +8,14 @@ the web browser. Supports Typescript.
|
|
|
8
8
|
Handlebars-i18n is listed amongst i18next’s [framework helpers](https://www.i18next.com/overview/supported-frameworks).
|
|
9
9
|
|
|
10
10
|
[](https://opensource.org/licenses/MIT)
|
|
11
|
-

|
|
12
12
|
[](https://github.com/fwalzel/handlebars-i18n/actions/workflows/node.js.yml/badge.svg)
|
|
13
13
|
[](https://coveralls.io/github/Aller-Couleur/handlebars-i18n?branch=master)
|
|
14
14
|
[](https://codeclimate.com/github/Aller-Couleur/handlebars-i18n)
|
|
15
15
|
[](https://snyk.io/test/github/Aller-Couleur/handlebars-i18n/badge.svg)
|
|
16
16
|

|
|
17
17
|

|
|
18
|
+

|
|
18
19
|
|
|
19
20
|
## License
|
|
20
21
|
|
|
@@ -28,20 +29,27 @@ If you use handlebars-i18n in a professional context, you could
|
|
|
28
29
|
|
|
29
30
|
## Install
|
|
30
31
|
|
|
31
|
-
```
|
|
32
|
+
```sh
|
|
32
33
|
npm i handlebars-i18n
|
|
33
34
|
```
|
|
34
35
|
|
|
35
|
-
##
|
|
36
|
+
## Import
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
Import as commonJS within node environment:
|
|
38
39
|
|
|
39
40
|
```javascript
|
|
40
41
|
const HandlebarsI18n = require("handlebars-i18n");
|
|
41
42
|
HandlebarsI18n.init();
|
|
42
43
|
```
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
With ES6 import syntax:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
import * as HandlebarsI18n from "handlebars-i18n";
|
|
49
|
+
HandlebarsI18n.init();
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Usage in web browser (old school):
|
|
45
53
|
|
|
46
54
|
```javascript
|
|
47
55
|
<script src="handlebars.js"></script>
|
|
@@ -53,12 +61,9 @@ Usage in web browser:
|
|
|
53
61
|
</script>
|
|
54
62
|
```
|
|
55
63
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
import * as HandlebarsI18n from "handlebars-i18n";
|
|
60
|
-
|
|
61
|
-
HandlebarsI18n.init();
|
|
64
|
+
Via jsDelivr CDN:
|
|
65
|
+
```javascript
|
|
66
|
+
<script src="https://cdn.jsdelivr.net/npm/handlebars-i18n@1.8.0/dist/handlebars-i18n.min.js"></script>
|
|
62
67
|
```
|
|
63
68
|
|
|
64
69
|
## Quick example
|
|
@@ -143,17 +148,17 @@ Finally use in template:
|
|
|
143
148
|
|
|
144
149
|
:point_right: See the *examples folder* in the repo for more use cases and details.
|
|
145
150
|
|
|
146
|
-
- Open `examples/browser-example/index.html` in your Web browser to see an implementation with a simple UI
|
|
147
|
-
- Run
|
|
148
|
-
- Run
|
|
151
|
+
- Open `examples/browser-example/index.html` in your Web browser to see an implementation with a simple UI.
|
|
152
|
+
- Run `npm run example:js` in the console to get a very basic node example logged.
|
|
153
|
+
- Run `npm run example:ts` to compile and log a typescript example.
|
|
149
154
|
|
|
150
155
|
## Additional CLI Helper for Handlebars-i18n available :metal:
|
|
151
156
|
|
|
152
157
|
Handlebars-i18n has its own command line
|
|
153
158
|
interface [handlebars-i18n-cli](https://www.npmjs.com/package/handlebars-i18n-cli).
|
|
154
159
|
|
|
155
|
-
```
|
|
156
|
-
|
|
160
|
+
```sh
|
|
161
|
+
npm i handlebars-i18n-cli --save-dev
|
|
157
162
|
```
|
|
158
163
|
|
|
159
164
|
Automatically extract translation strings from handlebars templates and generate i18next conform json files from it.
|
|
@@ -514,8 +519,8 @@ HandlebarsI18n.init(null, i18nextCustom);
|
|
|
514
519
|
|
|
515
520
|
## Run tests
|
|
516
521
|
|
|
517
|
-
```
|
|
518
|
-
|
|
522
|
+
```sh
|
|
523
|
+
npm test
|
|
519
524
|
```
|
|
520
525
|
|
|
521
526
|
## Merci à vous
|