Gathering detailed insights and metrics for @vscode/l10n
Gathering detailed insights and metrics for @vscode/l10n
Gathering detailed insights and metrics for @vscode/l10n
Gathering detailed insights and metrics for @vscode/l10n
npm install @vscode/l10n
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
66 Stars
164 Commits
14 Forks
8 Watching
13 Branches
10,000 Contributors
Updated on 22 Nov 2024
Minified
Minified + Gzipped
TypeScript (95.85%)
JavaScript (3.51%)
HTML (0.64%)
Cumulative downloads
Total Downloads
Last day
-5.4%
169,319
Compared to previous day
Last week
2.5%
1,010,929
Compared to previous week
Last month
8.3%
4,252,920
Compared to previous month
Last year
325%
36,389,917
Compared to previous year
This repository contains tooling for localizing Visual Studio Code extensions. Localization for VS Code extension's source code has 4 important parts:
vscode.l10n.t
- The API for translating strings in your extension's code@vscode/l10n-dev
- The tooling used for extracting l10n strings from vscode extensions and working with XLF files@vscode/l10n
- The library used for loading the translations into subprocesses of your extensionpackage.nls.json
- The file used for translating static contributions in your extension's package.json
Additionally, for a sample of how to use these tools, see the l10n-sample in the vscode-extension-samples repo.
vscode.l10n.t
This API, introduced in VS Code 1.73, is used for translating strings in your extension's code. It is a part of the main VS Code extension API and is further documented here.
Note
Make sure you your VS Code engine and
@types/vscode
version in your extension manifest is at least^1.73.0
.
@vscode/l10n-dev
Tooling used for extracting l10n
strings from vscode extensions and working with XLF files. See it's dedicated README for usage instructions.
@vscode/l10n
Library used for loading the translations into subprocesses of your extension. See it's dedicated README for usage instructions.
Note
You should NOT use this library in your extension's main process. The translations are loaded into the main process by VS Code itself.
package.nls.json
This file, along with package.nls.{locale}.json
files, are used for translating static contributions in your extension's package.json
. Here's an example:
Your ./package.json
:
1{ 2 "name": "my-extension", 3 "version": "0.0.1", 4 "main": "./out/extension.js", 5 "l10n": "./l10n", 6 //... 7 "contributes": { 8 "commands": [ 9 { 10 "command": "my-extension.helloWorld", 11 // The key is surrounded by % characters 12 "title": "%my-extension.helloWorld.title%" 13 } 14 ] 15 } 16}
Your ./package.nls.json
:
1{ 2 // That same key from the package.json 3 "my-extension.helloWorld.title": "Hello World" 4}
Your ./package.nls.de.json
:
1{ 2 // That same key from the package.json 3 "my-extension.helloWorld.title": "Hallo Welt" 4}
VS Code will automatically load the correct package.nls.{locale}.json
(or package.nls.json
for English) file based on the locale of the user. If no translation is available for a given key, VS Code will fall back to the English translation.
Note
@vscode/l10n-dev has some tooling around these files (converting them to XLIFF files, generating Pseudo-Localization files, etc.) that you can use.
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
First, install all of the dependencies using npm install
.
If you plan on working with l10n-dev
it has one additional step. This package requires building the tree-sitter WASM files for the two grammars that we consume. To do this, you can run the following commands:
cd l10n-dev
npm run build-wasm
Note
On macOS or Windows, you will need to have Docker running in order to build the WASM files. The CLI runs a linux container to build the WASM files.
If you've done this correctly, you should see two .wasm
files in the l10n-dev
folder.
At this point you can run the build task in the repo to build in the background and run the tests with npm test
.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.
No vulnerabilities found.
No security vulnerabilities found.