fix: final checkup review follow-ups

- i18n: the spreadsheet notice's feature words (charts, drawings, macros,
  pivot tables, external links) were bare, case-insensitive zh-CN keys, so
  the page translator also renamed a charts/ or macros/ folder in the Files
  panel and a case of that name in the case picker. They are now scoped
  'Spreadsheet feature: <word>' keys; warningText() falls back to the plain
  word when the scoped key has no translation (English, no i18n). Removing
  the bare keys closes this branch's regression. The older 'models' key has
  the same class of problem; it is left alone here, since adding
  .case-combobox-option-label to USER_TEXT_SELECTOR would also untranslate
  the picker's two action rows and still miss the title attribute.
- Spreadsheet notice bar: marked data-i18n-skip. It is written already
  translated, item by item, and ends with a number format's code, which the
  observer's t() over the whole line rewrote ({name}, "Codeman").
- Connection tile (Header Stats Style Tiles): applyLocalization() now repaints
  the indicator, so a switch back to English no longer leaves the Chinese
  value word in its data-i18n-skip span until the next keystroke or ACK.
- Tiles default: loadAppSettingsFromStorage() no longer caches the
  posture-dependent showTileGridButton default, so the init merge never
  persists it; a 2-in-1 first opened as a tablet gets the button once docked.
  Every reader still resolves the absent key through a fresh
  getDefaultSettings(), so phones stay OFF and desktops ON.
- Tile grid over a split: closeSplitPane() skips Pane A's closing resize only
  when Pane A becomes a tile. With mergeSplit false (Open group as tiles, a
  stored grid) a Pane A left out of the set gets its full width back before
  the main terminal parks, instead of keeping the split's half width.
- By-case tab strip on tablets and phones: with the boxes dissolved, the
  -<case> part of a generated name shows again, so w1-alpha and w1-beta no
  longer both read "w1".

