Multiple languages (i18n)
Note for AI agents: This page is baseline guidance, not an exact prescription. Read it, tell your owner what applies to their project, and get their approval before you change anything. Your project's own rules take precedence. If something important for this project is missing here, suggest it to your owner.
For agents
- Apply this page only if the project needs several languages.
- Keep screen texts in language files, fall back in a defined order, and catch missing translations with a guard.
- Translate fixed text only; user-written text stays as written; legal texts get human review.
Which class?
This topic has items from class S. The blocks below are cumulative: read up to your own class.
- S: 2 items
- M: 4 items
- L: 4 items
- XL: 0 items
Audit checklist
Every project
- Language codes follow BCP 47
- What: Language codes use BCP 47 tags (including script where needed, such as
az-Latn) from one list. - How to check: Read the language list and configuration.
- Evidence: Language list file.
- What: Language codes use BCP 47 tags (including script where needed, such as
- Fallback chain is defined
- What: Missing text falls back in a defined order (for example
az-AZ→az→en); only the user’s language file is downloaded. - How to check: Request an unsupported language.
- Evidence: Fallback test.
- What: Missing text falls back in a defined order (for example
+ If it has users, personal data or API keys (M)
- Texts live in language files with a fallback
- What: Screen texts are stored in language files; a missing translation is caught by a check; an unsupported language falls back to English; the language list has one source.
- How to check: Search for hard-coded texts; read the language list and fallback rule; run the translation check.
- Evidence: Language file paths; check results.
- Dates, numbers and money use locale rules
- What: Formatting follows CLDR rules for the user’s language and time zone; “day” means the user’s day, not UTC.
- How to check: Read formatting code; test with several locales and time zones.
- Evidence: Locale tests.
- Only fixed texts are translated
- What: Interface text is translated; user-written text is shown as written; legal texts are translated with human review.
- How to check: Look for machine translation of user content and for unreviewed legal translations.
- Evidence: Policy note.
- Plural, gender and sentence parts use message format
- What: Messages with counts or gender use a message format such as ICU; sentences are never glued from fragments.
- How to check: Search for string concatenation in texts; read plural handling.
- Evidence: Message file examples.
+ If it has an admin panel, file uploads, many users or a store app (L)
- Translation guards run automatically
- What: Automated checks catch hard-coded text, missing translations, invalid message syntax, overflow in the pseudo-language and right-to-left screens; new languages are included automatically.
- How to check: Read the guard list.
- Evidence: Guard names; CI run.
- Text is normalized to Unicode NFC
- What: Text is normalized to NFC before it is compared, stored or searched.
- How to check: Search for normalization in input handling.
- Evidence: Code lines; test.
- Layout supports right-to-left and long text
- What: Layouts mirror for right-to-left languages; buttons survive text that is 40% longer; a font covers all used scripts.
- How to check: Use a pseudo-language with long accented text and a right-to-left language.
- Evidence: Screenshots.
- Fixed multilingual content uses a translation table
- What: Fixed texts (category names, notification templates) live in a row-based translation table (record id, language code, text); no
name_tr,name_encolumns; a new language is a new row. User-written text is stored in its own language and marked, not machine-translated. - How to check: Look for language-suffixed columns in the schema.
- Evidence: Schema with translation table.
- What: Fixed texts (category names, notification templates) live in a row-based translation table (record id, language code, text); no
+ If it targets millions of users (XL)
No additional items for this class.
Common mistakes
- Hard-coded text inside components.
- Gluing sentences from fragments so grammar breaks in other languages.
- Adding
_trand_encolumns instead of a translation table. - Formatting dates in UTC for everyone.
- Buttons that overflow when text grows by 40%.
- Machine-translating user content or legal text without review.
- A language code list in several places.
- Assuming left-to-right layout.
Sources
- Declaring language in HTML — W3C Internationalization
- Language tags in HTML and XML — W3C Internationalization
- Localization vs. Internationalization — W3C Internationalization
- RFC 5646: Tags for Identifying Languages — IETF
- ICU: Formatting Messages — Unicode ICU
- Unicode CLDR Project — Unicode
- UAX #15: Unicode Normalization Forms — Unicode
- Localize your app — Android Developers
- meta viewport — MDN Web Docs
- Pro Build Guide v1.2: compiled team practices — Pro Build Guide