Skip to content

Commit fdf6899

Browse files
committed
Fix inability to change language while code-server is running
1 parent 2b0725a commit fdf6899

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

patches/display-language.diff

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ We can remove this once upstream supports all language packs.
1212
5. Add the locale flag.
1313
6. Remove the redundant locale verification. It does the same as the existing
1414
one but is worse because it does not handle non-existent or empty files.
15+
7. Replace some caching and Node requires because code-server does not restart
16+
when changing the language unlike native Code.
1517

1618
Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
1719
===================================================================
@@ -312,3 +314,18 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/localization/electron-san
312314
await this.jsonEditingService.write(this.environmentService.argvResource, [{ path: ['locale'], value: locale }], true);
313315
return true;
314316
}
317+
Index: code-server/lib/vscode/src/vs/base/node/languagePacks.js
318+
===================================================================
319+
--- code-server.orig/lib/vscode/src/vs/base/node/languagePacks.js
320+
+++ code-server/lib/vscode/src/vs/base/node/languagePacks.js
321+
@@ -73,7 +73,9 @@
322+
function getLanguagePackConfigurations(userDataPath) {
323+
const configFile = path.join(userDataPath, 'languagepacks.json');
324+
try {
325+
- return nodeRequire(configFile);
326+
+ // This must not use Node otherwise it will be cached. code-server does
327+
+ // not restart so this would never update.
328+
+ return JSON.parse(fs.readFileSync(configFile, "utf8"));
329+
} catch (err) {
330+
// Do nothing. If we can't read the file we have no
331+
// language pack config.

0 commit comments

Comments
 (0)