Skip to content

Visual Studio Code extension that keeps angular i18n translation files (xliff 1.2, xliff 2 and xmb files) in sync, finds and adds missing translations

Notifications You must be signed in to change notification settings

manux54/vsc-angular-localization-helper

Repository files navigation

Angular Localization Helper

Visual Studio Code extension to help maintaining angular i18n localization files

Features

  • Merge @angular-cli generated file into existing localization file.
  • Search and highlight missing translations.
  • Currently support Xliff 1.2 and 2.0
  • Convert between Xliff 1.2 and 2.0 format
  • Upcoming support for Xmb files
  • Macbook Pro Touchbar support.

Installation

Install through VS Code extensions: search for Angular Localization Helper

Install through terminal: ext install angular-localization-helper

Usage

Generate/Update the base localization file using the angular-cli, then use the extension to merge the changes into a new or an existing translation file.

The extension will try to find corresponding translations units within an existing file for each units in the base file by searching units in the following order:

  1. By Id
  2. By Meaning & Source
  3. By Meaning & Description (optional)
  4. By Meaning (optional)

If no translation unit is found, the unit is added and tagged as missing.

The extension can convert translations files from one type to another. Simply generate the base file from the angular-cli with a new file type and then merge the translation files. They will be automatically changed to the new file type.

Using the Command Palette

  1. F1 or CMD + Shift + P to open the command palette
  2. Angular i18n: Sync

Using keyboard shortcut

  1. Ctrl + Windows + S or Ctrl + Cmd + S (default shortcut)

By default, the extension expects the base file to be named messages.xlf. If no corresponding file is found, you are prompted to identify the base file. This setting will be saved for future use. If the extension is invoked from a localization file, that file will be updated, otherwise the extension will prompt you for the file to update. You can also create a new file.

Find Missing Translations

Missing Translations are tagged and highlighted. You can use the extension to navigate between missing tranaslations

Using the Command Palette

  1. F1 or CMD + Shift + P to open the command palette
  2. Angular i18n: Next

Using keyboard shortcut

  1. Ctrl + Windows + N or Ctrl + Cmd + N (default shortcut)

On Macbook Pros the extension's commands appear on the touchbar within xlf files.

Extension Settings

i18nSync.baseFile (default: messages.xlf)

Identifies the base localization file generated by the @angular-cli. If file does not exist, you are prompted to identify the file and the setting is saved.

i18nSync.fileType (default: xlf)

Identify the type of localization to process (xlf or xmb)

i18nSync.missingTranslation (default: !MISSING_TRANSLATION!)

Target tag text for missing translation

i18nSync.decoration (default: dark red on yellow with white border)

Missing translation highlight decoration

Known Issues

  • Xmb format is not yet implemented
  • List missing translations is not yet implemented

Enjoy!

About

Visual Studio Code extension that keeps angular i18n translation files (xliff 1.2, xliff 2 and xmb files) in sync, finds and adds missing translations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published