Skip to content

Commit bae67c0

Browse files
msivasubramaniaandatho7561
authored andcommitted
send vscode configured language to LS
1 parent 84d4516 commit bae67c0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/extension.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*--------------------------------------------------------------------------------------------*/
77
'use strict';
88

9-
import { workspace, ExtensionContext, extensions, window, commands, Uri, ConfigurationTarget } from 'vscode';
9+
import { workspace, ExtensionContext, extensions, window, commands, Uri, ConfigurationTarget, env } from 'vscode';
1010
import {
1111
CommonLanguageClient,
1212
LanguageClientOptions,
@@ -113,6 +113,9 @@ export function startClient(
113113
): SchemaExtensionAPI {
114114
const telemetryErrorHandler = new TelemetryErrorHandler(runtime.telemetry, lsName, 4);
115115
const outputChannel = window.createOutputChannel(lsName);
116+
const l10nPath = context.asAbsolutePath('../yaml-language-server/l10n');
117+
const supportedLanguages = ['de', 'fr', 'ja', 'ko', 'zh-cn', 'zh-tw'];
118+
const locale = supportedLanguages.includes(env.language) ? env.language : 'en';
116119
// Options to control the language client
117120
const clientOptions: LanguageClientOptions = {
118121
// Register the server for on disk and newly created YAML documents
@@ -129,6 +132,10 @@ export function startClient(
129132
revealOutputChannelOn: RevealOutputChannelOn.Never,
130133
errorHandler: telemetryErrorHandler,
131134
outputChannel: new TelemetryOutputChannel(outputChannel, runtime.telemetry),
135+
initializationOptions: {
136+
l10nPath,
137+
locale,
138+
},
132139
};
133140

134141
// Create the language client and start it

0 commit comments

Comments
 (0)