---
title: "Ship a default text for every message · Agent Wranglers"
url: https://agentwranglers.se/playbook/localization/messages-and-translation/default-messages
id: LOC-25
level: Required
risk: outage
updated: 2026-10-22
tokens: 1127
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Ship a default text for every message

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Messages and translation](https://agentwranglers.se/playbook/localization/messages-and-translation.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

- ID: LOC-25
- Level: Required
- Chapter: [Messages and translation](https://agentwranglers.se/playbook/localization/messages-and-translation.md)
- Rule: Every message key has a text in the default language, and a missing translation falls back to it key by key at run time. A missing text never stops a screen from loading.
- Check: A test deletes one key from a non-default language and renders every screen in that language. Each screen loads and shows the default text for that key. A second test finds every key used in the code in the default language file.
- Risk: The app down or unusable
- How: Android shows an error and closes the app when a string is missing from the default `res/values/strings.xml` and the device runs another language. Other stacks show the raw key or throw. Make the default language file the complete set, built as [Extract messages from the code with a tool](https://agentwranglers.se/playbook/localization/messages-and-translation/extract-messages.md) says. Configure the library to fall back per key along the locale chain from [Fall back to the closest supported locale](https://agentwranglers.se/playbook/localization/locales-and-preferences/locale-fallback.md). Log each fallback, so [Fail the build on missing or broken translations](https://agentwranglers.se/playbook/localization/messages-and-translation/translation-completeness.md) can catch it before the next release.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### JavaScript example

```js
import i18next from 'i18next';
await i18next.init({
  lng: 'sv',
  fallbackLng: ['en'],
  resources: { en: { translation: { checkout: 'Checkout' } }, sv: { translation: {} } },
  missingKeyHandler: (languages, namespace, key) => console.warn(`missing ${key} in ${languages}`),
  saveMissing: true,
});
i18next.t('checkout'); // "Checkout"
```

### Python example

```python
import gettext

swedish = gettext.translation("messages", localedir="locale", languages=["sv"], fallback=True)
english = gettext.translation("messages", localedir="locale", languages=["en"], fallback=True)
swedish.add_fallback(english)
_ = swedish.gettext
```

### Kotlin example

```kotlin
// Android: res/values/strings.xml holds every key; res/values-sv/strings.xml may lack some
val title = context.getString(R.string.checkout_title)
```

## Sources

- [Android Developers (Localize your app, why default resources are important)](https://developer.android.com/guide/topics/resources/localization)

## Related rules

- LOC-18 [Extract messages from the code with a tool](https://agentwranglers.se/playbook/localization/messages-and-translation/extract-messages.md) in Localization
- LOC-23 [Fall back to the closest supported locale](https://agentwranglers.se/playbook/localization/locales-and-preferences/locale-fallback.md) in Localization
- LOC-19 [Fail the build on missing or broken translations](https://agentwranglers.se/playbook/localization/messages-and-translation/translation-completeness.md) in Localization
- LOC-36 [Keep app strings in the platform's resource files](https://agentwranglers.se/playbook/localization/apps-and-command-line-tools/platform-string-resources.md) in Localization

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/localization/messages-and-translation/default-messages">Agent Wranglers localization playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Choose gender and other variants inside the message](https://agentwranglers.se/playbook/localization/messages-and-translation/select-messages.md)
- Next: [Extract messages from the code with a tool](https://agentwranglers.se/playbook/localization/messages-and-translation/extract-messages.md)
- [Messages and translation](https://agentwranglers.se/playbook/localization/messages-and-translation.md)