Each new assertion fails against the previous source.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer
2026-10-09 10:17:44 +02:00
parent 9d38cbf51a
commit a4511a0e48
10 changed files with 207 additions and 25 deletions
+9 -5
View File
@@ -920,11 +920,15 @@
'This workbook is too large or complex to preview.': '此工作簿过大或过于复杂,无法预览。',
'This workbook could not be read. The file may be damaged or not a valid .xlsx file.':
'无法读取此工作簿。文件可能已损坏,或不是有效的 .xlsx 文件。',
charts: '图表',
drawings: '绘图',
'pivot tables': '数据透视表',
'external links': '外部链接',
macros: '宏',
// The features the preview leaves out (spreadsheet-preview.js warningText).
// Scoped keys on purpose: a bare 'charts' or 'macros' key would also
// translate a folder or case of that name (a Helm chart's charts/, a dbt
// project's macros/) in the Files panel and the case picker.
'Spreadsheet feature: charts': '图表',
'Spreadsheet feature: drawings': '绘图',
'Spreadsheet feature: pivot tables': '数据透视表',
'Spreadsheet feature: external links': '外部链接',
'Spreadsheet feature: macros': '宏',
'Formula has no cached result': '公式没有缓存的计算结果',
'Unsupported cell value': '不支持的单元格值',
'Unsupported number format': '不支持的数字格式',
+15 -2
View File
@@ -344,7 +344,10 @@ html.mobile-init .file-browser-panel {
geometry; a 44px box would hang below the 48px header. Ends at 767px, not
at the tablet block's 768: from 768 getDeviceType() says 'desktop', and the
desktop rule in styles.css (flex-shrink: 0, wrapping box by box) owns the
strip. */
strip. With the boxes, their labels and their case-colour borders gone, the
`-<case>` part of a generated name (.tab-name-case, which styles.css hides
in the clustered strip) is the only cue left to which case a chip is in: the
w<n> counter is per case, so w1-alpha and w1-beta would both read "w1". */
@media (min-width: 600px) and (max-width: 767px) {
:where(.header) .session-tabs-host > .session-tabs.tabs-clusters > .tab-cluster {
display: contents;
@@ -353,6 +356,10 @@ html.mobile-init .file-browser-panel {
:where(.header) .tab-cluster-label {
display: none;
}
:where(.header) .session-tabs-host > .session-tabs.tabs-clusters .tab-name-case {
display: inline;
}
}
/* Edge fade for the phone's header tab strip (used in the block below).
@@ -788,7 +795,9 @@ html.mobile-init .file-browser-panel {
/* Clustered by case, the same holds: the boxes dissolve into the one chip
row (in cluster order) and the labels go, since every chip still names
its session. */
its session. It does so in full: the `-<case>` part of a generated name,
which styles.css hides in the clustered strip, shows again, or w1-alpha
and w1-beta (the w<n> counter is per case) would both read "w1". */
:where(.header) .session-tabs-host > .session-tabs.tabs-clusters > .tab-cluster {
display: contents;
}
@@ -797,6 +806,10 @@ html.mobile-init .file-browser-panel {
display: none;
}
:where(.header) .session-tabs-host > .session-tabs.tabs-clusters .tab-name-case {
display: inline;
}
/* Only the active tab shows its action icons on a phone (see below), so on
every other tab the container is empty but still a flex item, and its gap
made the chip visibly wider on the right than on the left. */
+13 -2
View File
@@ -3573,8 +3573,15 @@ Object.assign(CodemanApp.prototype, {
} catch (err) {
console.error('Failed to load app settings:', err);
}
// Return device-specific defaults
this._cachedAppSettings = this.getDefaultSettings();
// Return device-specific defaults, without showTileGridButton: its default
// on a non-handheld follows the LIVE primary pointer (getDefaultSettings),
// and this object is what a fresh device caches and the server-settings
// merge then persists, which would freeze a 2-in-1's first-load posture
// into a stored value. Every reader resolves the absent key through a
// fresh getDefaultSettings() (?? defaults.showTileGridButton ?? true).
const defaults = { ...this.getDefaultSettings() };
delete defaults.showTileGridButton;
this._cachedAppSettings = defaults;
return this._cachedAppSettings;
},
@@ -3620,6 +3627,10 @@ Object.assign(CodemanApp.prototype, {
if (result && this.notificationManager) {
this.notificationManager.originalTitle = document.title;
}
// The connection tile's value word (Header Stats Style Tiles) is written
// already translated into a data-i18n-skip span, so the translator above
// cannot revert it; its own language compare makes this one call repaint it.
this._updateConnectionIndicator?.();
},
// Resolved per-device state of the plan-usage chip. Desktop defaults ON,
+17 -4
View File
@@ -81,15 +81,24 @@
}
// One notice bar item, translated on its own (the bar is one text node, which
// the i18n layer could only match whole). A number format's code is workbook
// text: it is appended as is, never passed through the translator, which
// would read a `{…}` in it as a placeholder.
// the i18n layer could only match whole; the bar itself carries
// data-i18n-skip). A number format's code is workbook text: it is appended
// as is, never passed through the translator, which would read a `{…}` in it
// as a placeholder. A feature word goes through its scoped
// 'Spreadsheet feature: <word>' key and reads as the plain word when that key
// has no translation: a bare 'charts' key would also rename a charts/ folder.
function warningText(warning) {
const text = String(warning);
if (text.startsWith(UNSUPPORTED_FORMAT_PREFIX)) {
return `${translate('Unsupported number format')}: ${text.slice(UNSUPPORTED_FORMAT_PREFIX.length)}`;
}
return translate(own(FEATURE_LABELS, text) ? FEATURE_LABELS[text] : text);
if (own(FEATURE_LABELS, text)) {
const label = FEATURE_LABELS[text];
const key = `Spreadsheet feature: ${label}`;
const translated = translate(key);
return translated !== key ? translated : label;
}
return translate(text);
}
function message(container, text, kind) {
@@ -436,6 +445,10 @@
}
const notice = document.createElement('div');
notice.className = 'spreadsheet-preview-notice';
// Written already translated, item by item (renderWarnings), and it ends
// with workbook text (a number format's code): the observer's t() over
// the whole line would rewrite a `{name}` or a "Codeman" in that code.
notice.setAttribute('data-i18n-skip', '');
notice.hidden = true;
emptySheetState = document.createElement('div');
emptySheetState.className = 'spreadsheet-empty-sheet';
+11 -7
View File
@@ -337,15 +337,13 @@ Object.assign(CodemanApp.prototype, {
const max = window.CodemanTileGrid.TILE_GRID_MAX;
// The grid and the split are never open together. An open split becomes the
// grid's first two tiles (Pane A focused, Pane B beside it), so "split, then
// want more" is one step. No closing resize for Pane A: it is about to park.
// want more" is one step.
let requested = ids || [];
if (this._splitPane) {
const splitOpen = !!this._splitPane;
if (splitOpen && mergeSplit) {
const seed = [this.activeSessionId, this._splitSessionId].filter(Boolean);
this.closeSplitPane({ skipPrimaryResize: true });
if (mergeSplit) {
requested = [...seed, ...requested];
if (!requested.includes(focusedId)) focusedId = seed[0] ?? null;
}
requested = [...seed, ...requested];
if (!requested.includes(focusedId)) focusedId = seed[0] ?? null;
}
const wanted = [];
for (const id of requested) {
@@ -354,6 +352,12 @@ Object.assign(CodemanApp.prototype, {
wanted.push(id);
if (wanted.length === max) break;
}
// No closing resize for Pane A only when it becomes a tile (its tile sizes
// the PTY). A Pane A left out of the set (a group, a stored grid: mergeSplit
// false) gets its full width back now, while the main terminal still shows
// it, or its PTY stays at the split's half width for as long as the grid
// is open.
if (splitOpen) this.closeSplitPane({ skipPrimaryResize: wanted.includes(this.activeSessionId) });
if (wanted.length === 0) return grid.open;
const focus = wanted.includes(focusedId) ? focusedId : wanted[0];