aboutsummaryrefslogtreecommitdiff
path: root/internal/config/config_test.go
diff options
context:
space:
mode:
authorLukasz Kasprzak <lukas@labunix.xyz>2026-07-23 21:51:40 +0200
committerLukasz Kasprzak <lukas@labunix.xyz>2026-07-23 21:51:40 +0200
commit4c776396115c8120c3e1cb8fda993449fcdcd326 (patch)
tree0144fb325663dde063057a5ec568c59d4cbe79da /internal/config/config_test.go
parentbfa8df7b36ccbd44703e0705d51a2ed553a23164 (diff)
downloadlectio-4c776396115c8120c3e1cb8fda993449fcdcd326.tar.gz
lectio-4c776396115c8120c3e1cb8fda993449fcdcd326.zip
i18n: ui_language config (default en) for UI chrome across cli/tui/web; version labels localised
Diffstat (limited to 'internal/config/config_test.go')
-rw-r--r--internal/config/config_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index ff513ea..616f0cd 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -107,6 +107,43 @@ func TestWebDisplayNormalizesUnknown(t *testing.T) {
}
}
+func TestUILanguageDefault(t *testing.T) {
+ def := Default()
+ if def.UILanguage != "en" {
+ t.Errorf("UILanguage default wrong: got %q, want %q", def.UILanguage, "en")
+ }
+}
+
+func TestUILanguageLoadsPL(t *testing.T) {
+ dir := t.TempDir()
+ t.Setenv("XDG_CONFIG_HOME", dir)
+ os.MkdirAll(filepath.Join(dir, "lectio"), 0o755)
+ os.WriteFile(filepath.Join(dir, "lectio", "config.toml"),
+ []byte("ui_language = \"pl\"\n"), 0o644)
+ cfg, err := Load()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if cfg.UILanguage != "pl" {
+ t.Errorf("UILanguage = %q, want %q", cfg.UILanguage, "pl")
+ }
+}
+
+func TestUILanguageNormalizesUnknown(t *testing.T) {
+ dir := t.TempDir()
+ t.Setenv("XDG_CONFIG_HOME", dir)
+ os.MkdirAll(filepath.Join(dir, "lectio"), 0o755)
+ os.WriteFile(filepath.Join(dir, "lectio", "config.toml"),
+ []byte("ui_language = \"bogus\"\n"), 0o644)
+ cfg, err := Load()
+ if err != nil {
+ t.Fatal(err)
+ }
+ if cfg.UILanguage != "en" {
+ t.Errorf("UILanguage = %q, want %q (normalized from bogus)", cfg.UILanguage, "en")
+ }
+}
+
func TestPartShown(t *testing.T) {
var empty Config
if !empty.PartShown("new", "psalm") {