massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-json / node_modules / vscode-json-languageservice / node_modules / vscode-nls / README.md
1 # vscode-nls
2
3
4 CommonJS module to support externalization and localization. The module only depends on Node.js however its
5 primary use case is for VSCode extensions.
6
7 [![Build Status](https://travis-ci.org/Microsoft/vscode-nls.svg?branch=master)](https://travis-ci.org/Microsoft/vscode-nls)
8 [![NPM Version](https://img.shields.io/npm/v/vscode-nls.svg)](https://npmjs.org/package/vscode-nls)
9 [![NPM Downloads](https://img.shields.io/npm/dm/vscode-nls.svg)](https://npmjs.org/package/vscode-nls)
10
11 ## Usage
12
13 ```typescript
14 import * as nls from 'vscode-nls';
15
16 let localize = nls.config({ locale: 'de-DE' })();
17
18 console.log(localize('keyOne', "Hello World"));
19 console.log(localize('keyTwo', "Current Date {0}", Date.now()));
20 ```
21
22 The `config` call configures the nls module and should only be called once in the applications entry point. You pass in the locale you want to use and whether the resolved locale should be cached for all further calls. The config call returns a function which is used to load a message bundle. During development time the argument should stay empty. There is another tool that helps extracting the message from your sources and it creates the message bundles autmatically for you. The tool is available [here](https://github.com/Microsoft/vscode-nls-dev).
23
24 In secondary modules loaded from the 'main' module no configuration is necessary. However you still need to load the nls module and load the message bundle. This looks like this:
25
26 ```typescript
27 import * as nls from 'vscode-nls';
28
29 let localize = nls.loadMessageBundle();
30
31 console.log(localize('keyOne', "Hello World"));
32 ```
33
34 During development time the strings in the code are presented to the user. If the locale is set to 'pseudo' the messages are modified in the following form:
35
36 * vowels are doubled
37 * the string is prefixed with '\uFF3B' (Unicode zenkaku representation for [) and postfixed with '\uFF3D' (Unicode zenkaku representation for ])
38
39 ## History
40
41 ### 5.0.0
42
43 * Split code into common, node and browser to support using vscode-nls in a Web browser. This is a breaking change and need adoption since the default exports of the module are only exporting the common types. To import the node specific part use `vscode-nls\node`. To use the browser specific part import `vscode-nls\browser`.
44
45 The browser specific part currently does only support a default language inline in code. There is no support yet to load a different language bundle during runtime. However the split allows to web pack the `vscode-nls` module.
46
47 ### 4.1.1
48
49 * Fixes [Bundled nls doesn't work](https://github.com/microsoft/vscode-nls/issues/23)
50
51 ### 4.1.0
52
53 * support language and locale when resolving options from `VSCODE_NLS_CONFIG` setting.
54
55 ### 4.0.0
56
57 * make vscode-nls webpack friendly (removal of require calls)
58 * narrow type for var args in `localize` function to `string | number | boolean | null | undefined`
59
60 ### 3.0.0:
61
62 * added support to bundle the strings into a single `nls.bundle(.${locale})?.json` file.
63 * added support for VS Code language packs.
64
65 ### 2.0.2:
66
67 * moved to TypeScript 2.1.5. Adapted to @types d.ts files instead of including typings directly into the repository.
68
69 ### 2.0.1:
70
71 * based on TypeScritp 2.0. Since TS changed the shape of the d.ts files for 2.0.x a major version number got introduce to not
72   break existing clients using TypeScript 1.8.x.
73
74 ## LICENSE
75 [MIT](LICENSE)