FA-11766 / Localization message semantics / Open access
Regional lookup skips an intermediate locale · case 01
Regional lookup skips an intermediate locale.
ROOT CAUSE
Fallback goes directly from a full locale to the default.
VERIFIED REPAIR
For hyphen-delimited toy locale tags, try the full tag then repeatedly remove the rightmost subtag, then default en; return source key if absent everywhere.
Unsuccessful approach: Using only the primary language skips the script parent of a region-specific locale.
Case contract
For hyphen-delimited toy locale tags, try the full tag then repeatedly remove the rightmost subtag, then default en; return source key if absent everywhere.
Why this case matters
This offline controlled message model isolates a localization decision; it does not implement a complete message-format or locale standard.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(catalogs, locale, key):
return catalogs.get(locale,{}).get(key,catalogs.get('en',{}).get(key,key))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('script parent', solve({'zh-Hant':{'k':'script'},'en':{'k':'default'}},'zh-Hant-TW','k'), 'script')
check('language parent', solve({'zh':{'k':'base'}},'zh-Hant-TW','k'), 'base')
check('exact', solve({'zh-Hant-TW':{'k':'exact'},'zh':{'k':'base'}},'zh-Hant-TW','k'), 'exact')
check('default', solve({'en':{'k':'default'}},'fr-CA','k'), 'default')
check('missing', solve({},'fr-CA','key'+str(N)), 'key'+str(N))
check('entry level fallback', solve({'zh-Hant-TW':{'x':'other'},'zh-Hant':{'k':'script'}},'zh-Hant-TW','k'), 'script')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| script parent | default | script | Failed |
| language parent | k | base | Failed |
| exact | exact | exact | Passed |
| default | default | default | Passed |
| missing | key1 | key1 | Passed |
| entry level fallback | k | script | Failed |
SHA-256 / 314e4a99e5cd93d4f478c06ab483f2a2309e22d2d4c61f765f0edbfac8da7834
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(catalogs, locale, key):
return catalogs.get(locale,{}).get(key,catalogs.get(locale.split('-')[0],{}).get(key,catalogs.get('en',{}).get(key,key)))
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('script parent', solve({'zh-Hant':{'k':'script'},'en':{'k':'default'}},'zh-Hant-TW','k'), 'script')
check('language parent', solve({'zh':{'k':'base'}},'zh-Hant-TW','k'), 'base')
check('exact', solve({'zh-Hant-TW':{'k':'exact'},'zh':{'k':'base'}},'zh-Hant-TW','k'), 'exact')
check('default', solve({'en':{'k':'default'}},'fr-CA','k'), 'default')
check('missing', solve({},'fr-CA','key'+str(N)), 'key'+str(N))
check('entry level fallback', solve({'zh-Hant-TW':{'x':'other'},'zh-Hant':{'k':'script'}},'zh-Hant-TW','k'), 'script')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| script parent | default | script | Failed |
| language parent | base | base | Passed |
| exact | exact | exact | Passed |
| default | default | default | Passed |
| missing | key1 | key1 | Passed |
| entry level fallback | k | script | Failed |
SHA-256 / 6d88486aad74e85199339ad42ca0983a887ccfc83078f72bd61fa89afc22b78c
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(catalogs, locale, key):
parts = locale.split('-')
for tag in ['-'.join(parts[:i]) for i in range(len(parts),0,-1)] + ['en']:
if key in catalogs.get(tag,{}): return catalogs[tag][key]
return key
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('script parent', solve({'zh-Hant':{'k':'script'},'en':{'k':'default'}},'zh-Hant-TW','k'), 'script')
check('language parent', solve({'zh':{'k':'base'}},'zh-Hant-TW','k'), 'base')
check('exact', solve({'zh-Hant-TW':{'k':'exact'},'zh':{'k':'base'}},'zh-Hant-TW','k'), 'exact')
check('default', solve({'en':{'k':'default'}},'fr-CA','k'), 'default')
check('missing', solve({},'fr-CA','key'+str(N)), 'key'+str(N))
check('entry level fallback', solve({'zh-Hant-TW':{'x':'other'},'zh-Hant':{'k':'script'}},'zh-Hant-TW','k'), 'script')
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| script parent | script | script | Passed |
| language parent | base | base | Passed |
| exact | exact | exact | Passed |
| default | default | default | Passed |
| missing | key1 | key1 | Passed |
| entry level fallback | script | script | Passed |
SHA-256 / 86461815f29063f61a54c65ce236ccb44fe6ec92496b4a94ff8c0ac9edb66d62
Verification & scope
Only the explicitly specified miniature locale/message rules are modeled. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:38:50.849131+00:00.
Case digest / b983846aed2c4238f282982b5477da642aa62629e112928dec917a47f46ab3f7