Getting translation texts. In general there are two possibilities:
- Using
i18n
-decorator andi18n
-parameters - Simple method and and
i18n
-parameters
...
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
})
export class AppComponent {
@i18n('key.to.text.in.file', 'initial and fallback text value with optional [placeholder]', 'optional placeholder')
name!: string;
descriptionLabel!: string;
constructor() { ... }
...
}
Or you can change values without using any i18n
-decorator
setI18n() {
this.descriptionLabel = getI18nText(
'key.to.text.in.file',
'Gewicht: [placeholder] kg',
100
);
}