mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
build: i18n should emit mo on every platform
This commit is contained in:
10
build.zig
10
build.zig
@ -82,6 +82,16 @@ pub fn build(b: *std.Build) !void {
|
||||
{
|
||||
const run_cmd = b.addRunArtifact(exe.exe);
|
||||
if (b.args) |args| run_cmd.addArgs(args);
|
||||
|
||||
// Set the proper resources dir so things like shell integration
|
||||
// work correctly. If we're running `zig build run` in Ghostty,
|
||||
// this also ensures it overwrites the release one with our debug
|
||||
// build.
|
||||
run_cmd.setEnvironmentVariable(
|
||||
"GHOSTTY_RESOURCES_DIR",
|
||||
b.getInstallPath(.prefix, "share/ghostty"),
|
||||
);
|
||||
|
||||
const run_step = b.step("run", "Run the app");
|
||||
run_step.dependOn(&run_cmd.step);
|
||||
}
|
||||
|
@ -18,23 +18,22 @@ steps: []*std.Build.Step,
|
||||
update_step: *std.Build.Step,
|
||||
|
||||
pub fn init(b: *std.Build, cfg: *const Config) !GhosttyI18n {
|
||||
_ = cfg;
|
||||
|
||||
var steps = std.ArrayList(*std.Build.Step).init(b.allocator);
|
||||
defer steps.deinit();
|
||||
|
||||
if (cfg.app_runtime == .gtk) {
|
||||
// Output the .mo files used by the GTK apprt
|
||||
inline for (locales) |locale| {
|
||||
const msgfmt = b.addSystemCommand(&.{ "msgfmt", "-o", "-" });
|
||||
msgfmt.addFileArg(b.path("po/" ++ locale ++ ".po"));
|
||||
inline for (locales) |locale| {
|
||||
const msgfmt = b.addSystemCommand(&.{ "msgfmt", "-o", "-" });
|
||||
msgfmt.addFileArg(b.path("po/" ++ locale ++ ".po"));
|
||||
|
||||
try steps.append(&b.addInstallFile(
|
||||
msgfmt.captureStdOut(),
|
||||
std.fmt.comptimePrint(
|
||||
"share/locale/{s}/LC_MESSAGES/{s}.mo",
|
||||
.{ locale, domain },
|
||||
),
|
||||
).step);
|
||||
}
|
||||
try steps.append(&b.addInstallFile(
|
||||
msgfmt.captureStdOut(),
|
||||
std.fmt.comptimePrint(
|
||||
"share/locale/{s}/LC_MESSAGES/{s}.mo",
|
||||
.{ locale, domain },
|
||||
),
|
||||
).step);
|
||||
}
|
||||
|
||||
return .{
|
||||
|
@ -1,6 +1,8 @@
|
||||
const std = @import("std");
|
||||
const build_config = @import("../build_config.zig");
|
||||
|
||||
const log = std.log.scoped(.i18n);
|
||||
|
||||
pub const InitError = error{
|
||||
InvalidResourcesDir,
|
||||
OutOfMemory,
|
||||
@ -26,6 +28,7 @@ pub fn init(resources_dir: []const u8) InitError!void {
|
||||
return error.OutOfMemory;
|
||||
|
||||
// Bind our bundle ID to the given locale path
|
||||
log.debug("binding domain={s} path={s}", .{ build_config.bundle_id, path });
|
||||
_ = bindtextdomain(build_config.bundle_id, path.ptr) orelse
|
||||
return error.OutOfMemory;
|
||||
}
|
||||
|
Reference in New Issue
Block a user