diff --git a/build.zig b/build.zig index b5428bc41..80af88488 100644 --- a/build.zig +++ b/build.zig @@ -46,7 +46,7 @@ pub fn build(b: *std.Build) !void { if (config.app_runtime != .none) { exe.install(); resources.install(); - if (builtin.target.os.tag != .freebsd) i18n.install(); + i18n.install(); } // Libghostty diff --git a/src/build/GhosttyI18n.zig b/src/build/GhosttyI18n.zig index a1852bb96..dce96628f 100644 --- a/src/build/GhosttyI18n.zig +++ b/src/build/GhosttyI18n.zig @@ -1,6 +1,7 @@ const GhosttyI18n = @This(); const std = @import("std"); +const builtin = @import("builtin"); const Config = @import("Config.zig"); const gresource = @import("../apprt/gtk/gresource.zig"); const internal_os = @import("../os/main.zig"); @@ -21,6 +22,11 @@ pub fn init(b: *std.Build, cfg: *const Config) !GhosttyI18n { defer steps.deinit(); inline for (internal_os.i18n.locales) |locale| { + const target_locale = comptime if (builtin.target.os.tag == .freebsd) + std.mem.trimRight(u8, locale, ".UTF-8") + else + locale; + const msgfmt = b.addSystemCommand(&.{ "msgfmt", "-o", "-" }); msgfmt.addFileArg(b.path("po/" ++ locale ++ ".po")); @@ -28,7 +34,7 @@ pub fn init(b: *std.Build, cfg: *const Config) !GhosttyI18n { msgfmt.captureStdOut(), std.fmt.comptimePrint( "share/locale/{s}/LC_MESSAGES/{s}.mo", - .{ locale, domain }, + .{ target_locale, domain }, ), ).step); } diff --git a/src/os/i18n.zig b/src/os/i18n.zig index 69194b4fb..2d24a720e 100644 --- a/src/os/i18n.zig +++ b/src/os/i18n.zig @@ -70,7 +70,7 @@ pub const InitError = error{ pub fn init(resources_dir: []const u8) InitError!void { // i18n is unsupported on Windows switch (builtin.os.tag) { - .windows, .freebsd => return, + .windows => return, else => { // Our resources dir is always nested below the share dir that // is standard for translations.