Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>i18n View AngularNew to Visual Studio Code? Get it now.
i18n View Angular

i18n View Angular

Jaheem Harris

|
2 installs
| (0) | Free
Inspect, preview, and navigate ngx-translate keys in Angular templates and TypeScript.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

i18n View Angular

Inspect, preview, and navigate ngx-translate keys directly from Angular HTML templates and TypeScript source files.

<h4 class="card-title__text">
  {{ 'tickets.settings.card_title' | translate }}
</h4>
this.translate.instant('common.header.tooltips.report.content');

The extension underlines recognized keys, shows every configured locale in a hover table, and opens the matching JSON property in the right locale file.

Features

  • Detects static keys used with the translate pipe:
    • {{ 'tickets.settings.card_title' | translate }}
    • {{ "tickets.settings.card_title" | translate }}
    • Attribute bindings such as [placeholder]="'form.name' | translate"
  • Detects static keys passed to TranslateService.instant() in TypeScript:
    • this.translate.instant('common.header.tooltips.report.content')
    • translate.instant("common.header.tooltips.report.content")
    • this.translate?.instant('common.header.tooltips.report.content')
    • this.translate.instant?.('common.header.tooltips.report.content')
  • Identifies TranslateService constructor injection, typed properties, and inject(TranslateService) fields or variables.
  • Underlines recognized keys without modifying source files.
  • Shows all configured translations in a Markdown hover, including missing-file and missing-key states.
  • Ctrl+click / Cmd+click (or Go to Definition) opens the key in the default locale.
  • Hover actions open the default locale, edit a translation, or open any configured locale.
  • Supports both global and namespaced translation layouts, multiple translation directories, and multi-root workspaces.
  • Caches parsed JSON files, invalidates them on file changes, and reflects unsaved translation documents.
  • Watches the configuration file and translation directories.

Supported translation patterns

Angular HTML templates

{{ 'tickets.settings.card_title' | translate }}
{{ "tickets.settings.card_title" | translate }}
<input [placeholder]="'form.name' | translate" />

TypeScript TranslateService.instant()

this.translate.instant('common.header.tooltips.report.content');
translate.instant('common.header.tooltips.report.content');
this.translate.instant("common.header.tooltips.report.content");
this.translate?.instant('common.header.tooltips.report.content');
this.translate.instant?.('common.header.tooltips.report.content');
this.translate?.instant?.('common.header.tooltips.report.content');
this.translate.instant('common.header.tooltips.report.content', params);

The service can be declared with common Angular injection styles:

constructor(private translate: TranslateService) {}
private translate = inject(TranslateService);
readonly translate = inject(TranslateService);

The extension also recognizes typed parameters, typed class properties, local variables, aliased TranslateService imports, and additional arguments after the key. If static type information is unavailable, it falls back conservatively to common receiver names such as translate and translateService when the file imports TranslateService from @ngx-translate/core.

Configuration

Create i18n-view-angular.config.json at the workspace folder root, or run i18n View Angular: Setup Configuration from the Command Palette.

{
  "locales": ["en", "fr", "ca", "mg"],
  "defaultLocale": "en",
  "localesPaths": ["src/assets/i18n"],
  "translationMode": "namespaced",
  "pathMatcher": "{namespaces}/{locale}.json"
}
Property Description
locales Locale identifiers used in hover output and navigation.
defaultLocale Locale opened by Ctrl+click and the default hover action.
localesPaths One or more translation directories, relative to the workspace folder. Absolute paths are also accepted.
translationMode global (one file per locale) or namespaced (one file per namespace and locale).
pathMatcher Path template using {locale} and, for namespaced files, {namespaces}.

Global layout

{
  "translationMode": "global",
  "pathMatcher": "{locale}.json"
}
src/assets/i18n/
├── en.json
├── fr.json
└── ca.json

The full key is resolved at once: tickets.settings.card_title looks up tickets → settings → card_title inside en.json.

Namespaced layout

