update translating readme

This commit is contained in:
Mitchell Hashimoto
2025-03-07 10:33:09 -08:00
parent be839cb681
commit 3ebd5b839f
2 changed files with 18 additions and 3 deletions

View File

@ -131,14 +131,18 @@ which should be filled in accordingly. You can then add your translations
within the newly created translation file.
Afterwards, you need to update the list of known locales within Ghostty's
build system. To do so, open `src/build/GhosttyI18n.zig` and find the list
of locales under the `locale` variable, then append the full locale name
build system. To do so, open `src/os/i81n.zig` and find the list
of locales under the `locales` variable, then add the full locale name
into the list.
The order matters, so make sure to place your locale in the correct position.
Read the comment above the variable for more details on the order. If you're
unsure, place it at the end of the list.
```zig
const locales = [_][]const u8{
"zh_CN.UTF-8",
// <- Add your locale here
// <- Add your locale here (probably)
}
```

View File

@ -11,6 +11,17 @@ const log = std.log.scoped(.i18n);
/// a language code available), the first match is used. For example, if
/// we know the user requested `zh` but has no region code, then we'd pick
/// the first locale that matches `zh`.
///
/// For ordering, we prefer:
///
/// 1. The most common locales first, since there are places in the code
/// where we do linear searches for a locale and we want to minimize
/// the number of iterations for the common case.
///
/// 2. Alphabetical for otherwise equally common locales.
///
/// 3. Most preferred locale for a language without a country code.
///
pub const locales = [_][:0]const u8{
"zh_CN.UTF-8",
};