Внести вклад
Подробные руководства
Интернационализация

Работа с файлами перевода

После подготовки компонента к переводу используйте команду extract-i18n Angular CLI, чтобы извлечь помеченный текст из компонента в файл исходного языка.

Помеченный текст включает текст с атрибутом i18n, атрибуты с i18n-attribute и текст с тегом $localize, как описано в разделе Подготовка компонента к переводу.

Выполните следующие шаги для создания и обновления файлов перевода вашего проекта.

  1. Извлеките файл исходного языка.
  2. При необходимости измените расположение, формат и имя.
  3. Скопируйте файл исходного языка, чтобы создать файл перевода для каждого языка.
  4. Переведите каждый файл перевода.
  5. Переводите формы множественного числа и альтернативные выражения отдельно.
  6. Перевод форм множественного числа.
  7. Перевод альтернативных выражений.
  8. Перевод вложенных выражений.

Извлечение файла исходного языка

Чтобы извлечь файл исходного языка, выполните следующие действия.

  1. Откройте терминал.
  2. Перейдите в корневую директорию вашего проекта.
  3. Запустите следующую команду CLI.
ng extract-i18n

Команда extract-i18n создает файл исходного языка с именем messages.xlf в корневой директории вашего проекта. Для получения дополнительной информации о формате XML Localization Interchange File Format (XLIFF, версия 1.2) см. XLIFF.

Используйте следующие опции команды extract-i18n для изменения расположения, формата и имени файла исходного языка.

Опция команды Детали
--format Установить формат выходного файла
--out-file Установить имя выходного файла
--output-path Установить путь к выходной директории

Изменение расположения файла исходного языка

Чтобы создать файл в директории src/locale, укажите путь вывода в качестве опции.

Пример extract-i18n --output-path

В следующем примере путь вывода указывается как опция.

ng extract-i18n --output-path src/locale

Изменение формата файла исходного языка

Команда extract-i18n создает файлы в следующих форматах перевода.

Формат перевода Детали Расширение файла
ARB Application Resource Bundle .arb
JSON JavaScript Object Notation .json
XLIFF 1.2 XML Localization Interchange File Format, версия 1.2 .xlf
XLIFF 2 XML Localization Interchange File Format, версия 2 .xlf
XMB XML Message Bundle .xmb (.xtb)

Явно укажите формат перевода с помощью опции команды --format.

ПОЛЕЗНО: Формат XMB генерирует файлы исходного языка .xmb, но использует файлы перевода .xtb.

Пример extract-i18n --format

Следующий пример демонстрирует несколько форматов перевода.

ng extract-i18n --format=xlf
ng extract-i18n --format=xlf2
ng extract-i18n --format=xmb
ng extract-i18n --format=json
ng extract-i18n --format=arb

Изменение имени файла исходного языка

Чтобы изменить имя файла исходного языка, создаваемого инструментом извлечения, используйте опцию команды --out-file.

Пример extract-i18n --out-file

Следующий пример демонстрирует именование выходного файла.

ng extract-i18n --out-file source.xlf

Создание файла перевода для каждого языка

Чтобы создать файл перевода для локали или языка, выполните следующие действия.

  1. Извлеките файл исходного языка.

  2. Сделайте копию файла исходного языка, чтобы создать файл перевода для каждого языка.

  3. Переименуйте файл перевода, добавив локаль.

    messages.xlf --> messages.{locale}.xlf
  4. Создайте новую директорию в корне проекта с именем locale.

    src/locale
  5. Переместите файл перевода в новую директорию.

  6. Отправьте файл перевода вашему переводчику.

  7. Повторите вышеуказанные шаги для каждого языка, который вы хотите добавить в приложение.

Пример extract-i18n для французского языка

Например, чтобы создать файл перевода на французский язык, выполните следующие действия.

  1. Запустите команду extract-i18n.
  2. Сделайте копию файла исходного языка messages.xlf.
  3. Переименуйте копию в messages.fr.xlf для перевода на французский язык (fr).
  4. Переместите файл перевода fr в директорию src/locale.
  5. Отправьте файл перевода fr переводчику.

Перевод каждого файла перевода

Если вы не владеете языком свободно и у вас нет времени на редактирование переводов, вы, вероятно, выполните следующие шаги.

  1. Отправьте каждый файл перевода переводчику.
  2. Переводчик использует редактор файлов XLIFF для выполнения следующих действий.
  3. Создание перевода.
  4. Редактирование перевода.

Пример процесса перевода для французского языка

Чтобы продемонстрировать процесс, рассмотрите файл messages.fr.xlf в примере приложения Angular Internationalization. Пример приложения Angular Internationalization включает французский перевод, который вы можете редактировать без специального редактора XLIFF или знания французского языка.

