Skip to content

Commit 5a869a7

Browse files
feat: support --locale and --app-name
1 parent 4384a34 commit 5a869a7

File tree

6 files changed

+65
-0
lines changed

6 files changed

+65
-0
lines changed

src/code-server/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ VS Code in the browser
2828
| disableWorkspaceTrust | Disable Workspace Trust feature. This only affects the current session. | boolean | false |
2929
| extensions | Comma-separated list of VS Code extensions to install. Format: 'publisher.extension[@version]' (e.g., 'ms-python.python,ms-azuretools.vscode-docker'). | string | - |
3030
| host | The address to bind to for the code-server. Use '0.0.0.0' to listen on all interfaces. | string | 127.0.0.1 |
31+
| locale | Set VS Code display language and language shown on the login page. Format should be an IETF language tag (e.g., 'en', 'fr', 'zh-CN'). | string | - |
3132
| logFile | Path to a file to send stdout and stderr logs to from code-server. | string | /tmp/code-server.log |
3233
| port | The port to bind to for the code-server. | string | 8080 |
3334
| socket | Path to a socket. When specified, host and port will be ignored. | string | - |

src/code-server/devcontainer-feature.json

+10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"version": "1.0.0",
55
"description": "VS Code in the browser",
66
"options": {
7+
"appName": {
8+
"type": "string",
9+
"default": "",
10+
"description": "The name to use in branding. Will be shown in titlebar and welcome message."
11+
},
712
"auth": {
813
"type": "string",
914
"enum": ["password", "none"],
@@ -70,6 +75,11 @@
7075
"default": "127.0.0.1",
7176
"description": "The address to bind to for the code-server. Use '0.0.0.0' to listen on all interfaces."
7277
},
78+
"locale": {
79+
"type": "string",
80+
"default": "",
81+
"description": "Set VS Code display language and language shown on the login page. Format should be an IETF language tag (e.g., 'en', 'fr', 'zh-CN')."
82+
},
7383
"logFile": {
7484
"type": "string",
7585
"default": "/tmp/code-server.log",

src/code-server/install.sh

+8
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ if [[ -n "$SOCKETMODE" ]]; then
7575
FLAGS+=(--socket-mode "$SOCKETMODE")
7676
fi
7777

78+
if [[ -n "$LOCALE" ]]; then
79+
FLAGS+=(--locale "$LOCALE")
80+
fi
81+
82+
if [[ -n "$APPNAME" ]]; then
83+
FLAGS+=(--app-name "$APPNAME")
84+
fi
85+
7886
cat > /usr/local/bin/code-server-entrypoint <<EOF
7987
#!/usr/bin/env bash
8088
set -e
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Optional: Import test library bundled with the devcontainer CLI
5+
source dev-container-features-test-lib
6+
7+
# Feature-specific tests
8+
check "code-server version" code-server --version
9+
check "code-server running" pgrep -f 'code-server/lib/node.*/code-server'
10+
check "code-server listening" lsof -i "@127.0.0.1:8080"
11+
12+
check "code-server locale" grep '"--app-name".*"My Code Server"' < /usr/local/bin/code-server-entrypoint
13+
14+
# Report results
15+
reportResults
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Optional: Import test library bundled with the devcontainer CLI
5+
source dev-container-features-test-lib
6+
7+
# Feature-specific tests
8+
check "code-server version" code-server --version
9+
check "code-server running" pgrep -f 'code-server/lib/node.*/code-server'
10+
check "code-server listening" lsof -i "@127.0.0.1:8080"
11+
12+
check "code-server locale" grep '"--locale".*"fr"' < /usr/local/bin/code-server-entrypoint
13+
14+
# Report results
15+
reportResults

test/code-server/scenarios.json

+16
Original file line numberDiff line numberDiff line change
@@ -168,5 +168,21 @@
168168
"logFile": "/tmp/code-server-log-file.log"
169169
}
170170
}
171+
},
172+
"code-server-locale": {
173+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
174+
"features": {
175+
"code-server": {
176+
"locale": "fr"
177+
}
178+
}
179+
},
180+
"code-server-app-name": {
181+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
182+
"features": {
183+
"code-server": {
184+
"appName": "My Code Server"
185+
}
186+
}
171187
}
172188
}

0 commit comments

Comments
 (0)