Skip to content

Commit c3e8e15

Browse files
committed
➕ add @angular/localize
1 parent 9a11eb4 commit c3e8e15

File tree

4 files changed

+200
-22
lines changed

4 files changed

+200
-22
lines changed

angular.json

+15
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
"skipTests": true
1717
}
1818
},
19+
"i18n": {
20+
"sourceLocale": "fr-FR",
21+
"locales": {
22+
"en": {
23+
"translation": "src/locales/messages.en-US.xlf",
24+
"baseHref": "/en/"
25+
}
26+
}
27+
},
1928
"root": "",
2029
"sourceRoot": "src",
2130
"prefix": "admin",
@@ -66,6 +75,9 @@
6675
"extractLicenses": false,
6776
"sourceMap": true,
6877
"namedChunks": true
78+
},
79+
"en": {
80+
"localize": ["en"]
6981
}
7082
},
7183
"defaultConfiguration": "production"
@@ -78,6 +90,9 @@
7890
},
7991
"development": {
8092
"browserTarget": "admin-cpanel:build:development"
93+
},
94+
"en": {
95+
"browserTarget": "admin-cpanel:build:development,en"
8196
}
8297
},
8398
"defaultConfiguration": "development"

package-lock.json

+177-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve",
7+
"start:en": "ng serve --configuration=en",
8+
"extract": "ng extract-i18n --output-path src/locales",
79
"build": "ng build",
810
"watch": "ng build --watch --configuration development",
911
"test": "ng test",
@@ -46,6 +48,7 @@
4648
"@angular-eslint/template-parser": "13.5.0",
4749
"@angular/cli": "~13.3.5",
4850
"@angular/compiler-cli": "~13.3.0",
51+
"@angular/localize": "^13.3.11",
4952
"@ngx-env/builder": "^2.2.0",
5053
"@schematics/angular": "^14.2.2",
5154
"@types/jasmine": "~3.10.0",

src/polyfills.ts

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* Load `$localize` onto the global scope - used if i18n tags appear in Angular templates.
3+
*/
4+
import '@angular/localize/init';
5+
16
/**
27
* This file includes polyfills needed by Angular and is loaded before the app.
38
* You can add your own extra polyfills to this file.

0 commit comments

Comments
 (0)