mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-22 21:15:57 +00:00
Add the menu and overlay text to the host catalog in English and Russian, menu_text for the menu language, and plat_ui_language for the Windows UI language
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8b514f6ead
commit
c79c614cee
5 files changed
+482
-22
No files matched your search
@@ -66,6 +66,8 @@ int plat_file_list(const char *dir, const char *ext, int (*cb)(const char *name,
|
||||
int plat_exe_path(char *out, size_t cap); // path of the running executable; 0 on failure
|
||||
// Environment variable as UTF-8 into out; its length, or 0 when unset, empty or too long for cap.
|
||||
size_t plat_getenv(const char *name, char *out, size_t cap);
|
||||
// The user's UI language as a BCP-47 tag ("ru-RU", "en-US"); "" when the system gives none. Valid for the process.
|
||||
const char *plat_ui_language(void);
|
||||
uint32_t plat_thread_id(void); // id of the calling thread, for unique file names
|
||||
|
||||
// ---- child processes: a program with stdin and stdout piped to us (stderr discarded), no console window.
|
||||
|
||||
@@ -294,6 +294,19 @@ size_t plat_getenv(const char *name, char *out, size_t cap) {
|
||||
|
||||
uint32_t plat_thread_id(void) { return GetCurrentThreadId(); }
|
||||
|
||||
const char *plat_ui_language(void) {
|
||||
static char tag[LOCALE_NAME_MAX_LENGTH];
|
||||
static int done;
|
||||
if (!done) {
|
||||
wchar_t w[LOCALE_NAME_MAX_LENGTH];
|
||||
LCID lcid = GetUserDefaultUILanguage();
|
||||
int n = LCIDToLocaleName(lcid, w, LOCALE_NAME_MAX_LENGTH, 0);
|
||||
if (n <= 0 || !WideCharToMultiByte(CP_UTF8, 0, w, -1, tag, sizeof tag, NULL, NULL)) tag[0] = 0;
|
||||
done = 1;
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
|
||||
// ---- child processes
|
||||
|
||||
struct PlatChild {
|
||||
|
||||
Reference in new issue
Block a user