fd28d70bff
Operator rulings 2026-10-12, 09 §3 decisions 196, 204-207, 223, 227. MinAgent 0.131.0 unchanged. R-255's sweep found one leak, fixed here: an optional-config secret_input was rendered into its settings page; it is now revealed on demand. Hungarian parity fixtures re-captured once for R-562. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
45 lines
1.8 KiB
Go
45 lines
1.8 KiB
Go
package i18n
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
// R-562 (`09` §3 decision 223): Hungarian dates and numbers in Hungarian, ISO-like in English.
|
|
func TestFormat_DatesPerLanguage(t *testing.T) {
|
|
at := time.Date(2026, 10, 10, 15, 4, 0, 0, time.UTC)
|
|
cases := []struct{ name, got, want string }{
|
|
{"hu datetime", FormatDateTime("hu", at), "2026. 10. 10. 15:04"},
|
|
{"en datetime", FormatDateTime("en", at), "2026-10-10 15:04"},
|
|
{"hu date", FormatDate("hu", at), "2026. 10. 10."},
|
|
{"en date", FormatDate("en", at), "2026-10-10"},
|
|
{"hu month-day", FormatMonthDayTime("hu", at), "10. 10. 15:04"},
|
|
{"en month-day", FormatMonthDayTime("en", at), "10-10 15:04"},
|
|
{"unknown language falls back to Hungarian", FormatDateTime("xx", at), "2026. 10. 10. 15:04"},
|
|
}
|
|
for _, c := range cases {
|
|
if c.got != c.want {
|
|
t.Errorf("%s: got %q, want %q", c.name, c.got, c.want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestFormat_NumbersPerLanguage(t *testing.T) {
|
|
cases := []struct{ name, got, want string }{
|
|
{"hu decimal comma", FormatDecimal("hu", 1.53, 1), "1,5"},
|
|
{"en decimal point", FormatDecimal("en", 1.53, 1), "1.5"},
|
|
{"hu integer has no separator", FormatDecimal("hu", 12, 0), "12"},
|
|
{"hu size string", LocalizeDecimals("hu", "1.5 GB"), "1,5 GB"},
|
|
{"hu list of sizes", LocalizeDecimals("hu", "Immich (95.0 GB), Nextcloud (34.0 GB)"), "Immich (95,0 GB), Nextcloud (34,0 GB)"},
|
|
{"en untouched", LocalizeDecimals("en", "1.5 GB"), "1.5 GB"},
|
|
{"hu sentence full stop untouched", LocalizeDecimals("hu", "Kész. 3 elem."), "Kész. 3 elem."},
|
|
{"hu version untouched", LocalizeDecimals("hu", "v0.307.0 és 1.5 GB"), "v0.307.0 és 1,5 GB"},
|
|
{"hu address untouched", LocalizeDecimals("hu", "192.168.0.180"), "192.168.0.180"},
|
|
}
|
|
for _, c := range cases {
|
|
if c.got != c.want {
|
|
t.Errorf("%s: got %q, want %q", c.name, c.got, c.want)
|
|
}
|
|
}
|
|
}
|