commit 634e8ce8fbb7fbc2aa610e3c5322efb90bfe4294 parent f029640c13af92f5832f49bd205e8facb8b40405 Author: brookjeynes <me@brookjeynes.dev> Date: Mon, 2 Nov 2026 10:20:07 +1000 locale: fallback to next locale variable check if a checked env is empty Signed-off-by: brookjeynes <me@brookjeynes.dev> Diffstat:
| M | src/environment.zig | | | 12 | +++++++++--- |
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/environment.zig b/src/environment.zig @@ -13,9 +13,15 @@ pub fn getXdgConfigHomeDir(io: std.Io, env_map: *std.process.Environ.Map) !?std. } pub fn getLocale(env_map: *std.process.Environ.Map) ?[]const u8 { - if (env_map.get("LC_ALL")) |locale| return locale; - if (env_map.get("LC_CTYPE")) |locale| return locale; - if (env_map.get("LANG")) |locale| return locale; + if (env_map.get("LC_ALL")) |locale| { + if (locale.len > 0) return locale; + } + if (env_map.get("LC_CTYPE")) |locale| { + if (locale.len > 0) return locale; + } + if (env_map.get("LANG")) |locale| { + if (locale.len > 0) return locale; + } return null; }