mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
fix: enable i18n on FreeBSD
This commit is contained in:
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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.
|
||||
|
Reference in New Issue
Block a user