1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-26 12:15:26 +00:00

Update locale file location

Should make language packs work again.
This commit is contained in:
Asher 2020-02-20 12:38:46 -06:00
parent c567a06ff5
commit 288e794c99
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
3 changed files with 22 additions and 17 deletions

View File

@ -457,18 +457,18 @@ class Builder {
}
let startingVscode = false
let startedVscode = false
onLine(vscode, (line, original) => {
console.log("[vscode]", original)
// Wait for watch-client since "Finished compilation" will appear multiple
// times before the client starts building.
if (!startingVscode && line.includes("Starting watch-client")) {
startingVscode = true
} else if (startingVscode && line.includes("Finished compilation") && process.env.AUTO_PATCH) {
cp.exec("yarn patch:generate", { cwd: this.rootPath }, (error, _, stderr) => {
if (error || stderr) {
console.error(error ? error.message : stderr)
}
})
} else if (startingVscode && line.includes("Finished compilation")) {
if (startedVscode) {
bundle.then(restartServer)
}
startedVscode = true
}
})

View File

@ -985,10 +985,10 @@ index 0000000000..56331ff1fc
+require('../../bootstrap-amd').load('vs/server/entry');
diff --git a/src/vs/server/ipc.d.ts b/src/vs/server/ipc.d.ts
new file mode 100644
index 0000000000..82566066ff
index 0000000000..a0d1d0df54
--- /dev/null
+++ b/src/vs/server/ipc.d.ts
@@ -0,0 +1,106 @@
@@ -0,0 +1,108 @@
+/**
+ * External interfaces for integration into code-server over IPC. No vs imports
+ * should be made in this file.
@ -1039,6 +1039,8 @@ index 0000000000..82566066ff
+ 'extra-extensions-dir'?: string[];
+ 'extra-builtin-extensions-dir'?: string[];
+
+ locale?: string
+
+ log?: string;
+ verbose?: boolean;
+
@ -1995,10 +1997,10 @@ index 0000000000..8956fc40d4
+};
diff --git a/src/vs/server/node/nls.ts b/src/vs/server/node/nls.ts
new file mode 100644
index 0000000000..61c79d0d80
index 0000000000..3d428a57d3
--- /dev/null
+++ b/src/vs/server/node/nls.ts
@@ -0,0 +1,86 @@
@@ -0,0 +1,88 @@
+import * as fs from 'fs';
+import * as path from 'path';
+import * as util from 'util';
@ -2052,13 +2054,15 @@ index 0000000000..61c79d0d80
+};
+
+export const getLocaleFromConfig = async (userDataPath: string): Promise<string> => {
+ let locale = 'en';
+ try {
+ const localeConfigUri = path.join(userDataPath, 'User/locale.json');
+ const content = stripComments(await util.promisify(fs.readFile)(localeConfigUri, 'utf8'));
+ locale = JSON.parse(content).locale;
+ } catch (error) { /* Ignore. */ }
+ return locale;
+ const files = ['locale.json', 'argv.json'];
+ for (let i = 0; i < files.length; ++i) {
+ try {
+ const localeConfigUri = path.join(userDataPath, 'User', files[i]);
+ const content = stripComments(await util.promisify(fs.readFile)(localeConfigUri, 'utf8'));
+ return JSON.parse(content).locale;
+ } catch (error) { /* Ignore. */ }
+ }
+ return 'en';
+};
+
+// Taken from src/main.js in the main VS Code source.

View File

@ -102,6 +102,7 @@ const options: Options<Required<Args>> = {
"install-extension": { type: "string[]" },
"uninstall-extension": { type: "string[]" },
locale: { type: "string" },
log: { type: LogLevel },
verbose: { type: "boolean", short: "vvv", description: "Enable verbose logging." },
}