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

+10 -2
View File
@@ -71,13 +71,16 @@ test('Arabic formats with Western digits whatever ICU defaults to', () => {
}
});
/** The text without the bidi isolates t() puts around values in RTL. */
const plain = (text) => text.replace(/[\u2068\u2069]/g, '');
test('Arabic uses all six plural forms and spaced HUD units', () => {
const previous = getLocale();
try {
setLocale('ar');
assert.deepEqual(
[0, 1, 2, 3, 11, 100].map((n) =>
tn(n, '{count} SOURCE', '{count} SOURCES'),
plain(tn(n, '{count} SOURCE', '{count} SOURCES')),
),
[
'0 مصدر',
@@ -96,11 +99,16 @@ test('Arabic uses all six plural forms and spaced HUD units', () => {
'Sentinel-2 · \u206830\u00a0م\u2069',
);
assert.equal(
LOCALIZED_LOCALITY.sector({ latDeg: 21.33, lonDeg: -77.5 }),
plain(LOCALIZED_LOCALITY.sector({ latDeg: 21.33, lonDeg: -77.5 })),
'القطاع 21.33ش 77.50غ',
);
assert.equal(READOUT_WORDS.daysAgo(9), 'قبل 9 أيام');
assert.equal(t('SAVE KEYS'), 'حفظ المفاتيح');
// Each value is isolated, so a time keeps its order inside Arabic text.
assert.equal(
t('Issued: {time}', { time: '10/28 00:00 UTC' }),
'صدر: \u206810/28 00:00 UTC\u2069',
);
setLocale('ru');
assert.equal(formatCockpitDistance(14000), '14 КМ');
} finally {