diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-09-10 21:51:57 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-10 21:51:57 +0300 |
| commit | 425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch) | |
| tree | e52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/src/os/i18n.zig | |
| parent | 90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff) | |
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/src/os/i18n.zig')
| -rw-r--r-- | vendor/libghostty-vt/src/os/i18n.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/vendor/libghostty-vt/src/os/i18n.zig b/vendor/libghostty-vt/src/os/i18n.zig index 0f7790fa..20d3c1b9 100644 --- a/vendor/libghostty-vt/src/os/i18n.zig +++ b/vendor/libghostty-vt/src/os/i18n.zig @@ -62,11 +62,21 @@ pub fn initGlobalDomain() error{OutOfMemory}!void { } /// Translate a message for the Ghostty domain. +/// +/// If this is called at comptime, the direct msgid is returned without +/// translation. This still allows the string to be marked for translation +/// while remaining usable in comptime contexts. pub fn _(msgid: [*:0]const u8) [*:0]const u8 { if (comptime !build_config.i18n) return msgid; + if (@inComptime()) return msgid; return dgettext(build_config.bundle_id, msgid); } +/// Mark a string for translation without translating it immediately. +pub fn N_(msgid: [:0]const u8) [:0]const u8 { + return msgid; +} + /// Canonicalize a locale name from a platform-specific value to /// a POSIX-compliant value. This is a thin layer over the unexported /// gnulib-lib function in gettext that does this already. @@ -191,3 +201,10 @@ test "canonicalizeLocale darwin" { // underscores. We should parse them out before calling this function. try testing.expectEqualStrings("en_US.UTF_8", try canonicalizeLocale(&buf, "en_US.UTF-8")); } + +test "_ returns msgid at comptime" { + const testing = std.testing; + + const msgid = comptime @"_"("Ghostty"); + try testing.expectEqualStrings("Ghostty", std.mem.span(msgid)); +} |
