Multiple language-related updates
Add the possibility to change runtime language, via --lang parameter. Also specify the verbose language code in the Hungarian translation.
This commit is contained in:
13
src/86box.c
13
src/86box.c
@@ -433,6 +433,7 @@ usage:
|
|||||||
#endif
|
#endif
|
||||||
printf("-F or --fullscreen - start in fullscreen mode\n");
|
printf("-F or --fullscreen - start in fullscreen mode\n");
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
printf("-G or --lang langid - start the application with the specified language\n");
|
||||||
printf("-H or --hwnd id,hwnd - sends back the main dialog's hwnd\n");
|
printf("-H or --hwnd id,hwnd - sends back the main dialog's hwnd\n");
|
||||||
#endif
|
#endif
|
||||||
printf("-L or --logfile path - set 'path' to be the logfile\n");
|
printf("-L or --logfile path - set 'path' to be the logfile\n");
|
||||||
@@ -512,6 +513,18 @@ usage:
|
|||||||
uid = (uint32_t *) &unique_id;
|
uid = (uint32_t *) &unique_id;
|
||||||
shwnd = (uint32_t *) &source_hwnd;
|
shwnd = (uint32_t *) &source_hwnd;
|
||||||
sscanf(argv[++c], "%08X%08X,%08X%08X", uid + 1, uid, shwnd + 1, shwnd);
|
sscanf(argv[++c], "%08X%08X,%08X%08X", uid + 1, uid, shwnd + 1, shwnd);
|
||||||
|
} else if (!strcasecmp(argv[c], "--lang") ||
|
||||||
|
!strcasecmp(argv[c], "-G")) {
|
||||||
|
|
||||||
|
|
||||||
|
//This function is currently unimplemented for *nix.
|
||||||
|
|
||||||
|
if (!plat_set_language(argv[++c]))
|
||||||
|
printf("\nWarning: Invalid language code, ignoring --lang parameter.\n\n");
|
||||||
|
|
||||||
|
//The return value of 0 only means that the code is invalid,
|
||||||
|
// not related to that translation is exists or not for the
|
||||||
|
// selected language.
|
||||||
#endif
|
#endif
|
||||||
} else if (!strcasecmp(argv[c], "--test")) {
|
} else if (!strcasecmp(argv[c], "--test")) {
|
||||||
/* some (undocumented) test function here.. */
|
/* some (undocumented) test function here.. */
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ extern void plat_setfullscreen(int on);
|
|||||||
extern void plat_resize(int x, int y);
|
extern void plat_resize(int x, int y);
|
||||||
extern void plat_vidapi_enable(int enabled);
|
extern void plat_vidapi_enable(int enabled);
|
||||||
extern void plat_vid_reload_options(void);
|
extern void plat_vid_reload_options(void);
|
||||||
|
extern int plat_set_language(char* langcode);
|
||||||
|
|
||||||
/* Resource management. */
|
/* Resource management. */
|
||||||
extern void set_language(int id);
|
extern void set_language(int id);
|
||||||
|
|||||||
@@ -1220,6 +1220,14 @@ char* plat_vidapi_name(int i)
|
|||||||
{
|
{
|
||||||
return "default";
|
return "default";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Sets up the program language before initialization. */
|
||||||
|
int plat_set_language(char* langcode)
|
||||||
|
{
|
||||||
|
/* or maybe not */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void joystick_init(void) {}
|
void joystick_init(void) {}
|
||||||
void joystick_close(void) {}
|
void joystick_close(void) {}
|
||||||
void joystick_process(void) {}
|
void joystick_process(void) {}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
LANGUAGE 0x0E,0x01
|
LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
|
||||||
#pragma code_page(65001)
|
#pragma code_page(65001)
|
||||||
#endif //_WIN32
|
#endif //_WIN32
|
||||||
|
|
||||||
|
|||||||
@@ -1163,6 +1163,23 @@ plat_vid_reload_options(void)
|
|||||||
vid_apis[vid_api].reload();
|
vid_apis[vid_api].reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Sets up the program language before initialization. */
|
||||||
|
int
|
||||||
|
plat_set_language(char* langcode)
|
||||||
|
{
|
||||||
|
int len = mbstoc16s(NULL, langcode, 0) + 1;
|
||||||
|
wchar_t *temp = malloc(len * sizeof(wchar_t));
|
||||||
|
mbstoc16s(temp, langcode, len);
|
||||||
|
|
||||||
|
LCID lcid = LocaleNameToLCID((LPWSTR)temp, 0);
|
||||||
|
|
||||||
|
free(temp);
|
||||||
|
|
||||||
|
if (lcid)
|
||||||
|
return (SetThreadUILanguage(lcid) == lcid);
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
take_screenshot(void)
|
take_screenshot(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user