i18n: export proper _ function

This commit is contained in:
Mitchell Hashimoto
2025-03-07 08:50:04 -08:00
parent 4cf127a064
commit 238573d42e

View File

@ -33,9 +33,14 @@ pub fn init(resources_dir: []const u8) InitError!void {
return error.OutOfMemory;
}
/// Translate a message for the Ghostty domain.
pub fn _(msgid: [*:0]const u8) [*:0]const u8 {
return dgettext(build_config.bundle_id, msgid);
}
// Manually include function definitions for the gettext functions
// as libintl.h isn't always easily available (e.g. in musl)
extern fn bindtextdomain(domainname: [*:0]const u8, dirname: [*:0]const u8) ?[*:0]const u8;
extern fn textdomain(domainname: [*:0]const u8) ?[*:0]const u8;
pub extern fn gettext(msgid: [*:0]const u8) [*:0]const u8;
pub const _ = gettext;
extern fn gettext(msgid: [*:0]const u8) [*:0]const u8;
extern fn dgettext(domainname: [*:0]const u8, msgid: [*:0]const u8) [*:0]const u8;