Skip to content

i18n: ignore non-UTF-8 LANGUAGE and use next valid locale env - #10631

Closed
EriksRemess wants to merge 1 commit into
ghostty-org:mainfrom
EriksRemess:main
Closed

EriksRemess wants to merge 1 commit into
ghostty-org:mainfrom
EriksRemess:main

Conversation

@EriksRemess

Copy link
Copy Markdown
Member

Currently my Ubuntu 25.10 sets LANGUAGE=lv:en which overrides otherwise valid locale settings like LC_ALL=lv_LV.UTF-8; this change updates ensureLocale function to unset LANGUAGE when it does not contain .UTF-8, then proceeds with normal locale initialization so a valid locale is applied.

@00-kat 00-kat added the translations Translations of the Ghostty app label Feb 10, 2026
@EriksRemess EriksRemess changed the title i18n: ignore non-UTF-8 LANGUAGE in ensureLocale to preserve valid locale fallback i18n: ignore non-UTF-8 LANGUAGE and use next valid locale env Feb 11, 2026

@pluiedev pluiedev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea appears to be sound but I would have to investigate more on what the expected syntax for LANGUAGE is

Comment thread src/os/locale.zig Outdated
if ((try internal_os.getenv(alloc, "LANGUAGE"))) |language| {
defer language.deinit(alloc);
if (language.value.len > 0 and
std.mem.indexOf(u8, language.value, ".UTF-8") == null)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think std.mem.endsWith(u8, language.value, ".UTF-8") makes more sense here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switched to .endsWith comparison

@EriksRemess

Copy link
Copy Markdown
Member Author

Looks like proper way would be not to include ".UTF-8" in .po file names. At least not on Linux.
Instead proper way would be for Latvian - lv.po, for languages with variants like Brazilian Portuguese - pt_BR.po
Then would use LANGUAGE env, split it by ":" and use locales by preference. In my case - lv (Latvian) first, then en (English) second.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

translations Translations of the Ghostty app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants