Add reverse conversion from string to LCID

This commit is contained in:
Laci bá
2021-11-13 23:51:29 +01:00
parent bf3767bc4a
commit dfa795b267
2 changed files with 17 additions and 0 deletions

View File

@@ -123,6 +123,7 @@ extern void plat_resize(int x, int y);
extern void plat_vidapi_enable(int enabled);
extern void plat_vid_reload_options(void);
extern uint32_t plat_language_code(char* langcode);
extern void plat_language_code_r(uint32_t lcid, char* outbuf, int len);
/* Resource management. */
extern void set_language(uint32_t id);

View File

@@ -1221,6 +1221,22 @@ plat_language_code(char* langcode)
return lcid;
}
/* Converts back the language code to LCID */
void
plat_language_code_r(uint32_t lcid, char* outbuf, int len)
{
if (lcid == 0xFFFF)
{
strcpy(outbuf, "system");
return;
}
wchar_t buffer[LOCALE_NAME_MAX_LENGTH + 1];
LCIDToLocaleName(lcid, buffer, LOCALE_NAME_MAX_LENGTH, 0);
c16stombs(outbuf, buffer, len);
}
void
take_screenshot(void)
{