Следующие действия описывают процесс перевода на французский язык.

  1. Откройте messages.fr.xlf и найдите первый элемент <trans-unit>. Это единица перевода, также известная как текстовый узел, которая представляет собой перевод тега приветствия <h1>, ранее помеченного атрибутом i18n.

    src/locale/messages.fr.xlf ()

    <!-- The `messages.fr.xlf` after translation for documentation purposes -->
    <!-- #docregion -->
    <?xml version="1.0" encoding="UTF-8" ?>
    <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
      <file source-language="en" datatype="plaintext" original="ng2.template">
        <body>
          <!-- #docregion translated-hello-before -->
          <trans-unit id="introductionHeader" datatype="html">
            <source>Hello i18n!</source>
            <note priority="1" from="description">An introduction header for this sample</note>
            <note priority="1" from="meaning">User welcome</note>
          </trans-unit>
          <!-- #enddocregion translated-hello-before -->
          <!-- #docregion translated-hello -->
          <!-- #docregion custom-id -->
          <trans-unit id="introductionHeader" datatype="html">
          <!-- #enddocregion custom-id -->
            <source>Hello i18n!</source>
            <target>Bonjour i18n !</target>
            <note priority="1" from="description">An introduction header for this sample</note>
            <note priority="1" from="meaning">User welcome</note>
          </trans-unit>
          <!-- #enddocregion translated-hello -->
          <!-- #docregion translated-other-nodes -->
          <!-- #docregion generated-id -->
          <trans-unit id="ba0cc104d3d69bf669f97b8d96a4c5d8d9559aa3" datatype="html">
          <!-- #enddocregion generated-id -->
            <source>I don&apos;t output any element</source>
            <target>Je n'affiche aucun élément</target>
          </trans-unit>
          <trans-unit id="701174153757adf13e7c24a248c8a873ac9f5193" datatype="html">
            <source>Angular logo</source>
            <target>Logo d'Angular</target>
          </trans-unit>
          <!-- #enddocregion translated-other-nodes -->
          <!-- #docregion translated-plural -->
          <trans-unit id="5a134dee893586d02bffc9611056b9cadf9abfad" datatype="html">
            <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago} }</source>
            <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes} }</target>
          </trans-unit>
          <!-- #enddocregion translated-plural -->
          <!-- #docregion translated-select -->
          <!-- #docregion translate-select-1 -->
          <trans-unit id="f99f34ac9bd4606345071bd813858dec29f3b7d1" datatype="html">
            <source>The author is <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></source>
            <target>L'auteur est <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></target>
          </trans-unit>
          <!-- #enddocregion translate-select-1 -->
          <!-- #docregion translate-select-2 -->
          <trans-unit id="eff74b75ab7364b6fa888f1cbfae901aaaf02295" datatype="html">
            <source>{VAR_SELECT, select, male {male} female {female} other {other} }</source>
            <target>{VAR_SELECT, select, male {un homme} female {une femme} other {autre} }</target>
          </trans-unit>
          <!-- #enddocregion translate-select-2 -->
          <!-- #enddocregion translated-select -->
          <!-- #docregion translate-nested -->
          <!-- #docregion translate-nested-1 -->
          <trans-unit id="972cb0cf3e442f7b1c00d7dab168ac08d6bdf20c" datatype="html">
            <source>Updated: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></source>
            <target>Mis à jour: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></target>
          </trans-unit>
          <!-- #enddocregion translate-nested-1 -->
          <!-- #docregion translate-nested-2 -->
          <trans-unit id="7151c2e67748b726f0864fc443861d45df21d706" datatype="html">
            <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago by {VAR_SELECT, select, male {male} female {female} other {other} }} }</source>
            <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes par {VAR_SELECT, select, male {un homme} female {une femme} other {autre} }} }</target>
          </trans-unit>
          <!-- #enddocregion translate-nested-2 -->
          <!-- #enddocregion translate-nested -->
          <!-- #docregion i18n-duplicate-custom-id -->
          <trans-unit id="myId" datatype="html">
            <source>Hello</source>
            <target state="new">Bonjour</target>
          </trans-unit>
          <!-- #enddocregion i18n-duplicate-custom-id -->
        </body>
      </file>
    </xliff>
    
    

    id="introductionHeader" — это пользовательский ID, но без префикса @@, требуемого в исходном HTML.

  2. Скопируйте элемент <source>... </source> в текстовом узле, переименуйте его в target, а затем замените содержимое французским текстом.

    src/locale/messages.fr.xlf (, после перевода)

    <!-- The `messages.fr.xlf` after translation for documentation purposes -->
    <!-- #docregion -->
    <?xml version="1.0" encoding="UTF-8" ?>
    <xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
      <file source-language="en" datatype="plaintext" original="ng2.template">
        <body>
          <!-- #docregion translated-hello-before -->
          <trans-unit id="introductionHeader" datatype="html">
            <source>Hello i18n!</source>
            <note priority="1" from="description">An introduction header for this sample</note>
            <note priority="1" from="meaning">User welcome</note>
          </trans-unit>
          <!-- #enddocregion translated-hello-before -->
          <!-- #docregion translated-hello -->
          <!-- #docregion custom-id -->
          <trans-unit id="introductionHeader" datatype="html">
          <!-- #enddocregion custom-id -->
            <source>Hello i18n!</source>
            <target>Bonjour i18n !</target>
            <note priority="1" from="description">An introduction header for this sample</note>
            <note priority="1" from="meaning">User welcome</note>
          </trans-unit>
          <!-- #enddocregion translated-hello -->
          <!-- #docregion translated-other-nodes -->
          <!-- #docregion generated-id -->
          <trans-unit id="ba0cc104d3d69bf669f97b8d96a4c5d8d9559aa3" datatype="html">
          <!-- #enddocregion generated-id -->
            <source>I don&apos;t output any element</source>
            <target>Je n'affiche aucun élément</target>
          </trans-unit>
          <trans-unit id="701174153757adf13e7c24a248c8a873ac9f5193" datatype="html">
            <source>Angular logo</source>
            <target>Logo d'Angular</target>
          </trans-unit>
          <!-- #enddocregion translated-other-nodes -->
          <!-- #docregion translated-plural -->
          <trans-unit id="5a134dee893586d02bffc9611056b9cadf9abfad" datatype="html">
            <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago} }</source>
            <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes} }</target>
          </trans-unit>
          <!-- #enddocregion translated-plural -->
          <!-- #docregion translated-select -->
          <!-- #docregion translate-select-1 -->
          <trans-unit id="f99f34ac9bd4606345071bd813858dec29f3b7d1" datatype="html">
            <source>The author is <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></source>
            <target>L'auteur est <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></target>
          </trans-unit>
          <!-- #enddocregion translate-select-1 -->
          <!-- #docregion translate-select-2 -->
          <trans-unit id="eff74b75ab7364b6fa888f1cbfae901aaaf02295" datatype="html">
            <source>{VAR_SELECT, select, male {male} female {female} other {other} }</source>
            <target>{VAR_SELECT, select, male {un homme} female {une femme} other {autre} }</target>
          </trans-unit>
          <!-- #enddocregion translate-select-2 -->
          <!-- #enddocregion translated-select -->
          <!-- #docregion translate-nested -->
          <!-- #docregion translate-nested-1 -->
          <trans-unit id="972cb0cf3e442f7b1c00d7dab168ac08d6bdf20c" datatype="html">
            <source>Updated: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></source>
            <target>Mis à jour: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></target>
          </trans-unit>
          <!-- #enddocregion translate-nested-1 -->
          <!-- #docregion translate-nested-2 -->
          <trans-unit id="7151c2e67748b726f0864fc443861d45df21d706" datatype="html">
            <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago by {VAR_SELECT, select, male {male} female {female} other {other} }} }</source>
            <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes par {VAR_SELECT, select, male {un homme} female {une femme} other {autre} }} }</target>
          </trans-unit>
          <!-- #enddocregion translate-nested-2 -->
          <!-- #enddocregion translate-nested -->
          <!-- #docregion i18n-duplicate-custom-id -->
          <trans-unit id="myId" datatype="html">
            <source>Hello</source>
            <target state="new">Bonjour</target>
          </trans-unit>
          <!-- #enddocregion i18n-duplicate-custom-id -->
        </body>
      </file>
    </xliff>
    
    

    В более сложном переводе информация и контекст в элементах описания и значения помогают выбрать правильные слова для перевода.

  3. Переведите остальные текстовые узлы. Следующий пример показывает, как переводить.

