Skip to content

Commit 8de5a6e

Browse files
committed
feat: localize control-bar button titles and rename to Design Mode
Rename the collapse-editor toggle's expanded-state title from "Switch to Visual Edit" to "Switch to Design Mode" so it matches the rest of the feature's naming (command id, menu item, body class, WorkspaceManager API all already use "design mode"). Also localize the control bar's hardcoded English titles: - Switch to Design Mode / Switch to Code Editor get new string keys (CCB_SWITCH_TO_DESIGN_MODE, CCB_SWITCH_TO_CODE_EDITOR). - Sidebar toggle, Undo, Redo, Save reuse existing CMD_TOGGLE_SIDEBAR / CMD_UNDO / CMD_REDO / CMD_FILE_SAVE. - Search / Back / Forward were already localized via NavigationProvider.updateTooltips. HTML keeps the English titles as fallback; the JS init overwrites them with the localized strings so the user's locale shows on first render.
1 parent fd6b90f commit 8de5a6e

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@
936936
<!-- Vertical control bar between sidebar and editor content -->
937937
<div id="centralControlBar" class="no-focus">
938938
<div class="ccb-group ccb-group-top">
939-
<a href="#" id="ccbCollapseEditorBtn" class="ccb-btn" title="Switch to Visual Edit">
939+
<a href="#" id="ccbCollapseEditorBtn" class="ccb-btn" title="Switch to Design Mode">
940940
<i class="fa-solid fa-feather"></i>
941941
</a>
942942
<a href="#" id="ccbSidebarToggleBtn" class="ccb-btn" title="Toggle sidebar">

src/nls/root/strings.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,8 @@ define({
930930
"CMD_SHOW_SIDEBAR": "Show Sidebar",
931931
"CMD_TOGGLE_SIDEBAR": "Toggle Sidebar",
932932
"CMD_TOGGLE_DESIGN_MODE": "Toggle Design Mode",
933+
"CCB_SWITCH_TO_DESIGN_MODE": "Switch to Design Mode",
934+
"CCB_SWITCH_TO_CODE_EDITOR": "Switch to Code Editor",
933935
"CMD_TOGGLE_TABBAR": "File Tab Bar",
934936
"CMD_TOGGLE_PANELS": "Toggle Panels",
935937
"CMD_TOGGLE_PURE_CODE": "No Distractions",

src/view/CentralControlBar.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ define(function (require, exports, module) {
237237
$("body").toggleClass("ccb-editor-collapsed", editorCollapsed);
238238
const $collapseBtn = $("#ccbCollapseEditorBtn");
239239
$collapseBtn.toggleClass("is-active", editorCollapsed)
240-
.attr("title", editorCollapsed ? "Switch to Code Editor" : "Switch to Visual Edit");
240+
.attr("title", editorCollapsed ? Strings.CCB_SWITCH_TO_CODE_EDITOR : Strings.CCB_SWITCH_TO_DESIGN_MODE);
241241
$collapseBtn.find("i").attr("class", editorCollapsed ? "fa-solid fa-code" : "fa-solid fa-feather");
242242
if (_toggleDesignModeCommand) {
243243
_toggleDesignModeCommand.setChecked(editorCollapsed);
@@ -304,6 +304,15 @@ define(function (require, exports, module) {
304304
$fileName = $fileLabel.find(".ccb-file-name");
305305

306306
_wireButtons();
307+
// The HTML titles on the control-bar buttons are fallback English
308+
// strings; set the localized versions up front so the initial render
309+
// reflects the user's locale. (searchNav / navBackButton /
310+
// navForwardButton get their localized titles from NavigationProvider.)
311+
$("#ccbCollapseEditorBtn").attr("title", Strings.CCB_SWITCH_TO_DESIGN_MODE);
312+
$("#ccbSidebarToggleBtn").attr("title", Strings.CMD_TOGGLE_SIDEBAR);
313+
$("#ccbUndoBtn").attr("title", Strings.CMD_UNDO);
314+
$("#ccbRedoBtn").attr("title", Strings.CMD_REDO);
315+
$("#ccbSaveBtn").attr("title", Strings.CMD_FILE_SAVE);
307316
_syncLeftPositions();
308317

309318
// While the sidebar is being dragged we only reposition CCB / main-toolbar.

0 commit comments

Comments
 (0)