Cities list + tables: keep numbers in their previous format while numerals are held
922a8b66 formatted counts with toLocaleString(<reader's locale>), which switches Arabic to
Arabic-Indic digits. Numerals are held for the Driver (dx-shepherd, 2026-09-26), so num() goes back
to the browser-default toLocaleString() these views used before. Only the text is translated.
The bundle builds.
This commit is contained in:
parent
701bb266f6
commit
9e52b82bd7
2 changed files with 8 additions and 8 deletions
|
|
@ -46,14 +46,14 @@ const enLookup = (key) =>
|
|||
String(key).replace(/^connectivity\./, '').split('.').reduce((o, k) => (o == null ? o : o[k]), enConnectivity)
|
||||
const fill = (str, params) => (params ? String(str).replace(/\{(\w+)\}/g, (m, k) => (k in params ? params[k] : m)) : str)
|
||||
let t = (key, params) => fill(enLookup(key) ?? String(key), params)
|
||||
let uiLocale = () => undefined
|
||||
try {
|
||||
const i18n = useI18n()
|
||||
t = (key, params) => { const v = i18n.t(key, params || {}); return v === key ? fill(enLookup(key) ?? key, params) : v }
|
||||
uiLocale = () => i18n.locale.value
|
||||
} catch (_) { /* no i18n on this host: the English catalog above is the fallback */ }
|
||||
// Numbers in the reader's locale, not the browser's (a bare toLocaleString() used the browser's).
|
||||
const num = (n) => (Number(n) || 0).toLocaleString(uiLocale())
|
||||
// NUMERALS ARE HELD for the Driver (dx-shepherd, 2026-09-26): a locale-following format would switch
|
||||
// 'ar' to Arabic-Indic digits. Until that is decided, numbers keep the browser-default format they
|
||||
// had before this pass; only the TEXT is translated.
|
||||
const num = (n) => (Number(n) || 0).toLocaleString()
|
||||
const isDark = computed(() => profileConfig.value?.isDark === true)
|
||||
|
||||
const countries = computed(() => data.countries || [])
|
||||
|
|
|
|||
|
|
@ -40,14 +40,14 @@ const enLookup = (key) =>
|
|||
String(key).replace(/^connectivity\./, '').split('.').reduce((o, k) => (o == null ? o : o[k]), enConnectivity)
|
||||
const fill = (str, params) => (params ? String(str).replace(/\{(\w+)\}/g, (m, k) => (k in params ? params[k] : m)) : str)
|
||||
let t = (key, params) => fill(enLookup(key) ?? String(key), params)
|
||||
let uiLocale = () => undefined
|
||||
try {
|
||||
const i18n = useI18n()
|
||||
t = (key, params) => { const v = i18n.t(key, params || {}); return v === key ? fill(enLookup(key) ?? key, params) : v }
|
||||
uiLocale = () => i18n.locale.value
|
||||
} catch (_) { /* no i18n on this host: the English catalog above is the fallback */ }
|
||||
// Numbers in the reader's locale, not the browser's (a bare toLocaleString() used the browser's).
|
||||
const num = (n) => (Number(n) || 0).toLocaleString(uiLocale())
|
||||
// NUMERALS ARE HELD for the Driver (dx-shepherd, 2026-09-26): a locale-following format would switch
|
||||
// 'ar' to Arabic-Indic digits. Until that is decided, numbers keep the browser-default format they
|
||||
// had before this pass; only the TEXT is translated.
|
||||
const num = (n) => (Number(n) || 0).toLocaleString()
|
||||
|
||||
const TABS = [
|
||||
{ id: 'cities', label: 'Key Cities', file: 'key-cities' },
|
||||
|
|
|
|||
Loading…
Reference in a new issue