src/locale/messages.fr.xlf ()

<!-- The `messages.fr.xlf` after translation for documentation purposes -->
<!-- #docregion -->
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  <file source-language="en" datatype="plaintext" original="ng2.template">
    <body>
      <!-- #docregion translated-hello-before -->
      <trans-unit id="introductionHeader" datatype="html">
        <source>Hello i18n!</source>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello-before -->
      <!-- #docregion translated-hello -->
      <!-- #docregion custom-id -->
      <trans-unit id="introductionHeader" datatype="html">
      <!-- #enddocregion custom-id -->
        <source>Hello i18n!</source>
        <target>Bonjour i18n !</target>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello -->
      <!-- #docregion translated-other-nodes -->
      <!-- #docregion generated-id -->
      <trans-unit id="ba0cc104d3d69bf669f97b8d96a4c5d8d9559aa3" datatype="html">
      <!-- #enddocregion generated-id -->
        <source>I don&apos;t output any element</source>
        <target>Je n'affiche aucun élément</target>
      </trans-unit>
      <trans-unit id="701174153757adf13e7c24a248c8a873ac9f5193" datatype="html">
        <source>Angular logo</source>
        <target>Logo d'Angular</target>
      </trans-unit>
      <!-- #enddocregion translated-other-nodes -->
      <!-- #docregion translated-plural -->
      <trans-unit id="5a134dee893586d02bffc9611056b9cadf9abfad" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes} }</target>
      </trans-unit>
      <!-- #enddocregion translated-plural -->
      <!-- #docregion translated-select -->
      <!-- #docregion translate-select-1 -->
      <trans-unit id="f99f34ac9bd4606345071bd813858dec29f3b7d1" datatype="html">
        <source>The author is <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></source>
        <target>L'auteur est <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-select-1 -->
      <!-- #docregion translate-select-2 -->
      <trans-unit id="eff74b75ab7364b6fa888f1cbfae901aaaf02295" datatype="html">
        <source>{VAR_SELECT, select, male {male} female {female} other {other} }</source>
        <target>{VAR_SELECT, select, male {un homme} female {une femme} other {autre} }</target>
      </trans-unit>
      <!-- #enddocregion translate-select-2 -->
      <!-- #enddocregion translated-select -->
      <!-- #docregion translate-nested -->
      <!-- #docregion translate-nested-1 -->
      <trans-unit id="972cb0cf3e442f7b1c00d7dab168ac08d6bdf20c" datatype="html">
        <source>Updated: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></source>
        <target>Mis à jour: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-nested-1 -->
      <!-- #docregion translate-nested-2 -->
      <trans-unit id="7151c2e67748b726f0864fc443861d45df21d706" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago by {VAR_SELECT, select, male {male} female {female} other {other} }} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes par {VAR_SELECT, select, male {un homme} female {une femme} other {autre} }} }</target>
      </trans-unit>
      <!-- #enddocregion translate-nested-2 -->
      <!-- #enddocregion translate-nested -->
      <!-- #docregion i18n-duplicate-custom-id -->
      <trans-unit id="myId" datatype="html">
        <source>Hello</source>
        <target state="new">Bonjour</target>
      </trans-unit>
      <!-- #enddocregion i18n-duplicate-custom-id -->
    </body>
  </file>
