switch to en_US when use text mode.

This commit is contained in:
longpanda 2023-01-10 16:17:08 +08:00
parent 2b3192b098
commit e0132ac4b5
5 changed files with 39 additions and 2 deletions

View File

@ -951,12 +951,12 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
menu_fini ();
if (g_ventoy_terminal_output == 0)
{
grub_script_execute_sourcecode("terminal_output console");
grub_script_execute_sourcecode("vt_push_menu_lang en_US\nterminal_output console");
g_ventoy_terminal_output = 1;
}
else
{
grub_script_execute_sourcecode("terminal_output gfxterm");
grub_script_execute_sourcecode("terminal_output gfxterm\nvt_pop_menu_lang");
g_ventoy_terminal_output = 0;
}
goto refresh;

View File

@ -6951,6 +6951,8 @@ static cmd_para ventoy_cmds[] =
{ "vt_cur_menu_lang", ventoy_cmd_cur_menu_lang, 0, NULL, "", "", NULL },
{ "vt_vtoychksum_exist", ventoy_cmd_vtoychksum_exist, 0, NULL, "", "", NULL },
{ "vt_cmp_checksum", ventoy_cmd_cmp_checksum, 0, NULL, "", "", NULL },
{ "vt_push_menu_lang", ventoy_cmd_push_menulang, 0, NULL, "", "", NULL },
{ "vt_pop_menu_lang", ventoy_cmd_pop_menulang, 0, NULL, "", "", NULL },
};

View File

@ -1313,6 +1313,8 @@ grub_err_t ventoy_cmd_cur_menu_lang(grub_extcmd_context_t ctxt, int argc, char *
extern int ventoy_menu_push_key(int code);
int ventoy_ctrl_var_init(void);
int ventoy_global_var_init(void);
grub_err_t ventoy_cmd_push_menulang(grub_extcmd_context_t ctxt, int argc, char **args);
grub_err_t ventoy_cmd_pop_menulang(grub_extcmd_context_t ctxt, int argc, char **args);
#endif /* __VENTOY_DEF_H__ */

View File

@ -66,6 +66,7 @@ static theme_list *g_theme_head = NULL;
static int g_theme_random = vtoy_theme_random_boot_second;
static char g_theme_single_file[256];
static char g_cur_menu_language[32] = {0};
static char g_push_menu_language[32] = {0};
static int ventoy_plugin_is_parent(const char *pat, int patlen, const char *isopath)
{
@ -3624,3 +3625,33 @@ grub_err_t ventoy_cmd_cur_menu_lang(grub_extcmd_context_t ctxt, int argc, char *
VENTOY_CMD_RETURN(0);
}
grub_err_t ventoy_cmd_push_menulang(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)argc;
(void)ctxt;
if (g_push_menu_language[0] == 0)
{
grub_memcpy(g_push_menu_language, g_cur_menu_language, sizeof(g_push_menu_language));
ventoy_plugin_load_menu_lang(0, args[0]);
}
VENTOY_CMD_RETURN(0);
}
grub_err_t ventoy_cmd_pop_menulang(grub_extcmd_context_t ctxt, int argc, char **args)
{
(void)argc;
(void)ctxt;
(void)args;
if (g_push_menu_language[0])
{
ventoy_plugin_load_menu_lang(0, g_push_menu_language);
g_push_menu_language[0] = 0;
}
VENTOY_CMD_RETURN(0);
}

View File

@ -83,10 +83,12 @@ submenu "$VTLANG_RESOLUTION_CFG" --class=debug_resolution --class=F5tool {
submenu "$VTLANG_SCREEN_MODE" --class=debug_screen_mode --class=F5tool {
menuentry "$VTLANG_SCREEN_TEXT_MODE" --class=debug_text_mode --class=debug_screen_mode --class=F5tool {
vt_push_menu_lang en_US
terminal_output console
}
menuentry "$VTLANG_SCREEN_GUI_MODE" --class=debug_gui_mode --class=debug_screen_mode --class=F5tool {
terminal_output gfxterm
vt_pop_menu_lang
}
menuentry "$VTLANG_RETURN_PREVIOUS" --class=vtoyret VTOY_RET {
echo "Return ..."