Skip to content

Commit 88fd3f2

Browse files
committed
Update docs
1 parent 54fe668 commit 88fd3f2

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export const l10nConfig: L10nConfig = {
4848

4949
@Injectable() export class TranslationLoader implements L10nTranslationLoader {
5050
public get(language: string, provider: L10nProvider): Observable<{ [key: string]: any }> {
51+
/**
52+
* Translation files are lazy-loaded via dynamic import and will be split into separate chunks during build.
53+
* Assets names and keys must be valid variable names
54+
*/
5155
const data = import(`../i18n/${language}/${provider.asset}.json`);
5256
return from(data);
5357
}
@@ -69,6 +73,8 @@ _src/i18n/en-US/app.json_
6973
}
7074
```
7175

76+
> Note. The implementation above of `L10nTranslationLoader` is just an example: you can load the translation data in the way you prefer.
77+
7278
Register the configuration:
7379

7480
_src/app/app.config.ts_

angular.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
"prefix": "app",
6262
"architect": {
6363
"build": {
64-
"builder": "@angular-devkit/build-angular:browser",
64+
"builder": "@angular-devkit/build-angular:browser-esbuild",
6565
"options": {
6666
"outputPath": "dist/angular-l10n-app",
6767
"index": "projects/angular-l10n-app/src/index.html",

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"dom"
2929
],
3030
"useDefineForClassFields": false,
31-
"allowSyntheticDefaultImports": true
31+
"allowSyntheticDefaultImports": true,
32+
"resolveJsonModule": true
3233
},
3334
"angularCompilerOptions": {
3435
"strictInjectionParameters": true,

0 commit comments

Comments
 (0)