</xliff>

ВАЖНО: Не изменяйте ID единиц перевода. Каждый атрибут id генерируется Angular и зависит от содержимого текста компонента и назначенного значения (meaning).

Если вы измените текст или значение, атрибут id изменится. Подробнее об управлении обновлениями текста и ID см. в разделе пользовательские ID.

Перевод форм множественного числа

Добавляйте или удаляйте варианты множественного числа по мере необходимости для каждого языка.

ПОЛЕЗНО: Правила множественного числа для языков см. в CLDR plural rules.

Пример plural для minute

Чтобы перевести plural, переведите значения сопоставления формата ICU.

  • just now
  • one minute ago
  • <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago

Следующий пример показывает, как переводить.

src/locale/messages.fr.xlf ()

<!-- The `messages.fr.xlf` after translation for documentation purposes -->
<!-- #docregion -->
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  <file source-language="en" datatype="plaintext" original="ng2.template">
    <body>
      <!-- #docregion translated-hello-before -->
      <trans-unit id="introductionHeader" datatype="html">
        <source>Hello i18n!</source>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello-before -->
      <!-- #docregion translated-hello -->
      <!-- #docregion custom-id -->
      <trans-unit id="introductionHeader" datatype="html">
      <!-- #enddocregion custom-id -->
        <source>Hello i18n!</source>
        <target>Bonjour i18n !</target>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello -->
      <!-- #docregion translated-other-nodes -->
      <!-- #docregion generated-id -->
      <trans-unit id="ba0cc104d3d69bf669f97b8d96a4c5d8d9559aa3" datatype="html">
      <!-- #enddocregion generated-id -->
        <source>I don&apos;t output any element</source>
        <target>Je n'affiche aucun élément</target>
      </trans-unit>
      <trans-unit id="701174153757adf13e7c24a248c8a873ac9f5193" datatype="html">
        <source>Angular logo</source>
        <target>Logo d'Angular</target>
      </trans-unit>
      <!-- #enddocregion translated-other-nodes -->
      <!-- #docregion translated-plural -->
      <trans-unit id="5a134dee893586d02bffc9611056b9cadf9abfad" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes} }</target>
      </trans-unit>
      <!-- #enddocregion translated-plural -->
      <!-- #docregion translated-select -->
      <!-- #docregion translate-select-1 -->
      <trans-unit id="f99f34ac9bd4606345071bd813858dec29f3b7d1" datatype="html">
        <source>The author is <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></source>
        <target>L'auteur est <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-select-1 -->
      <!-- #docregion translate-select-2 -->
      <trans-unit id="eff74b75ab7364b6fa888f1cbfae901aaaf02295" datatype="html">
        <source>{VAR_SELECT, select, male {male} female {female} other {other} }</source>
        <target>{VAR_SELECT, select, male {un homme} female {une femme} other {autre} }</target>
      </trans-unit>
      <!-- #enddocregion translate-select-2 -->
      <!-- #enddocregion translated-select -->
      <!-- #docregion translate-nested -->
      <!-- #docregion translate-nested-1 -->
      <trans-unit id="972cb0cf3e442f7b1c00d7dab168ac08d6bdf20c" datatype="html">
        <source>Updated: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></source>
        <target>Mis à jour: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-nested-1 -->
      <!-- #docregion translate-nested-2 -->
      <trans-unit id="7151c2e67748b726f0864fc443861d45df21d706" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago by {VAR_SELECT, select, male {male} female {female} other {other} }} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes par {VAR_SELECT, select, male {un homme} female {une femme} other {autre} }} }</target>
      </trans-unit>
      <!-- #enddocregion translate-nested-2 -->
      <!-- #enddocregion translate-nested -->
      <!-- #docregion i18n-duplicate-custom-id -->
      <trans-unit id="myId" datatype="html">
        <source>Hello</source>
        <target state="new">Bonjour</target>
      </trans-unit>
      <!-- #enddocregion i18n-duplicate-custom-id -->
    </body>
  </file>
</xliff>

Перевод альтернативных выражений

Angular также извлекает альтернативные выражения ICU select как отдельные единицы перевода.

Пример select для gender

Следующий пример показывает выражение ICU select в шаблоне компонента.

app.component.html

<span i18n>The author is {gender, select, male {male} female {female} other {other}}</span>

В этом примере Angular извлекает выражение в две единицы перевода. Первая содержит текст за пределами условия select и использует заполнитель для select (<x id="ICU">):

