You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: BREAKING_CHANGES.md
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,9 @@
1
+
# Transloco Keys Manager V4
2
+
3
+
The library is now ESM only in order to use the newer versions of the angular compiler.
4
+
The publishing scope has changes from `@ngneat/transloco-keys-manager` to `@jsverse/transloco-keys-manager`,
5
+
this means you'll need to update the import paths of the marker functions in case you are using it.
6
+
1
7
# Transloco Keys Manager V2
2
8
3
9
#### Paths resolution
@@ -13,7 +19,7 @@ The `sourceRoot` value is determined by the following logic:
13
19
14
20
#### Dynamic Template Keys
15
21
16
-
Comments in the templates will now **inherit the `read`[input](https://ngneat.github.io/transloco/docs/structural-directive/#utilizing-the-read-input) value** (if exists), and will be prefixed with it:
22
+
Comments in the templates will now **inherit the `read`[input](https://jsverse.github.io/transloco/docs/structural-directive/#utilizing-the-read-input) value** (if exists), and will be prefixed with it:
17
23
```html
18
24
<!-- t(this.is.cool) -->
19
25
<ng-container*transloco="let m; read: 'messages'">
[](https://github.com/prettier/prettier)
11
-
[](https://gitter.im/ngneat-transloco/lobby?source=orgpage)
Translation is a tiresome and repetitive task. Each time we add new text, we need to create a new entry in the translation file, find the correct placement for it, etc. Moreover, when we delete existing keys, we need to remember to remove them from each translation file.
16
11
17
12
To make the process less burdensome, we've created two tools for the Transloco library, which will do the monotonous work for you.
@@ -46,7 +41,7 @@ To make the process less burdensome, we've created two tools for the Transloco l
46
41
Assuming you've already added Transloco to your project, run the following schematics command:
47
42
48
43
```
49
-
ng g @ngneat/transloco:keys-manager
44
+
ng g @jsverse/transloco:keys-manager
50
45
```
51
46
52
47
At this point, you'll have to choose whether you want to use the CLI, Webpack Plugin, or both. The project will be updated according to your choice.
@@ -57,8 +52,8 @@ At this point, you'll have to choose whether you want to use the CLI, Webpack Pl
57
52
58
53
Install the Transloco keys manager package via `yarn` or `npm` by running:
59
54
```shell script
60
-
npm i -D @ngneat/transloco-keys-manager
61
-
yarn add -D @ngneat/transloco-keys-manager
55
+
npm i -D @jsverse/transloco-keys-manager
56
+
yarn add -D @jsverse/transloco-keys-manager
62
57
```
63
58
64
59
Add the following scripts to your `package.json` file:
@@ -103,9 +98,9 @@ You should see a new file named `webpack-dev.config.js` configured with `Translo
@@ -124,10 +119,10 @@ Now run `npm start` and it'll generate new keys whenever a **save** is made to t
124
119
125
120
### Scopes Support
126
121
127
-
The extractor supports [scopes](https://ngneat.github.io/transloco/docs/scope-configuration/) out of the box. When you define a new scope in the `providers` array:
122
+
The extractor supports [scopes](https://jsverse.github.io/transloco/docs/scope-configuration/) out of the box. When you define a new scope in the `providers` array:
When using comments in the templates they will also **inherit the `read` [input](https://ngneat.github.io/transloco/docs/translation-in-the-template/#utilizing-the-read-input) value** (if exists), and will be prefixed with it:
227
+
When using comments in the templates they will also **inherit the `read` [input](https://jsverse.github.io/transloco/docs/translation-in-the-template/#utilizing-the-read-input) value** (if exists), and will be prefixed with it:
233
228
```html
234
229
<!--t(this.is.cool) -->
235
230
<ng-container*transloco="let m; read: 'messages'">
231
+
...
232
+
<!--t(success, error) -->
233
+
<ng-container*transloco="let g; read: 'general'">
236
234
...
237
-
<!--t(success, error) -->
238
-
<ng-container*transloco="let g; read: 'general'">
239
-
...
240
-
<!--t(ok, cancel) -->
241
-
</ng-container>
235
+
<!--t(ok, cancel) -->
236
+
</ng-container>
242
237
</ng-container>
243
238
```
244
239
@@ -254,43 +249,43 @@ The extracted keys for the code above will be:
254
249
```
255
250
256
251
*Notes:*
257
-
1. When using a Typescript file, you must have an `import { } from'@ngneat/transloco'` statement in it.
252
+
1. When using a Typescript file, you must have an `import { } from'@jsverse/transloco'` statement in it.
258
253
2. When using comments in your HTML files, they *must* contain only the markers without additional text.
259
-
Here's an example for invalid comment:
260
-
`<!--Fordropdownt(dynamic.1, dynamic.2) -->`
254
+
Here's an example for invalid comment:
255
+
`<!--Fordropdownt(dynamic.1, dynamic.2) -->`
261
256
262
257
### Marker function
263
258
264
259
If you want to extract some standalone strings that are not part of any translation call (via the template or service)
265
260
you can wrap them with the marker function to tell the keys manager to extract them:
@@ -337,7 +332,7 @@ Run `npm run i18n:find`, and you'll get a lovely list that summarizes the keys f
337
332
## 🕹 Options
338
333
339
334
- `project`*: The targeted project (default is `defaultProject`). The `sourceRoot` of this project will be extracted from the `angular.json` file and will prefix the `input`, `output`, and `translationPath` properties.
340
-
In addition, the transloco config file will be searched in the project's `sourceRoot` (unless the `config` option is passed):
335
+
In addition, the transloco config file will be searched in the project's `sourceRoot` (unless the `config` option is passed):
If you are using unflat files keep in mind that “parent” keys won't be usable for a separate translation value, i.e. if you have two keys `first` and `first.second` you cannot assign a value to `first` as the translation file will look like `{ "first": { "second": "…" } }`.
401
+
If you are using unflat files keep in mind that “parent” keys won't be usable for a separate translation value, i.e. if you have two keys `first` and `first.second` you cannot assign a value to `first` as the translation file will look like `{ "first": { "second": "…" } }`.
407
402
408
-
During key extraction you will get a warning with a list of concerned keys you have to check for.
403
+
During key extraction you will get a warning with a list of concerned keys you have to check for.
409
404
410
405
- `defaultValue`: The default value of a generated key: (default is `Missingvaluefor {{key}}`)
411
406
@@ -502,15 +497,6 @@ You can also chain several namespaces:
0 commit comments