feat(linux): add locale info

This commit is contained in:
utox39
2025-04-09 12:39:26 +02:00
parent 1cde267f5e
commit 4229fec461

View File

@@ -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.