src/locale/messages.fr.xlf ()

<!-- The `messages.fr.xlf` after translation for documentation purposes -->
<!-- #docregion -->
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  <file source-language="en" datatype="plaintext" original="ng2.template">
    <body>
      <!-- #docregion translated-hello-before -->
      <trans-unit id="introductionHeader" datatype="html">
        <source>Hello i18n!</source>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello-before -->
      <!-- #docregion translated-hello -->
      <!-- #docregion custom-id -->
      <trans-unit id="introductionHeader" datatype="html">
      <!-- #enddocregion custom-id -->
        <source>Hello i18n!</source>
        <target>Bonjour i18n !</target>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello -->
      <!-- #docregion translated-other-nodes -->
      <!-- #docregion generated-id -->
      <trans-unit id="ba0cc104d3d69bf669f97b8d96a4c5d8d9559aa3" datatype="html">
      <!-- #enddocregion generated-id -->
        <source>I don&apos;t output any element</source>
        <target>Je n'affiche aucun élément</target>
      </trans-unit>
      <trans-unit id="701174153757adf13e7c24a248c8a873ac9f5193" datatype="html">
        <source>Angular logo</source>
        <target>Logo d'Angular</target>
      </trans-unit>
      <!-- #enddocregion translated-other-nodes -->
      <!-- #docregion translated-plural -->
      <trans-unit id="5a134dee893586d02bffc9611056b9cadf9abfad" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes} }</target>
      </trans-unit>
      <!-- #enddocregion translated-plural -->
      <!-- #docregion translated-select -->
      <!-- #docregion translate-select-1 -->
      <trans-unit id="f99f34ac9bd4606345071bd813858dec29f3b7d1" datatype="html">
        <source>The author is <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></source>
        <target>L'auteur est <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-select-1 -->
      <!-- #docregion translate-select-2 -->
      <trans-unit id="eff74b75ab7364b6fa888f1cbfae901aaaf02295" datatype="html">
        <source>{VAR_SELECT, select, male {male} female {female} other {other} }</source>
        <target>{VAR_SELECT, select, male {un homme} female {une femme} other {autre} }</target>
      </trans-unit>
      <!-- #enddocregion translate-select-2 -->
      <!-- #enddocregion translated-select -->
      <!-- #docregion translate-nested -->
      <!-- #docregion translate-nested-1 -->
      <trans-unit id="972cb0cf3e442f7b1c00d7dab168ac08d6bdf20c" datatype="html">
        <source>Updated: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></source>
        <target>Mis à jour: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-nested-1 -->
      <!-- #docregion translate-nested-2 -->
      <trans-unit id="7151c2e67748b726f0864fc443861d45df21d706" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago by {VAR_SELECT, select, male {male} female {female} other {other} }} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes par {VAR_SELECT, select, male {un homme} female {une femme} other {autre} }} }</target>
      </trans-unit>
      <!-- #enddocregion translate-nested-2 -->
      <!-- #enddocregion translate-nested -->
      <!-- #docregion i18n-duplicate-custom-id -->
      <trans-unit id="myId" datatype="html">
        <source>Hello</source>
        <target state="new">Bonjour</target>
      </trans-unit>
      <!-- #enddocregion i18n-duplicate-custom-id -->
    </body>
  </file>
</xliff>

ВАЖНО: При переводе текста перемещайте заполнитель при необходимости, но не удаляйте его. Если вы удалите заполнитель, выражение ICU будет удалено из вашего переведенного приложения.

Следующий пример показывает вторую единицу перевода, содержащую условие select.

src/locale/messages.fr.xlf ()

<!-- The `messages.fr.xlf` after translation for documentation purposes -->
<!-- #docregion -->
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  <file source-language="en" datatype="plaintext" original="ng2.template">
    <body>
      <!-- #docregion translated-hello-before -->
      <trans-unit id="introductionHeader" datatype="html">
        <source>Hello i18n!</source>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello-before -->
      <!-- #docregion translated-hello -->
      <!-- #docregion custom-id -->
      <trans-unit id="introductionHeader" datatype="html">
      <!-- #enddocregion custom-id -->
        <source>Hello i18n!</source>
        <target>Bonjour i18n !</target>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello -->
      <!-- #docregion translated-other-nodes -->
      <!-- #docregion generated-id -->
      <trans-unit id="ba0cc104d3d69bf669f97b8d96a4c5d8d9559aa3" datatype="html">
      <!-- #enddocregion generated-id -->
        <source>I don&apos;t output any element</source>
        <target>Je n'affiche aucun élément</target>
      </trans-unit>
      <trans-unit id="701174153757adf13e7c24a248c8a873ac9f5193" datatype="html">
        <source>Angular logo</source>
        <target>Logo d'Angular</target>
      </trans-unit>
      <!-- #enddocregion translated-other-nodes -->
      <!-- #docregion translated-plural -->
      <trans-unit id="5a134dee893586d02bffc9611056b9cadf9abfad" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes} }</target>
      </trans-unit>
      <!-- #enddocregion translated-plural -->
      <!-- #docregion translated-select -->
      <!-- #docregion translate-select-1 -->
      <trans-unit id="f99f34ac9bd4606345071bd813858dec29f3b7d1" datatype="html">
        <source>The author is <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></source>
        <target>L'auteur est <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-select-1 -->
      <!-- #docregion translate-select-2 -->
      <trans-unit id="eff74b75ab7364b6fa888f1cbfae901aaaf02295" datatype="html">
        <source>{VAR_SELECT, select, male {male} female {female} other {other} }</source>
        <target>{VAR_SELECT, select, male {un homme} female {une femme} other {autre} }</target>
      </trans-unit>
      <!-- #enddocregion translate-select-2 -->
      <!-- #enddocregion translated-select -->
      <!-- #docregion translate-nested -->
      <!-- #docregion translate-nested-1 -->
      <trans-unit id="972cb0cf3e442f7b1c00d7dab168ac08d6bdf20c" datatype="html">
        <source>Updated: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></source>
        <target>Mis à jour: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-nested-1 -->
      <!-- #docregion translate-nested-2 -->
      <trans-unit id="7151c2e67748b726f0864fc443861d45df21d706" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago by {VAR_SELECT, select, male {male} female {female} other {other} }} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes par {VAR_SELECT, select, male {un homme} female {une femme} other {autre} }} }</target>
      </trans-unit>
      <!-- #enddocregion translate-nested-2 -->
      <!-- #enddocregion translate-nested -->
      <!-- #docregion i18n-duplicate-custom-id -->
      <trans-unit id="myId" datatype="html">
        <source>Hello</source>
        <target state="new">Bonjour</target>
      </trans-unit>
      <!-- #enddocregion i18n-duplicate-custom-id -->
    </body>
  </file>
