A date formatter called without a locale picks the runtime's default, so translated labels and untranslated dates appear in the same frame
A date formatter's locale argument was omitted, or passed as the explicit use-the-default placeholder. That selects the runtime's own default locale, which is fixed at process level and which no user, device or application language setting feeds into. Spelled-out month and weekday names then render in the runtime's language while every surrounding label comes from the application's translation dictionary, so two sources of truth for one screen disagree in the same frame. It works on the developer's machine because the runtime default matches the developer's language.
Resurfaces when
- I am about to format a date for display in an app that supports more than one language
- adding translations to a screen that already renders dates
- choosing between a formatter and a translation dictionary for month names
- the interface translates but the dates stay in one language
- month names appear in one language and the labels around them in another
- a date looks right on my machine and wrong for users in another language
- copying a workaround for localised names from code that uses a different date library
The lesson’s retrieval contract, weighted three times heavier than its body. A lesson that states when it applies doesn’t need a semantic search to find it.
The lesson
Formatting APIs accept a locale, and also accept nothing, or an explicit "use the default" placeholder, in its place. That omission reads as "whatever is right for this user". It means the runtime's own default locale, decided once for the process.
Run the same formatter under different process locales and the output follows the process, not the application: one run prints a weekday and month in English, another in German, another in Japanese, and an explicit tag gives the same French text in all three. Nothing in the code changed between runs.
The result is a screen where every translated label is right and the spelled-out date is in the runtime's language, side by side, because the two come from different sources.
It survives for three reasons. It is correct wherever it is written, because the developer's machine,
CI and the default emulator sit in the locale the runtime falls back to. The argument is optional, so
no type check or author-written assertion sees it. And the visible tell is narrow: spelled-out names
are obviously wrong, while a purely numeric date merely changes order (3/9/2026, 9.3.2026,
2026/3/9) and reads as a plausible format, so reviewers calibrate on the half that looks fine.
The failure that taught it
An app supporting many languages had a working translation layer. Switching the device language translated every heading and button, and every date stayed in English: a calendar header showed an English month name directly under a correctly translated instruction. It shipped that way because nobody had walked a main user path in a second language.
The cause was one omitted argument. The recorded remedy was to stop asking the formatter for names and index month names out of the translation dictionary, copied from another screen whose comment said a formatter could not be trusted for localised names. That comment was true of a different date library, one that ships no locale data in that app. The affected screens used the platform's own internationalisation API, which had the data and needed only to be told the locale. Copying the remedy would have brought in a limit that did not exist there, and names assembled from a dictionary come out in the author's word order without the connecting particles other languages need.
How to apply it
- Pass an explicit locale tag for any spelled-out date, derived from whatever the rest of the screen's strings come from. If the app stores its own language choice, follow that, not the device or runtime.
- Settle what the platform can do by running it: one throwaway script printing the default-locale output, an explicit-tag output and the resolved default decides whether you need an argument or a dictionary.
- Treat a workaround's comment as scoped to the library it was written against. Check the new call site uses that library before reusing the remedy.
- Classify call sites before changing any: those that carry names follow the user's language; numeric ones follow whatever the reference does, which may be a fixed order. Name any deliberate pin with a constant and a reason.
- In shared helpers that run outside a component, make the locale a required parameter so the compiler lists every caller.
- Audit by looking at the first argument of every formatting call; an empty list or the default placeholder is the defect.
- Check in a second language that names translated and that fixed-order numeric dates did not move.
Carries a runnable check
It names a grep-able signature — the shape this failure takes on sight. Prose doesn’t prevent recurrence; executable checks do. This one runs today, against every edit, as signature-scan.
Where this claim comes from
- Lesson
A date formatter called without a locale picks the runtime's default, so translated labels and untranslated dates appear in the same frame
- Distillationmechanism stated
Written from the mechanism, not the incident — which is what lets it transfer to code sharing nothing with the original.
- Scar1 occurrence
One recorded failure — weaker evidence, and ranked accordingly rather than presented as settled.
- Evidencenone recorded
No source records recorded — hand-written and migrated lessons predate the pipeline that captures them.
What happened when it was used
- 13
- retrieved
- 0
- acted on
- 0
- held up
- 0
- did not hold up
Retrieved but never acted on — a demotion, not a neutral result. A lesson that keeps winning the search and never changes a decision is noise.