i18n(ar): keep values whole in right-to-left text

Fixes from the Arabic screenshot review:

- t() isolates every interpolated value in RTL locales (U+2068…U+2069), so
  a time (10/28 09:00 UTC), a code or an English name keeps its order inside
  an Arabic sentence; coordinates (30.326° ش) are isolated too. No-op in
  left-to-right languages.
- The cockpit position readout reads right to left again now that its
  coordinates are isolated; gauges, tapes and roll counters stay LTR.
- The start window's arrows point along the reading direction; FM seek and
  the glyph-only mini transport stay left to right, the worded PREV / PLAY /
  NEXT row follows the page; the Bhote Koshi clock stays a number.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
German KhokhlovandClaude Opus 5.5 committed 2026-10-28 14:27:03 +04:00
1 parent 33985138ef
commit 4c3e366211
5 files changed
+49 -23

No files matched your search

+8 -7
View File
@@ -1,5 +1,5 @@
/** Pure formatting and fixed presentation constants used by Cockpit components. */
import { formatNumber, getLocale, t, msg } from '../i18n/index.js';
import { formatNumber, getLocale, isolate, t, msg } from '../i18n/index.js';
import { formatQuantity } from './unitLabels.js';
export const COCKPIT_HEADING_SLEW_DPS = 28;
@@ -124,18 +124,19 @@ export function formatCockpitCoordinate(value, positive, negative) {
maximumFractionDigits: 3,
});
const code = value >= 0 ? positive : negative;
// Not «30,203°С»: after a degree sign «С» reads as Celsius.
// Not «30,203°С»: after a degree sign «С» reads as Celsius. Isolated, so
// an Arabic hemisphere letter does not pull the next number into its run.
switch (code) {
case 'N':
return t('{value}°N', { value: amount });
return isolate(t('{value}°N', { value: amount }));
case 'S':
return t('{value}°S', { value: amount });
return isolate(t('{value}°S', { value: amount }));
case 'E':
return t('{value}°E', { value: amount });
return isolate(t('{value}°E', { value: amount }));
case 'W':
return t('{value}°W', { value: amount });
return isolate(t('{value}°W', { value: amount }));
default:
return `${amount}°${compassPointLabel(code)}`;
return isolate(`${amount}°${compassPointLabel(code)}`);
}
}