</xliff>

Следующий пример показывает обе единицы перевода после завершения перевода.

src/locale/messages.fr.xlf ()

<!-- The `messages.fr.xlf` after translation for documentation purposes -->
<!-- #docregion -->
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  <file source-language="en" datatype="plaintext" original="ng2.template">
    <body>
      <!-- #docregion translated-hello-before -->
      <trans-unit id="introductionHeader" datatype="html">
        <source>Hello i18n!</source>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello-before -->
      <!-- #docregion translated-hello -->
      <!-- #docregion custom-id -->
      <trans-unit id="introductionHeader" datatype="html">
      <!-- #enddocregion custom-id -->
        <source>Hello i18n!</source>
        <target>Bonjour i18n !</target>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello -->
      <!-- #docregion translated-other-nodes -->
      <!-- #docregion generated-id -->
      <trans-unit id="ba0cc104d3d69bf669f97b8d96a4c5d8d9559aa3" datatype="html">
      <!-- #enddocregion generated-id -->
        <source>I don&apos;t output any element</source>
        <target>Je n'affiche aucun élément</target>
      </trans-unit>
      <trans-unit id="701174153757adf13e7c24a248c8a873ac9f5193" datatype="html">
        <source>Angular logo</source>
        <target>Logo d'Angular</target>
      </trans-unit>
      <!-- #enddocregion translated-other-nodes -->
      <!-- #docregion translated-plural -->
      <trans-unit id="5a134dee893586d02bffc9611056b9cadf9abfad" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes} }</target>
      </trans-unit>
      <!-- #enddocregion translated-plural -->
      <!-- #docregion translated-select -->
      <!-- #docregion translate-select-1 -->
      <trans-unit id="f99f34ac9bd4606345071bd813858dec29f3b7d1" datatype="html">
        <source>The author is <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></source>
        <target>L'auteur est <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-select-1 -->
      <!-- #docregion translate-select-2 -->
      <trans-unit id="eff74b75ab7364b6fa888f1cbfae901aaaf02295" datatype="html">
        <source>{VAR_SELECT, select, male {male} female {female} other {other} }</source>
        <target>{VAR_SELECT, select, male {un homme} female {une femme} other {autre} }</target>
      </trans-unit>
      <!-- #enddocregion translate-select-2 -->
      <!-- #enddocregion translated-select -->
      <!-- #docregion translate-nested -->
      <!-- #docregion translate-nested-1 -->
      <trans-unit id="972cb0cf3e442f7b1c00d7dab168ac08d6bdf20c" datatype="html">
        <source>Updated: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></source>
        <target>Mis à jour: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-nested-1 -->
      <!-- #docregion translate-nested-2 -->
      <trans-unit id="7151c2e67748b726f0864fc443861d45df21d706" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago by {VAR_SELECT, select, male {male} female {female} other {other} }} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes par {VAR_SELECT, select, male {un homme} female {une femme} other {autre} }} }</target>
      </trans-unit>
      <!-- #enddocregion translate-nested-2 -->
      <!-- #enddocregion translate-nested -->
      <!-- #docregion i18n-duplicate-custom-id -->
      <trans-unit id="myId" datatype="html">
        <source>Hello</source>
        <target state="new">Bonjour</target>
      </trans-unit>
      <!-- #enddocregion i18n-duplicate-custom-id -->
    </body>
  </file>
</xliff>

Перевод вложенных выражений

Angular обрабатывает вложенное выражение так же, как и альтернативное выражение. Angular извлекает выражение в две единицы перевода.

Пример вложенного plural

Следующий пример показывает первую единицу перевода, содержащую текст за пределами вложенного выражения.

src/locale/messages.fr.xlf ()

