Localizing a screen that lives on a server
Server-driven UIDeep dive8 min readMiniwall team
Part of the series: Server-driven UI: a field guide for app teams
On this page
A screen that comes from a server should carry string keys and one table of strings per language, not finished sentences. The app says which language it wants, the renderer falls back from vi-VN to vi to the screen's default, and every number on the screen (prices most of all) arrives as a number and gets written on the device. Missing translations get caught when someone publishes, not when a visitor in Lisbon opens the screen.
None of that is new. Native apps have done it with resource files for years. What changes when the screen is remote is that a translation ships the same way the layout does: without a release, in minutes, to everyone. That's the reason to put the screen on a server in the first place, and it's also how a broken German string reaches every German user before lunch. If you're new to the idea, the field guide covers what server-driven UI is, and how remote UI works follows one payload from JSON to pixels.
Ship keys, not sentences
There are two ways to put text into a remote screen. Inline: each text node holds its words, and you send a different payload per language. Keyed: each text node holds a key like cta or title, and the payload has a table per language mapping keys to strings.
Inline is simpler to read and fine for one language. It falls apart at the second. Every layout change now has to be made once per language, and the copies drift: someone fixes the padding in the English screen and the Portuguese one keeps the old padding for a month.
Keys keep one layout and many tables. A translator only ever touches the tables, a designer only ever touches the layout, and adding Japanese later means adding a table, not another screen. The cost is that you can't read the payload and see the words, so your editor or preview has to do that for you.
Keys also give you a rule Android has enforced on native apps for years: the default language must be complete. On Android, if the default strings.xml "is missing a string that your app needs, then your app doesn't run and shows an error"[5]. A remote renderer can be kinder (fall back, don't crash), but only if the default table has every key. Treat the default language as the one table that can never have a hole. JSON, a DSL or components covers the wider choice of format; keyed strings work in all three.
Who picks the language
You have two sources: what the app says, and what the device or browser says.
On the web, navigator.languages gives the person's preferred languages as BCP 47 tags, most preferred first, and navigator.language is the first of them[3]. MDN also notes that for privacy, Safari (always) and Chrome's incognito mode list only one language[3]. So the browser list is a hint, sometimes a short one.
My default: the app passes the locale explicitly, the same one it already uses for its own text. If your site has a language switcher and the person chose Vietnamese, the upgrade screen should be in Vietnamese even if their browser says English. A remote screen that picks its own language is the one part of the page that disagrees with the rest. Use the device's list only when the app has no opinion.
Then you need a fallback chain, because the screen will never have every locale. Android's own resolver is a good model. Before Android 7.0 it tried the exact locale, stripped the region, then used the default; from 7.0 it also tries other regions of the same language, so a device set to fr_CH gets an app's fr_FR strings instead of English[4]. Here's that idea as a function, with the person's whole preference list:
// Node 22, no dependencies. Picks the screen language from what the person prefers.
const norm = (tag) => tag.replace('_', '-').toLowerCase();
const lang = (tag) => norm(tag).split('-')[0];
export function pickLocale(preferred, available, fallback) {
for (const want of preferred) {
const exact = available.find((have) => norm(have) === norm(want));
if (exact) return exact;
const sameLanguage = available.find((have) => lang(have) === lang(want));
if (sameLanguage) return sameLanguage;
}
return fallback;
}
const screen = ['en_US', 'vi_VN', 'pt_BR', 'de_DE'];
console.log(pickLocale(['vi-VN'], screen, 'en_US')); // vi_VN: exact
console.log(pickLocale(['vi'], screen, 'en_US')); // vi_VN: same language
console.log(pickLocale(['pt-PT'], screen, 'en_US')); // pt_BR: a cousin, not the same thing
console.log(pickLocale(['fr-CH', 'de-CH'], screen, 'en_US')); // de_DE: second preference wins
console.log(pickLocale(['ja-JP'], screen, 'en_US')); // en_US: the defaultTwo things to decide on purpose. First, pt-PT landing on pt_BR is usually better than English, but not always: some words differ, and a European Portuguese reader will notice. For most screens I'd accept it. For a legal line, I wouldn't. Second, decide where the choice happens. If the server picks, it can send one language and a smaller payload, but its cache must vary by locale. If the device picks, the payload carries every table and a saved copy works offline in any language. The caching post covers what that does to freshness.
Plurals are a table, not an if
n === 1 ? 'month' : 'months' is English, not a rule. Unicode CLDR defines the plural categories each language uses, and Intl.PluralRules exposes them: zero, one, two, few, many and other, where other is also "used if the language only has one form"[1]. English uses two, Polish four, Arabic all six[2]. So a plural string in your payload is a small object, one entry per category, and the device picks the entry:
// Node 22, no dependencies. One message, one string per plural category.
const freeMonths = {
en: { one: '{n} month free', other: '{n} months free' },
pl: { one: '{n} miesiąc za darmo', few: '{n} miesiące za darmo', many: '{n} miesięcy za darmo', other: '{n} miesiąca za darmo' },
vi: { other: 'Miễn phí {n} tháng' },
};
function freeText(locale, n) {
const category = new Intl.PluralRules(locale).select(n);
const forms = freeMonths[locale];
return (forms[category] ?? forms.other).replace('{n}', new Intl.NumberFormat(locale).format(n));
}
for (const locale of ['en', 'pl', 'vi', 'ar']) {
console.log(locale, new Intl.PluralRules(locale).resolvedOptions().pluralCategories.join(' '));
}
// en one other · pl few many one other · vi other · ar few many one two zero other
for (const n of [1, 3, 5, 22]) console.log(n, '|', freeText('en', n), '|', freeText('pl', n), '|', freeText('vi', n));
// 22 | 22 months free | 22 miesiące za darmo | Miễn phí 22 thángNote the 22. In Polish it takes the few form, the same as 3, so "2 to 4" isn't the rule either. You don't write these rules; you let the platform pick the category and make sure the translator filled each one.
If your screen format has no plural forms at all, write around them: name the period instead of counting it ("Your first month free", "Billed yearly"), and keep counted phrases for languages where you've checked every number that can appear.
Send numbers, write them on the device
A price in a remote payload should be a slot, never the text $9.99. The price belongs to your store or checkout, which knows the person's currency and what they'll be charged. Bake the string into the screen and you've made a second, slower source of truth for money.
Formatting is the device's job. Android's guidance after Android 7.0 is to "use formatters instead of hard coding numbers and date strings", because formats differ even within one language[4]. The same price and renewal date, written five ways:
// Node 22, no dependencies. The payload carries a number and a currency; the device writes it.
const price = { amount: 59.99, currency: 'EUR' };
const renews = new Date(Date.UTC(2026, 11, 13));
for (const locale of ['en-US', 'de-DE', 'fr-FR', 'ja-JP', 'ar-EG']) {
const money = new Intl.NumberFormat(locale, { style: 'currency', currency: price.currency }).format(price.amount);
const date = new Intl.DateTimeFormat(locale, { dateStyle: 'long', timeZone: 'UTC' }).format(renews);
console.log(locale.padEnd(6), JSON.stringify(money).padEnd(14), date);
}
// en-US "€59.99" December 13, 2026
// de-DE "59,99 €" 13. Dezember 2026
// ar-EG "٥٩٫٩٩ €" ١٣ ديسمبر ٢٠٢٦Two separate inputs are at work here, and it's worth keeping them separate in your API. The currency is what the person pays; only your billing system knows it. The locale is how the number is written; the screen knows that. An American reading in English and paying in euros should see €59.99, not 59,99 € and not a converted dollar amount. The Arabic line also shows Arabic-Indic digits and an invisible direction mark at the start, which is a hint of the next problem.
Leave room for longer words
Translations change length, and the change hits the smallest boxes hardest. Android's own advice to translators is that "translations are less flexible in buttons than in text boxes", and its example comment tells the translator the button "can fit 30 chars"[5]. I'd do both: give each key a note on where it appears and how much room it has, and design buttons and badges that wrap or grow instead of clipping.
You don't need translations to test this. Pseudo-localize: swap each default string for a longer, accented version of itself ([Ŝţàŕţ ţŕîàļ ···]) and look at every screen. Anything clipped will clip in German too. Also check the font: a typeface that covers Latin may not have Cyrillic, Greek or Japanese glyphs, and the fallback font can be a different height.
Right-to-left is a layout feature, not a translation
Arabic and Hebrew strings in a left-to-right layout are translated but not localized. Android lists two separate jobs for RTL: use an RTL layout for RTL locales, and detect and declare the direction of text inserted into messages[6]. The first means mirroring: start and end instead of left and right, back arrows that point the other way, aligned menus. The second is subtler. Android's example is an English address dropped into a Hebrew sentence, where the house number "15" ends up on the wrong side until the inserted text is wrapped with its direction[6]. Prices and names in your variables have the same problem.
For a remote screen, that means your schema needs direction-neutral layout terms and your renderer has to mirror. If yours doesn't yet, don't pretend. Either keep RTL languages on a screen that lives in the app, or ship the translated text knowing the layout won't mirror and say so to whoever approves it.
Catch missing strings before publish
Translation always lags. Copy changes on Tuesday, the agency returns Vietnamese on Friday. So the publish step has to answer two questions: what blocks, and what only warns?
My split: an empty string in the default language blocks, because every other language falls back to it. A variable that a translation dropped or renamed blocks, because the screen will show a raw slot or lose the price. An untranslated key in another language warns, because falling back to the default is a known, readable result.
// Node 22, no dependencies. Run before publishing a screen's strings.
const screen = {
defaultLocale: 'en_US',
keys: ['title', 'price_line', 'cta'], // the keys the layout uses
strings: {
en_US: { title: 'Go Pro', price_line: '{{ price }} per year', cta: 'Start trial' },
de_DE: { title: 'Pro holen', price_line: '59,99 € pro Jahr', cta: 'Testphase starten' },
vi_VN: { title: 'Nâng cấp Pro' },
},
};
const slots = (s) => (s.match(/\{\{\s*[\w.]+\s*\}\}/g) ?? []).map((v) => v.replace(/\s/g, '')).sort().join(' ') || 'no variables';
function check({ defaultLocale, keys, strings }) {
const errors = [], warnings = [];
const base = strings[defaultLocale] ?? {};
for (const key of keys) if (!base[key]?.trim()) errors.push(`${defaultLocale}: "${key}" is empty, and every language falls back to it`);
for (const [locale, table] of Object.entries(strings)) {
if (locale === defaultLocale) continue;
const missing = keys.filter((k) => !table[k]?.trim());
if (missing.length) warnings.push(`${locale}: ${missing.length} of ${keys.length} untranslated (${missing.join(', ')}), shown in ${defaultLocale}`);
for (const k of keys) {
if (table[k] && slots(table[k]) !== slots(base[k] ?? '')) errors.push(`${locale}: "${k}" has ${slots(table[k])}, ${defaultLocale} has ${slots(base[k] ?? '')}`);
}
}
return { errors, warnings };
}
console.log(check(screen));
// errors: [ 'de_DE: "price_line" has no variables, en_US has {{price}}' ]
// warnings: [ 'vi_VN: 2 of 3 untranslated (price_line, cta), shown in en_US' ]The German error is the one that hurts: a translator typed the price in by hand, so German visitors would see 59,99 € forever, whatever your checkout charges. A check like this catches it in a second.
Last, preview each language before it goes live, and log translation edits like any other change. A string fix that skips review is still a release. Governing remote UI changes covers who approves what.
Sources
- MDN, Intl.PluralRules (opens in a new tab)developer.mozilla.org · accessed
- Unicode CLDR, Language plural rules (opens in a new tab)unicode.org · accessed
- MDN, Navigator: languages property (opens in a new tab)developer.mozilla.org · accessed
- Android Developers, Language and locale resolution overview (opens in a new tab)developer.android.com · accessed
- Android Developers, Localize your app (opens in a new tab)developer.android.com · accessed
- Android Developers, Support different languages and cultures (opens in a new tab)developer.android.com · accessed
- Miniwall docs, Localization (opens in a new tab)docs.miniwall.app · accessed
- Miniwall docs, Variables and languages (opens in a new tab)docs.miniwall.app · accessed


