Principles of Internationalization in Angular
To make text translatable, Angular uses the i18n attribute in templates.
TypeScript (component):
import { Component } from "@angular/core";
@Component({ selector: "app-greeting", standalone: true, templateUrl: "./greeting.component.html",})export class GreetingComponent { name = "Angular";}HTML template:
<h1 i18n="@@greetingMessage">Hello, {{ name }}!</h1>Explanation:
i18nmarks the element for translation.@@greetingMessageis a custom translation ID for reference.