<!-- The `messages.fr.xlf` after translation for documentation purposes -->
<!-- #docregion -->
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  <file source-language="en" datatype="plaintext" original="ng2.template">
    <body>
      <!-- #docregion translated-hello-before -->
      <trans-unit id="introductionHeader" datatype="html">
        <source>Hello i18n!</source>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello-before -->
      <!-- #docregion translated-hello -->
      <!-- #docregion custom-id -->
      <trans-unit id="introductionHeader" datatype="html">
      <!-- #enddocregion custom-id -->
        <source>Hello i18n!</source>
        <target>Bonjour i18n !</target>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello -->
      <!-- #docregion translated-other-nodes -->
      <!-- #docregion generated-id -->
      <trans-unit id="ba0cc104d3d69bf669f97b8d96a4c5d8d9559aa3" datatype="html">
      <!-- #enddocregion generated-id -->
        <source>I don&apos;t output any element</source>
        <target>Je n'affiche aucun élément</target>
      </trans-unit>
      <trans-unit id="701174153757adf13e7c24a248c8a873ac9f5193" datatype="html">
        <source>Angular logo</source>
        <target>Logo d'Angular</target>
      </trans-unit>
      <!-- #enddocregion translated-other-nodes -->
      <!-- #docregion translated-plural -->
      <trans-unit id="5a134dee893586d02bffc9611056b9cadf9abfad" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes} }</target>
      </trans-unit>
      <!-- #enddocregion translated-plural -->
      <!-- #docregion translated-select -->
      <!-- #docregion translate-select-1 -->
      <trans-unit id="f99f34ac9bd4606345071bd813858dec29f3b7d1" datatype="html">
        <source>The author is <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></source>
        <target>L'auteur est <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-select-1 -->
      <!-- #docregion translate-select-2 -->
      <trans-unit id="eff74b75ab7364b6fa888f1cbfae901aaaf02295" datatype="html">
        <source>{VAR_SELECT, select, male {male} female {female} other {other} }</source>
        <target>{VAR_SELECT, select, male {un homme} female {une femme} other {autre} }</target>
      </trans-unit>
      <!-- #enddocregion translate-select-2 -->
      <!-- #enddocregion translated-select -->
      <!-- #docregion translate-nested -->
      <!-- #docregion translate-nested-1 -->
      <trans-unit id="972cb0cf3e442f7b1c00d7dab168ac08d6bdf20c" datatype="html">
        <source>Updated: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></source>
        <target>Mis à jour: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-nested-1 -->
      <!-- #docregion translate-nested-2 -->
      <trans-unit id="7151c2e67748b726f0864fc443861d45df21d706" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago by {VAR_SELECT, select, male {male} female {female} other {other} }} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes par {VAR_SELECT, select, male {un homme} female {une femme} other {autre} }} }</target>
      </trans-unit>
      <!-- #enddocregion translate-nested-2 -->
      <!-- #enddocregion translate-nested -->
      <!-- #docregion i18n-duplicate-custom-id -->
      <trans-unit id="myId" datatype="html">
        <source>Hello</source>
        <target state="new">Bonjour</target>
      </trans-unit>
      <!-- #enddocregion i18n-duplicate-custom-id -->
    </body>
  </file>
</xliff>

Следующий пример показывает вторую единицу перевода, содержащую полное вложенное выражение.

src/locale/messages.fr.xlf ()

<!-- The `messages.fr.xlf` after translation for documentation purposes -->
<!-- #docregion -->
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  <file source-language="en" datatype="plaintext" original="ng2.template">
    <body>
      <!-- #docregion translated-hello-before -->
      <trans-unit id="introductionHeader" datatype="html">
        <source>Hello i18n!</source>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello-before -->
      <!-- #docregion translated-hello -->
      <!-- #docregion custom-id -->
      <trans-unit id="introductionHeader" datatype="html">
      <!-- #enddocregion custom-id -->
        <source>Hello i18n!</source>
        <target>Bonjour i18n !</target>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello -->
      <!-- #docregion translated-other-nodes -->
      <!-- #docregion generated-id -->
      <trans-unit id="ba0cc104d3d69bf669f97b8d96a4c5d8d9559aa3" datatype="html">
      <!-- #enddocregion generated-id -->
        <source>I don&apos;t output any element</source>
        <target>Je n'affiche aucun élément</target>
      </trans-unit>
      <trans-unit id="701174153757adf13e7c24a248c8a873ac9f5193" datatype="html">
        <source>Angular logo</source>
        <target>Logo d'Angular</target>
      </trans-unit>
      <!-- #enddocregion translated-other-nodes -->
      <!-- #docregion translated-plural -->
      <trans-unit id="5a134dee893586d02bffc9611056b9cadf9abfad" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes} }</target>
      </trans-unit>
      <!-- #enddocregion translated-plural -->
      <!-- #docregion translated-select -->
      <!-- #docregion translate-select-1 -->
      <trans-unit id="f99f34ac9bd4606345071bd813858dec29f3b7d1" datatype="html">
        <source>The author is <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></source>
        <target>L'auteur est <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-select-1 -->
      <!-- #docregion translate-select-2 -->
      <trans-unit id="eff74b75ab7364b6fa888f1cbfae901aaaf02295" datatype="html">
        <source>{VAR_SELECT, select, male {male} female {female} other {other} }</source>
        <target>{VAR_SELECT, select, male {un homme} female {une femme} other {autre} }</target>
      </trans-unit>
      <!-- #enddocregion translate-select-2 -->
      <!-- #enddocregion translated-select -->
      <!-- #docregion translate-nested -->
      <!-- #docregion translate-nested-1 -->
      <trans-unit id="972cb0cf3e442f7b1c00d7dab168ac08d6bdf20c" datatype="html">
        <source>Updated: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></source>
        <target>Mis à jour: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-nested-1 -->
      <!-- #docregion translate-nested-2 -->
      <trans-unit id="7151c2e67748b726f0864fc443861d45df21d706" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago by {VAR_SELECT, select, male {male} female {female} other {other} }} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes par {VAR_SELECT, select, male {un homme} female {une femme} other {autre} }} }</target>
      </trans-unit>
      <!-- #enddocregion translate-nested-2 -->
      <!-- #enddocregion translate-nested -->
      <!-- #docregion i18n-duplicate-custom-id -->
      <trans-unit id="myId" datatype="html">
        <source>Hello</source>
        <target state="new">Bonjour</target>
      </trans-unit>
      <!-- #enddocregion i18n-duplicate-custom-id -->
    </body>
  </file>
