feat(04-02): apply locale fallback and missing-key logging
- Resolve pl-PL then parent then app.fallback_locale then the raw key - Read towel.Locale from request context and default app.locale/fallback to en - Log each missing key once outside production and never log parameters Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -130,6 +130,16 @@ func TestHelloPluginResolvesLang(t *testing.T) {
|
||||
if got := tr.GetIn("en", "golem15.hello::lang.greeting", nil); got != "Hello" {
|
||||
t.Fatalf("greeting = %q", got)
|
||||
}
|
||||
if got := tr.GetIn("pl-PL", "golem15.hello::lang.greeting", nil); got != "Cześć" {
|
||||
t.Fatalf("pl-PL = %q", got)
|
||||
}
|
||||
if got := tr.GetIn("de", "golem15.hello::lang.greeting", nil); got != "Hello" {
|
||||
t.Fatalf("fallback en = %q", got)
|
||||
}
|
||||
const missing = "golem15.hello::lang.does.not.exist"
|
||||
if got := tr.GetIn("pl-PL", missing, nil); got != missing {
|
||||
t.Fatalf("raw key = %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTypedItemRoute(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user