diff --git a/adev/src/content/guide/i18n/prepare.md b/adev/src/content/guide/i18n/prepare.md index 071fdfbc55c..b2fc6175baf 100644 --- a/adev/src/content/guide/i18n/prepare.md +++ b/adev/src/content/guide/i18n/prepare.md @@ -48,6 +48,26 @@ The following example shows the `` element transformed into a non- +### Name the interpolation placeholder + +By default, Angular generates a placeholder name for each interpolation in a translated message. To give it a meaningful name that helps translators understand the context, add an `//i18n(ph="name")` comment inside the interpolation. + +```html +{{ expression //i18n(ph="placeholder_name") }} +``` + +For example: + +```html +

Hello, {{ username //i18n(ph="name") }}!

+``` + +This is the template equivalent of naming a placeholder in component code with [`$localize`][ApiLocalizeInitLocalize]: + +```ts +$localize`Hello, ${username}:name:!`; +``` + ## Mark element attributes for translations In a component template, the i18n metadata is the value of the `i18n-{attribute_name}` attribute.