From 4229fec461e955ea4111f4c72ddc14c78407600f Mon Sep 17 00:00:00 2001 From: utox39 Date: Wed, 9 Apr 2025 12:39:26 +0200 Subject: [PATCH] feat(linux): add locale info --- src/linux/system.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/linux/system.zig b/src/linux/system.zig index cc838f6..e6068cc 100644 --- a/src/linux/system.zig +++ b/src/linux/system.zig @@ -23,6 +23,13 @@ pub fn getHostname(allocator: std.mem.Allocator) ![]u8 { return hostname; } +pub fn getLocale(allocator: std.mem.Allocator) ![]u8 { + const locale = std.process.getEnvVarOwned(allocator, "LANG") catch |err| if (err == error.EnvironmentVariableNotFound) { + return allocator.dupe(u8, "Unknown"); + } else return err; + return locale; +} + /// Returns the system uptime. /// /// Uses `sysinfo` to fetch the system uptime and calculates the elapsed time.