Internationalization and localization¶
Scope: making software and games ready for other languages and regions (internationalization), and translating and adapting them (localization), whatever the platform. The engine files name each engine's localization system: Unity, Godot and Unreal Engine. Adjustable text size and other accessibility settings for games are in Game development (GAMEDEV-18), and storing timestamps in PostgreSQL is PG-2 in PostgreSQL.
Entries are sorted by score from 1 to 10 (criteria): 9โ10 start here or strongly recommended, 6โ8 recommended, 1โ5 further reading or conditional.
Adopted references¶
- 9 Unicode CLDR (Unicode Consortium): the standard repository of locale data, such as date, number, currency and unit formats, plural rules and sort order, used by all modern operating systems and browsers and by many programming languages.
- 8 Globalization documentation (Microsoft Learn): the baseline: technology-independent guidance on internationalization, locales and formats, text and fonts, layout and mirroring, translation workflows and testing. Start with Design software for international markets, a world-readiness checklist for every feature.
- 8 BCP 47 (IETF): language tags such as
fr-CAorzh-Hant, and how to match them. HTTPAccept-Language, Windows locale names and Unreal Engine cultures, among others, use them. - 7 ICU User Guide (Unicode Consortium): the reference library for locale-aware formatting, message formatting, collation, text boundaries and time zones, built on CLDR data.
- 7 Localization best practices for developers (Mozilla): how to write strings that translate well: string IDs, localization notes, placeholders, plural forms, no concatenation, no reused strings, and testing with pseudolocalization.
- 7 Internationalization checklist (Microsoft Learn): what to validate for localizability, locale conventions and display. Use it in reviews.
- 7 Authoring web pages (W3C Internationalization): techniques for character encodings, language declarations, bidirectional text and layout in HTML and CSS. Use it for web front ends.
- 7 MessageFormat 2 (Unicode Consortium): the Unicode standard syntax for localizable messages with variables, plurals and markup, and the successor to ICU MessageFormat.
Key rules¶
Strings and messages¶
- 7
I18N-1Keep every user-visible string, including error messages and console output, in resource files outside the code, so that it can be translated without changing the code, from the first release. Mark or separate strings that must not be translated, and give each use of a string its own entry: the same English word can need different translations in different places. Each game engine's localization system is named inUNITY-PERF-6,GODOT-15andUNREAL-16. (Microsoft, Externalize localizable resources, Microsoft, Global product delivery: minimum baseline, Microsoft, Design software for international markets: user interface) - 7
I18N-2Never build a sentence by joining strings or fragments in code: put each complete message in one string, with named placeholders that translators can move. Word order, agreement and punctuation differ between languages, so fragments can't be translated correctly. (Microsoft, Message formatting, ICU, Formatting messages, Mozilla, Avoid concatenations) - 7
I18N-3Choose plural and gender forms with a message format that applies each language's CLDR plural rules, such as ICU MessageFormat, instead of testingcount == 1in code. Languages use up to six plural categories (zero, one, two, few, many and other), and French, for example, uses the singular for 0. Write a complete sentence in each form. (Unicode CLDR, Language plural rules, Microsoft, Pluralization, ICU, Formatting messages) - 7
I18N-4Give translators context: a comment on every short or ambiguous string and on every placeholder that says where the text appears and what the placeholder will contain, plus screenshots or a test build where you can. Translators usually see one string at a time, without the code or the user interface. (Microsoft, Contextual metadata, Mozilla, Add localization notes, Microsoft, Localize games) - 6
I18N-5Write source text that is easy to translate: full sentences, plain words and consistent terms, without slang, jargon or cultural references, and proofread it before it goes to translators. Plain text also helps readers with low reading ability. (Microsoft, Contextual metadata, Microsoft, Internationalization checklist, Game Accessibility Guidelines, Use simple clear language)
Encoding, formats and time¶
- 9
I18N-6Use Unicode, encoded as UTF-8, wherever text is stored or exchanged: source and resource files, databases, files, APIs and protocols. Components that disagree about the encoding corrupt text, and the Encoding Standard requires UTF-8 for new protocols and formats. (WHATWG, Encoding Standard, W3C, Choosing & applying a character encoding, Microsoft, Design software for international markets: encoding) - 8
I18N-8Store and exchange points in time as UTC timestamps, and convert them to the user's time zone only for display. For future and recurring events, such as meetings, also store the IANA time zone ID. Time zone rules change, so an offset alone can't give the right local time of a future event. For PostgreSQL, seePG-2. (W3C, Working with Time and Timezones, Microsoft, Design software for international markets) - 7
I18N-7Format and parse dates, times, numbers, currencies and units, and sort text, with locale-aware APIs that use CLDR data, such as ICU, JavaScriptIntlor your platform's globalization API, never with hand-written patterns or rules. Separators, digit grouping, date order, calendars and sort order differ between locales. (Microsoft, Design software for international markets: locale support, MDN, Intl, Microsoft, Format numbers) - 7
I18N-9Treat the user-interface language, the regional formats and the user's country or region as separate settings: start from the operating system's or browser's preferences, let users change each one in the app, and be wary of guessing the language from the user's location or IP address. Identify languages and locales with BCP 47 tags, and don't use country flags to stand for languages. (Microsoft, Identifying user preferences, W3C, Accept-Language used for locale setting, W3C, Guiding users to translated pages, BCP 47)
Layout, fonts and images¶
- 7
I18N-10Design layouts that adapt to the length and height of the text: let text wrap and controls grow, avoid fixed-width containers and text fitted tightly into graphics, and expect short strings to become two to three times as long as in English. Many scripts also need taller lines than Latin text. The same flexibility lets players choose a larger font (GAMEDEV-18). (W3C, Text size in translation, Microsoft, Design software for international markets: user interface, Game Accessibility Guidelines, Use an easily readable default font size) - 6
I18N-11Lay out the user interface with start and end instead of left and right, so that it mirrors for right-to-left languages such as Arabic and Hebrew. Set the base direction from the language, and decide icon by icon what to mirror: media playback controls, for example, keep their orientation. (Microsoft, Mirroring, W3C, Structural markup and right-to-left text in HTML, MDN, CSS logical properties and values) - 6
I18N-12Use fonts that contain the glyphs of every script you ship, set fallback fonts for other scripts, and keep font names out of translatable strings. Otherwise text in other scripts shows as empty boxes. (Microsoft, Customize font selection with font fallback and font linking, Microsoft, Design software for international markets: text input and display) - 6
I18N-13Keep text out of images, textures and videos: draw it at run time from string resources, or use images without text. Text in images adds cost and steps to every translation. (Microsoft, Design software for international markets: user interface, W3C, Text size in translation)
Testing and workflow¶
- 7
I18N-14Test with pseudo-localization from early in development: an automatic fake translation that accents each string, makes it about 40% longer and puts markers around it, plus a pseudo locale for formats. It shows hard-coded, joined and truncated text and missing glyphs before translation starts. (Microsoft, Pseudolocalization, Mozilla, Test localizability) - 5
I18N-15Localize continuously: send new and changed strings to translation as soon as they're written, through an automated connection between the repository and the translation system, in a standard exchange format such as XLIFF. Localized versions are then ready, and can be tested, at the same time as the source version. (Microsoft, Continuous localization, Microsoft, Exchanging localizable resources)
How to enforce¶
Tools that check the key rules above automatically, in CI, the IDE or a commit hook. "Partly" means the tool covers only some of what the rule asks.
- 6 Android Lint, SetTextI18n: flags string literals, concatenated text and numbers converted with
toString()that are passed toTextView.setText. HardcodedText flags text written into layout files, and RtlHardcoded flagsleftandrightwherestartandendbelong. Run lint in CI with./gradlew lint. Partly checksI18N-1,I18N-2,I18N-7andI18N-11. - 6 FormatJS ESLint plugin:
no-literal-string-in-jsxflags text and accessibility attributes in JSX that don't go through a message, andenforce-descriptionrequires a description for translators on every message. Partly checksI18N-1andI18N-4. - 6 Stylelint, property-layout-mappings: set to
flow-relative, it reports physical CSS properties such asmargin-leftand can fix them to logical ones such asmargin-inline-start. Partly checksI18N-11. - 5 eslint-plugin-i18next, no-literal-string: flags string literals shown to users in React or Vue code that don't go through a translation function. Partly checks
I18N-1.
Tutorials and further reading¶
- 6 Character encodings: Essential concepts (W3C Internationalization): Unicode, character sets and encodings, characters and grapheme clusters, and characters and glyphs, explained for developers.
- 6 Localize games (Microsoft Learn): what sets game localization apart: narrative and humour, voice recording and lip sync, age ratings, and cultural and geopolitical risks.