Skip to content

Commit 94c3b84

Browse files
committed
demo(app): added i18n translation for ngx-translate
1 parent 60cfaf5 commit 94c3b84

File tree

8 files changed

+110
-22
lines changed

8 files changed

+110
-22
lines changed

demo/package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

demo/src/assets/i18n/de.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"LOWER_CASE_CRITERIA_MSG" : "enthält mindestens ein unteres Zeichen",
3+
"UPPER_CASE_CRITERIA_MSG" : "enthält mindestens ein oberes Zeichen",
4+
"DIGITS_CRITERIA_MSG" : "enthält mindestens eine Ziffer",
5+
"SPECIAL_CHARS_CRITERIA_MSG" : "enthält mindestens ein Sonderzeichen",
6+
"MIN_CHARS_CRITERIA_MSG" : "enthält mindestens {{value}} Zeichen"
7+
}

demo/src/assets/i18n/en.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"LOWER_CASE_CRITERIA_MSG" : "contains at least one lower character",
3+
"UPPER_CASE_CRITERIA_MSG" : "contains at least one upper character",
4+
"DIGITS_CRITERIA_MSG" : "contains at least one digit",
5+
"SPECIAL_CHARS_CRITERIA_MSG" : "contains at least one special character",
6+
"MIN_CHARS_CRITERIA_MSG" : "contains at least {{value}} characters"
7+
}

demo/src/assets/i18n/fr.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"LOWER_CASE_CRITERIA_MSG" : "contient au moins un caractère inférieur",
3+
"UPPER_CASE_CRITERIA_MSG" : "contient au moins un caractère supérieur",
4+
"DIGITS_CRITERIA_MSG" : "contient au moins un chiffre",
5+
"SPECIAL_CHARS_CRITERIA_MSG" : "contient au moins un caractère spécial",
6+
"MIN_CHARS_CRITERIA_MSG" : "contient au moins {{value}} caractères"
7+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
```html
2+
<mat-password-strength-info [passwordComponent]="passwordComponent">
3+
</mat-password-strength-info>
4+
```
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
```html
2+
<mat-password-strength-info
3+
lowerCaseCriteriaMsg="your best lower case criteria msg"
4+
upperCaseCriteriaMsg="your best upper case criteria msg"
5+
digitsCriteriaMsg="your best digit char criteria msg"
6+
specialCharsCriteriaMsg="your best special char criteria msg"
7+
minCharsCriteriaMsg="your best min char criteria msg"
8+
[passwordComponent]="passwordComponent">
9+
</mat-password-strength-info>
10+
```
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
```html
2+
<mat-password-strength-info
3+
[lowerCaseCriteriaMsg]="'LOWER_CASE_CRITERIA_MSG' | translate"
4+
[upperCaseCriteriaMsg]="'UPPER_CASE_CRITERIA_MSG '| translate"
5+
[digitsCriteriaMsg]="'DIGITS_CRITERIA_MSG '| translate"
6+
[specialCharsCriteriaMsg]="'SPECIAL_CHARS_CRITERIA_MSG' | translate"
7+
[minCharsCriteriaMsg]="'MIN_CHARS_CRITERIA_MSG' | translate"
8+
[passwordComponent]="passwordComponent">
9+
</mat-password-strength-info>
10+
```
11+
12+
`assets/i18n/en.json`
13+
14+
```json
15+
{
16+
"LOWER_CASE_CRITERIA_MSG" : "contains at least one lower character",
17+
"UPPER_CASE_CRITERIA_MSG" : "contains at least one upper character",
18+
"DIGITS_CRITERIA_MSG" : "contains at least one digit",
19+
"SPECIAL_CHARS_CRITERIA_MSG" : "contains at least one special character",
20+
"MIN_CHARS_CRITERIA_MSG" : "contains at least {{value}} characters"
21+
}
22+
```
23+
24+
`assets/i18n/de.json`
25+
26+
```json
27+
{
28+
"LOWER_CASE_CRITERIA_MSG" : "enthält mindestens ein unteres Zeichen",
29+
"UPPER_CASE_CRITERIA_MSG" : "enthält mindestens ein oberes Zeichen",
30+
"DIGITS_CRITERIA_MSG" : "enthält mindestens eine Ziffer",
31+
"SPECIAL_CHARS_CRITERIA_MSG" : "contains at least one special character",
32+
"MIN_CHARS_CRITERIA_MSG" : "enthält mindestens {{value}} Zeichen"
33+
}
34+
```
35+
36+
`assets/i18n/fr.json`
37+
38+
```json
39+
{
40+
"LOWER_CASE_CRITERIA_MSG" : "contient au moins un caractère inférieur",
41+
"UPPER_CASE_CRITERIA_MSG" : "contient au moins un caractère supérieur",
42+
"DIGITS_CRITERIA_MSG" : "contient au moins un chiffre",
43+
"SPECIAL_CHARS_CRITERIA_MSG" : "contient au moins un caractère spécial",
44+
"MIN_CHARS_CRITERIA_MSG" : "contient au moins {{valeur}} caractères"
45+
}
46+
```

demo/src/main.ts

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
import { enableProdMode } from '@angular/core';
2-
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3-
4-
import { AppModule } from './app/app.module';
5-
import { environment } from './environments/environment';
6-
7-
import { hmrBootstrap } from './hmr';
8-
9-
if (environment.production) {
10-
enableProdMode();
11-
}
12-
13-
const bootstrap = () => platformBrowserDynamic().bootstrapModule(AppModule);
14-
15-
if (environment.hmr) {
16-
if (module[ 'hot' ]) {
17-
hmrBootstrap(module, bootstrap);
18-
} else {
19-
console.error('HMR is not enabled for webpack-dev-server!');
20-
console.log('Are you using the --hmr flag for ng serve?');
21-
}
1+
import {enableProdMode} from '@angular/core';
2+
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
3+
4+
import {AppModule} from './app/app.module';
5+
import {environment} from './environments/environment';
6+
7+
import {hmrBootstrap} from './hmr';
8+
9+
import 'hammerjs';
10+
11+
if (environment.production) {
12+
enableProdMode();
13+
}
14+
15+
const bootstrap = () => platformBrowserDynamic().bootstrapModule(AppModule);
16+
17+
if (environment.hmr) {
18+
if (module['hot']) {
19+
hmrBootstrap(module, bootstrap);
2220
} else {
23-
bootstrap().catch(err => console.log(err));
21+
console.error('HMR is not enabled for webpack-dev-server!');
22+
console.log('Are you using the --hmr flag for ng serve?');
2423
}
24+
} else {
25+
bootstrap().catch(err => console.log(err));
26+
}

0 commit comments

Comments
 (0)