Complete the code to import the Angular i18n module.
import { [1] } from '@angular/localize';
The localize function is imported from '@angular/localize' to enable internationalization features.
Complete the code to mark a text for translation in an Angular template.
<p i18n>[1]</p>Text inside the element marked with i18n attribute is extracted for translation. The actual text is 'Hello, world!'.
Fix the error in the Angular component to use the i18n pipe correctly.
<p>{{ 'WELCOME' | [1] }}</p>The correct pipe for Angular internationalization is i18n. It tells Angular to translate the string key.
Fill both blanks to create a translation file reference and load it in Angular.
const translations = require('[1]'); @NgModule({ providers: [{ provide: TRANSLATIONS, useValue: [2] }] })
The translation file path is './locale/messages.fr.xlf' and the loaded content is stored in the variable translations.
Fill all three blanks to set up Angular i18n with locale, translations, and bootstrap.
import { [1] } from '@angular/core'; import { TRANSLATIONS, TRANSLATIONS_FORMAT, LOCALE_ID } from '@angular/core'; @NgModule({ providers: [ { provide: TRANSLATIONS, useValue: [2] }, { provide: TRANSLATIONS_FORMAT, useValue: '[3]' }, { provide: LOCALE_ID, useValue: 'fr' } ] }) export class AppModule {}
We import NgModule to define the module, use the translations variable for translation content, and specify the format as 'xlf' for XML Localization Interchange File Format.