VS Code Ext Localization

vscode-ext-localization skill for programming & development

An AI skill that generates localization infrastructure for VS Code extensions, creating translation files, string extraction utilities, and internationalization patterns that enable extensions to support multiple languages following VS Code localization standards.

What Is This?

Overview

This skill creates the localization setup for VS Code extensions. It generates the l10n directory structure, translation bundle files for target languages, string extraction from source code, and the integration code that loads the correct translations at runtime. The output follows VS Code's official localization API, using the vscode.l10n namespace for string resolution and supporting fallback chains when translations are missing.

Who Should Use This

Designed for VS Code extension developers who want to reach international users, teams publishing extensions to the marketplace that require multi-language support, and developers adding localization to existing extensions that were originally English only.

Why Use It?

Problems It Solves

Localizing a VS Code extension involves multiple moving parts: extracting translatable strings from code, creating bundle files in the correct format, wiring up the localization API, and handling package.json display strings. The VS Code l10n API has specific conventions that are easy to get wrong, resulting in strings that do not translate or fallbacks that show raw keys instead of readable text.

Core Highlights

  • String Extraction identifies all translatable strings in source code
  • Bundle Generation creates translation files in VS Code l10n format
  • API Integration generates code using the vscode.l10n API correctly
  • Package.json Localization translates extension name, description, and command titles
  • Fallback Handling configures proper fallback chains for missing translations

How to Use It?

Basic Usage

Run the skill against your extension source code to generate localization infrastructure.

// Before: hardcoded English strings
vscode.window.showInformationMessage("File saved successfully");
vscode.window.showErrorMessage("Failed to parse configuration");

// After: localized strings using vscode.l10n
import * as vscode from "vscode";

vscode.window.showInformationMessage(vscode.l10n.t("File saved successfully"));
vscode.window.showErrorMessage(vscode.l10n.t("Failed to parse configuration"));

Real-World Examples

Extension Marketplace Internationalization

A popular VS Code extension with 50,000 installs added support for Japanese, Chinese, and Spanish. The skill extracted 85 translatable strings, generated bundle files for each language, and created the l10n directory structure. After community translators filled in the bundles, the extension's marketplace listing and all UI strings appeared in the user's preferred language.

// Generated: l10n/bundle.l10n.ja.json
{
  "File saved successfully": "\u30d5\u30a1\u30a4\u30eb\u304c\u6b63\u5e38\u306b\u4fdd\u5b58\u3055\u308c\u307e\u3057\u305f",
  "Failed to parse configuration": "\u8a2d\u5b9a\u306e\u89e3\u6790\u306b\u5931\u6557\u3057\u307e\u3057\u305f",
  "Select a file to open": "\u958b\u304f\u30d5\u30a1\u30a4\u30eb\u3092\u9078\u629e",
  "No workspace folder open": "\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u30d5\u30a9\u30eb\u30c0\u30fc\u304c\u958b\u304b\u308c\u3066\u3044\u307e\u305b\u3093"
}

// Generated: package.nls.ja.json
{
  "extension.displayName": "My Extension",
  "command.formatFile": "\u30d5\u30a1\u30a4\u30eb\u3092\u30d5\u30a9\u30fc\u30de\u30c3\u30c8"
}

Advanced Tips

Use parameterized strings with vscode.l10n.t for dynamic content like file names and counts to give translators full sentence context. Run string extraction regularly to catch new untranslated strings. Set up a translation management workflow where community contributors can submit translations via pull requests.

When to Use It?

Use Cases

  • New Extension Setup add localization infrastructure from the start
  • Internationalization Retrofit add multi-language support to existing extensions
  • Marketplace Expansion reach non-English speaking VS Code users
  • Enterprise Extensions meet organizational requirements for language support
  • Community Translations generate bundle templates for community translators

Related Topics

When localizing VS Code extensions, these prompts activate the skill:

  • "Add localization to my VS Code extension"
  • "Generate translation files for my extension"
  • "Set up l10n for my VS Code extension"
  • "Extract translatable strings from my extension code"

Important Notes

Requirements

  • VS Code extension project with TypeScript source files
  • VS Code 1.73 or later for the l10n API support
  • Understanding of target languages for translation review
  • Extension manifest must declare l10n support in package.json

Usage Recommendations

Do:

  • Use vscode.l10n.t() for all user-facing strings including error messages
  • Include context comments for translators when strings are ambiguous
  • Test with each target language to verify string lengths fit the UI
  • Keep English as the default fallback language in source code

Don't:

  • Concatenate translated strings as word order varies between languages
  • Hardcode any user-visible text outside of the l10n system
  • Assume translations have the same length as English originals
  • Skip package.json localization since marketplace listings also need translation

Limitations

  • Generated translations use escape sequences and need native speaker review
  • Cannot translate context dependent strings without additional guidance
  • Some VS Code UI elements like settings descriptions have length constraints
  • Right-to-left language support may require additional layout adjustments