Skip to content

VS Code extension for viewing localization & translations inline.

License

Notifications You must be signed in to change notification settings

quinton22/vscode-translations

Repository files navigation

Translations

This extension uses i18next to display localized text for translation keys in code.

Setup

Several translation backends are supported and can be used in conjunction by updating the order in Backend > List setting.

A backend must be selected, otherwise no translations will be loaded.

Additionally, the I18n Options settings are required unless the default suffices. I18n Options > Namespaces are the possible namespaces, and I18n Options > Supported Lngs are all the possible languages. Without these, the extension will not function properly.

Contentful

To enable Contentful backend, add contentful to the Backend > List setting. Then fill in all the required settings in Backend > Contentful Options.

File System

To enable File System backend, add fileSystem to the Backend > List setting. Add the load path according to the Backend > File System Options.

Features

  • Inline translations

    • at the end of the line

      Inline end of line translation

    • adjacent to the key

      Inline adjacent translation

  • Translation on hover showing all translated values

    Hover translation

Extension Settings

  • translations.hover
    • enabled: enable/disable display on hover over a localization key
  • translations.inline
    • enabled: enable/disable inline value of key in default language
    • position: position to show the value of the key, either end of line or adjacent to key
  • translations.backend
    • list: list of backends to use and the order in which to use them. Currently supports File System and Contentful. If more than one item exists in the list, the first will be primary and the rest used as a backup in the case of a missing key in the primary.
    • fileSystemOptions: options to pass to the file system backend, the following is required:
      • loadPath: the path from where to load translations. It contain {{lng}} and {{ns}}.
    • contentfulOptions: options to pass to the contentful backend, the following are required:
      • host: either https://cdn.contentful.com or https://preview.contentful.com
      • environment: "master" or another environment
      • space: the contentful space id to use
      • accessToken: the access token generated in Contentful settings.
  • translations.i18nOptions
    • namespaces: namespaces to search for translations
    • supportedLngs: list of all supported languages for translating purposes
    • defaultNs: default namespace for translations, will default to translation
    • fallbackLng: fallback language for translations, defaults to en-US

Known Issues

Release Notes

Releases

About

VS Code extension for viewing localization & translations inline.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published