File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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+
7278Register the configuration:
7379
7480_ src/app/app.config.ts_
Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 2828 " dom"
2929 ],
3030 "useDefineForClassFields" : false ,
31- "allowSyntheticDefaultImports" : true
31+ "allowSyntheticDefaultImports" : true ,
32+ "resolveJsonModule" : true
3233 },
3334 "angularCompilerOptions" : {
3435 "strictInjectionParameters" : true ,
You can’t perform that action at this time.
0 commit comments