</xliff>

Следующий пример показывает обе единицы перевода после перевода.

src/locale/messages.fr.xlf ()

<!-- The `messages.fr.xlf` after translation for documentation purposes -->
<!-- #docregion -->
<?xml version="1.0" encoding="UTF-8" ?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
  <file source-language="en" datatype="plaintext" original="ng2.template">
    <body>
      <!-- #docregion translated-hello-before -->
      <trans-unit id="introductionHeader" datatype="html">
        <source>Hello i18n!</source>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello-before -->
      <!-- #docregion translated-hello -->
      <!-- #docregion custom-id -->
      <trans-unit id="introductionHeader" datatype="html">
      <!-- #enddocregion custom-id -->
        <source>Hello i18n!</source>
        <target>Bonjour i18n !</target>
        <note priority="1" from="description">An introduction header for this sample</note>
        <note priority="1" from="meaning">User welcome</note>
      </trans-unit>
      <!-- #enddocregion translated-hello -->
      <!-- #docregion translated-other-nodes -->
      <!-- #docregion generated-id -->
      <trans-unit id="ba0cc104d3d69bf669f97b8d96a4c5d8d9559aa3" datatype="html">
      <!-- #enddocregion generated-id -->
        <source>I don&apos;t output any element</source>
        <target>Je n'affiche aucun élément</target>
      </trans-unit>
      <trans-unit id="701174153757adf13e7c24a248c8a873ac9f5193" datatype="html">
        <source>Angular logo</source>
        <target>Logo d'Angular</target>
      </trans-unit>
      <!-- #enddocregion translated-other-nodes -->
      <!-- #docregion translated-plural -->
      <trans-unit id="5a134dee893586d02bffc9611056b9cadf9abfad" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes} }</target>
      </trans-unit>
      <!-- #enddocregion translated-plural -->
      <!-- #docregion translated-select -->
      <!-- #docregion translate-select-1 -->
      <trans-unit id="f99f34ac9bd4606345071bd813858dec29f3b7d1" datatype="html">
        <source>The author is <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></source>
        <target>L'auteur est <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-select-1 -->
      <!-- #docregion translate-select-2 -->
      <trans-unit id="eff74b75ab7364b6fa888f1cbfae901aaaf02295" datatype="html">
        <source>{VAR_SELECT, select, male {male} female {female} other {other} }</source>
        <target>{VAR_SELECT, select, male {un homme} female {une femme} other {autre} }</target>
      </trans-unit>
      <!-- #enddocregion translate-select-2 -->
      <!-- #enddocregion translated-select -->
      <!-- #docregion translate-nested -->
      <!-- #docregion translate-nested-1 -->
      <trans-unit id="972cb0cf3e442f7b1c00d7dab168ac08d6bdf20c" datatype="html">
        <source>Updated: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></source>
        <target>Mis à jour: <x id="ICU" equiv-text="{minutes, plural, =0 {...} =1 {...} other {...}}"/></target>
      </trans-unit>
      <!-- #enddocregion translate-nested-1 -->
      <!-- #docregion translate-nested-2 -->
      <trans-unit id="7151c2e67748b726f0864fc443861d45df21d706" datatype="html">
        <source>{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other {<x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes ago by {VAR_SELECT, select, male {male} female {female} other {other} }} }</source>
        <target>{VAR_PLURAL, plural, =0 {à l'instant} =1 {il y a une minute} other {il y a <x id="INTERPOLATION" equiv-text="{{minutes}}"/> minutes par {VAR_SELECT, select, male {un homme} female {une femme} other {autre} }} }</target>
      </trans-unit>
      <!-- #enddocregion translate-nested-2 -->
      <!-- #enddocregion translate-nested -->
      <!-- #docregion i18n-duplicate-custom-id -->
      <trans-unit id="myId" datatype="html">
        <source>Hello</source>
        <target state="new">Bonjour</target>
      </trans-unit>
      <!-- #enddocregion i18n-duplicate-custom-id -->
    </body>
  </file>
</xliff>

Что дальше