{
  "translationMode": "namespaced",
  "pathMatcher": "{namespaces}/{locale}.json"
}
src/assets/i18n/
├── tickets/
│   ├── en.json
│   └── fr.json
└── home/
    ├── en.json
    └── fr.json

For tickets.settings.card_title:

  • Namespace: tickets
  • Property path: settings.card_title
  • File: src/assets/i18n/tickets/en.json

The first key segment is used as the namespace. If that file does not contain the key, longer namespace prefixes are tried as a fallback, so nested namespace directories such as tickets/settings/en.json also work.

If pathMatcher has no {namespaces} placeholder in namespaced mode, all keys are read from one file per locale using the full nested key path.

Commands

Command Description
i18n-view-angular.setup Create the configuration file interactively.
i18n-view-angular.reload Reload configuration, translation data, and decorations.
i18n-view-angular.openDefaultLocale Open the key under the cursor in the default locale.
i18n-view-angular.openLocale Pick a locale and open the key under the cursor.

Commands are available in the Command Palette with the i18n View Angular category. When the cursor is not on a key, the open commands offer a quick pick of keys found in the active template or TypeScript file.

How it works

  • Translation detection is split by source type, then shared:
    • Angular HTML detection finds a quoted string followed by the translate pipe.
    • TypeScript detection uses a lightweight tokenizer rather than a whole-file regular expression. It scans member calls, string literals, comments, template literals, and regex literals, identifies TranslateService imports and injection patterns, and records the exact string-literal range.
  • Dynamic HTML expressions and dynamic TypeScript keys are ignored.
  • Hover, decorations, and navigation share the same detected key occurrences and run for .html and .ts files.
  • The extension caches parsed JSON and property locations. A file is read only when a key resolves to it; caches are invalidated by file watchers and document edits. Detected source keys are cached per document version as well.
  • Navigation computes the exact JSON property position, so the editor opens at the key rather than at the top of the file.
  • Missing files, missing keys, invalid JSON, and read errors are reported in the hover table and through actionable warning messages.

Development

npm install
npm run compile      # type check, lint, and bundle with esbuild
npm run test:unit    # fast unit tests (no VS Code instance required)
npm test             # VS Code integration test runner

Press F5 in VS Code to launch an Extension Development Host.

Project structure

src/
├── angular/keyDetector.ts          # static translation pipe detection
├── detection/documentTranslationKeys.ts # HTML/TypeScript dispatch and cache
├── detection/typescript/           # tokenizer and TranslateService detection
├── config/config.ts                # loading and validation
├── i18n/pathMatcher.ts             # locale/namespace path resolution
├── i18n/jsonLocator.ts             # JSON parsing with property positions
├── i18n/resolver.ts                # global and namespaced key resolution
├── i18n/translationCache.ts        # parsed-file cache, incl. unsaved documents
├── i18n/service.ts                 # workspace contexts, watchers, and reloads
├── providers/                      # hover and go-to-definition providers
├── ui/decorationManager.ts         # underline decorations
├── ui/markdown.ts                  # hover content and command links
├── commands.ts                     # setup, reload, and open commands
└── extension.ts                    # activation and wiring

The UX was informed by inspecting the installed lokalise.i18n-ally extension (ngx-translate usage regex, underline annotations, hover command links, and definition-provider navigation) while keeping this extension focused and small.

Limitations

  • Only static single- and double-quoted translation keys are detected; dynamic keys, concatenated strings, template literals, and computed expressions are out of scope.
  • TypeScript detection only supports direct TranslateService.instant() calls. Other programmatic APIs such as get() and stream() are not detected.
  • TypeScript inline Angular component templates are out of scope.
  • Hover and navigation run for .html and .ts files. .tsx files are not scanned.
  • TypeScript detection is conservative when type information is incomplete and only falls back to common receiver names such as translate and translateService.
  • Translation files must be JSON.
  • Keys are resolved case-sensitively.
  • Only one translation layout is configured per workspace folder.
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft