diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/commands/menuentry.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/commands/menuentry.c index 9faf2be0..cb74cd92 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/commands/menuentry.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/commands/menuentry.c @@ -25,6 +25,10 @@ #include #include +typedef const char * (*get_vmenu_title_pf)(const char *vMenu); +static get_vmenu_title_pf g_pfvmenu_title = NULL; + + static const struct grub_arg_option options[] = { {"class", 1, GRUB_ARG_OPTION_REPEATABLE, @@ -86,6 +90,8 @@ grub_normal_add_menu_entry (int argc, const char **args, char *menu_title = NULL; char *menu_sourcecode = NULL; char *menu_id = NULL; + const char *vmenu = NULL; + const char *vaddr = NULL; struct grub_menu_entry_class *menu_classes = NULL; grub_menu_t menu; @@ -145,7 +151,17 @@ grub_normal_add_menu_entry (int argc, const char **args, goto fail; } - menu_title = grub_strdup (args[0]); + if (!g_pfvmenu_title) { + vaddr = grub_env_get("VTOY_VMENU_FUNC_ADDR"); + if (vaddr) + g_pfvmenu_title = (get_vmenu_title_pf)(unsigned long)grub_strtoul(vaddr, NULL, 16); + } + + if (g_pfvmenu_title && grub_strncmp(args[0], "@VTMENU_", 8) == 0) + vmenu = g_pfvmenu_title(args[0] + 1); + + menu_title = grub_strdup (vmenu ? vmenu : args[0]); + if (! menu_title) goto fail; diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/gfxmenu/gui_label.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/gfxmenu/gui_label.c index 63d8c7be..008cfd5a 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/gfxmenu/gui_label.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/gfxmenu/gui_label.c @@ -31,6 +31,7 @@ extern int g_ventoy_iso_raw; extern int g_ventoy_grub2_mode; extern int g_ventoy_wimboot_mode; extern int g_ventoy_iso_uefi_drv; +extern char g_ventoy_hotkey_tip[256]; static const char *align_options[] = { @@ -230,10 +231,7 @@ label_set_property (void *vself, const char *name, const char *value) value = g_ventoy_iso_uefi_drv ? grub_env_get("VTOY_ISO_UEFI_DRV_STR") : " "; } else if (grub_strcmp (value, "@VTOY_HOTKEY_TIP@") == 0) { - value = grub_env_get("VTOY_HOTKEY_TIP"); - if (value == NULL) { - value = _(" "); - } + value = g_ventoy_hotkey_tip; } self->template = grub_strdup (value); diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c index aa23be3b..ddd79484 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu.c @@ -50,6 +50,8 @@ int g_ventoy_menu_esc = 0; int g_ventoy_fn_mutex = 0; int g_ventoy_secondary_menu_on = 0; int g_ventoy_terminal_output = 0; +char g_ventoy_hotkey_tip[256]; +int g_ventoy_virt_esc = 0; #define VTOY_COMM_HOTKEY(cmdkey) \ if (0 == g_ventoy_fn_mutex && 0 == g_ventoy_secondary_menu_on) { \ @@ -796,7 +798,12 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot) return default_entry; } - c = grub_getkey_noblock (); + if (g_ventoy_virt_esc > 0) { + c = GRUB_TERM_ESC; + g_ventoy_virt_esc--; + } else { + c = grub_getkey_noblock (); + } /* Negative values are returned on error. */ if ((c != GRUB_TERM_NO_KEY) && (c > 0)) diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu_text.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu_text.c index 24aa094d..549d9029 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu_text.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/normal/menu_text.c @@ -31,6 +31,8 @@ static grub_uint8_t grub_color_menu_normal; static grub_uint8_t grub_color_menu_highlight; +extern char g_ventoy_hotkey_tip[256]; + struct menu_viewer_data { int first, offset; @@ -204,7 +206,7 @@ command-line or ESC to discard edits and return to the GRUB menu."), ret += grub_print_message_indented_real(szLine, STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); ret += grub_print_message_indented_real("\n", STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run); - ret += grub_print_message_indented_real(grub_env_get("VTOY_HOTKEY_TIP"), + ret += grub_print_message_indented_real(g_ventoy_hotkey_tip, 3, 6, term, dry_run); } } diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c index 785e4978..768faf0e 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_browser.c @@ -616,13 +616,15 @@ grub_err_t ventoy_cmd_browser_disk(grub_extcmd_context_t ctxt, int argc, char ** if (g_tree_view_menu_style == 0) { - browser_ssprintf(&mbuf, "menuentry \"%-10s [Return]\" --class=\"vtoyret\" VTOY_RET {\n " - " echo 'return ...' \n}\n", "<--"); + browser_ssprintf(&mbuf, "menuentry \"%-10s [%s]\" --class=\"vtoyret\" VTOY_RET {\n " + " echo 'return ...' \n}\n", "<--", + ventoy_get_vmenu_title("VTMENU_BROWER_RETURN")); } else { - browser_ssprintf(&mbuf, "menuentry \"[Return]\" --class=\"vtoyret\" VTOY_RET {\n " - " echo 'return ...' \n}\n"); + browser_ssprintf(&mbuf, "menuentry \"[%s]\" --class=\"vtoyret\" VTOY_RET {\n " + " echo 'return ...' \n}\n", + ventoy_get_vmenu_title("VTMENU_BROWER_RETURN")); } grub_disk_dev_iterate(ventoy_browser_iterate_disk, &mbuf); diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c index 73e98215..4fbfe7f7 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_cmd.c @@ -2346,16 +2346,16 @@ static int ventoy_dynamic_tree_menu(img_iterator_node *node) if (g_tree_view_menu_style == 0) { vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, - "menuentry \"%-10s [Return to ListView]\" --class=\"vtoyret\" VTOY_RET {\n " + "menuentry \"%-10s [%s]\" --class=\"vtoyret\" VTOY_RET {\n " " echo 'return ...' \n" - "}\n", "<--"); + "}\n", "<--", ventoy_get_vmenu_title("VTMENU_RET_TO_LISTVIEW")); } else { vtoy_ssprintf(g_tree_script_buf, g_tree_script_pos, - "menuentry \"[Return to ListView]\" --class=\"vtoyret\" VTOY_RET {\n " + "menuentry \"[%s]\" --class=\"vtoyret\" VTOY_RET {\n " " echo 'return ...' \n" - "}\n"); + "}\n", ventoy_get_vmenu_title("VTMENU_RET_TO_LISTVIEW")); } } @@ -2934,9 +2934,9 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char if (g_default_menu_mode == 1) { vtoy_ssprintf(g_list_script_buf, g_list_script_pos, - "menuentry \"%s [Return to TreeView]\" --class=\"vtoyret\" VTOY_RET {\n " + "menuentry \"%s [%s]\" --class=\"vtoyret\" VTOY_RET {\n " " echo 'return ...' \n" - "}\n", "<--"); + "}\n", "<--", ventoy_get_vmenu_title("VTMENU_RET_TO_TREEVIEW")); } for (cur = g_ventoy_img_list; cur; cur = cur->next) @@ -3705,13 +3705,14 @@ static grub_err_t ventoy_cmd_sel_auto_install(grub_extcmd_context_t ctxt, int ar vtoy_ssprintf(buf, pos, "set timeout=%d\n", node->timeout); } - vtoy_ssprintf(buf, pos, "menuentry \"Boot without auto installation template\" --class=\"sel_auto_install\" {\n" + vtoy_ssprintf(buf, pos, "menuentry \"@VTMENU_NO_AUTOINS_SCRIPT\" --class=\"sel_auto_install\" {\n" " echo %s\n}\n", ""); for (i = 0; i < node->templatenum; i++) { - vtoy_ssprintf(buf, pos, "menuentry \"Boot with %s\" --class=\"sel_auto_install\" {\n" + vtoy_ssprintf(buf, pos, "menuentry \"%s %s\" --class=\"sel_auto_install\" {\n" " echo \"\"\n}\n", + ventoy_get_vmenu_title("VTMENU_AUTOINS_USE"), node->templatepath[i].path); } @@ -3811,13 +3812,14 @@ static grub_err_t ventoy_cmd_sel_persistence(grub_extcmd_context_t ctxt, int arg vtoy_ssprintf(buf, pos, "set timeout=%d\n", node->timeout); } - vtoy_ssprintf(buf, pos, "menuentry \"Boot without persistence\" --class=\"sel_persistence\" {\n" + vtoy_ssprintf(buf, pos, "menuentry \"@VTMENU_NO_PERSISTENCE\" --class=\"sel_persistence\" {\n" " echo %s\n}\n", ""); for (i = 0; i < node->backendnum; i++) { - vtoy_ssprintf(buf, pos, "menuentry \"Boot with %s\" --class=\"sel_persistence\" {\n" + vtoy_ssprintf(buf, pos, "menuentry \"%s %s\" --class=\"sel_persistence\" {\n" " echo \"\"\n}\n", + ventoy_get_vmenu_title("VTMENU_PERSIST_USE"), node->backendpath[i].path); } @@ -6073,26 +6075,26 @@ static grub_err_t ventoy_cmd_show_secondary_menu(grub_extcmd_context_t ctxt, int fsize = grub_strtoull(args[2], NULL, 10); - vtoy_dummy_menuentry(cmd, pos, len, "Boot in normal mode", "second_normal"); seldata[n++] = 1; + vtoy_dummy_menuentry(cmd, pos, len, "@VTMENU_NORMAL_MODE", "second_normal"); seldata[n++] = 1; if (grub_strcmp(args[1], "Unix") != 0) { if (grub_strcmp(args[1], "Windows") == 0) { - vtoy_dummy_menuentry(cmd, pos, len, "Boot in wimboot mode", "second_wimboot"); seldata[n++] = 2; + vtoy_dummy_menuentry(cmd, pos, len, "@VTMENU_WIMBOOT_MODE", "second_wimboot"); seldata[n++] = 2; } else { - vtoy_dummy_menuentry(cmd, pos, len, "Boot in grub2 mode", "second_grub2"); seldata[n++] = 3; + vtoy_dummy_menuentry(cmd, pos, len, "@VTMENU_GRUB2_MODE", "second_grub2"); seldata[n++] = 3; } if (fsize <= VTOY_SIZE_1GB) { - vtoy_dummy_menuentry(cmd, pos, len, "Boot in memdisk mode", "second_memdisk"); seldata[n++] = 4; + vtoy_dummy_menuentry(cmd, pos, len, "@VTMENU_MEMDISK_MODE", "second_memdisk"); seldata[n++] = 4; } } - vtoy_dummy_menuentry(cmd, pos, len, "File checksum", "second_checksum"); seldata[n++] = 5; + vtoy_dummy_menuentry(cmd, pos, len, "@VTMENU_FILE_CHKSUM", "second_checksum"); seldata[n++] = 5; do { g_ventoy_menu_esc = 1; @@ -6175,6 +6177,15 @@ static grub_err_t ventoy_cmd_fs_ignore_case(grub_extcmd_context_t ctxt, int argc return 0; } +static grub_err_t ventoy_cmd_load_menu_lang(grub_extcmd_context_t ctxt, int argc, char **args) +{ + (void)ctxt; + (void)argc; + + ventoy_plugin_load_menu_lang(args[0]); + VENTOY_CMD_RETURN(0); +} + int ventoy_env_init(void) { int i; @@ -6216,6 +6227,10 @@ int ventoy_env_init(void) grub_snprintf(buf, sizeof(buf), "0x%lx", (ulong)ventoy_chain_file_read); grub_env_set("vtoy_chain_file_read", buf); grub_env_export("vtoy_chain_file_read"); + + grub_snprintf(buf, sizeof(buf), "0x%lx", (ulong)ventoy_get_vmenu_title); + grub_env_set("VTOY_VMENU_FUNC_ADDR", buf); + grub_env_export("VTOY_VMENU_FUNC_ADDR"); return 0; } @@ -6383,6 +6398,8 @@ static cmd_para ventoy_cmds[] = { "vt_systemd_menu", ventoy_cmd_linux_systemd_menu, 0, NULL, "", "", NULL }, { "vt_limine_menu", ventoy_cmd_linux_limine_menu, 0, NULL, "", "", NULL }, { "vt_secondary_recover_mode", ventoy_cmd_secondary_recover_mode, 0, NULL, "", "", NULL }, + { "vt_load_menu_lang", ventoy_cmd_load_menu_lang, 0, NULL, "", "", NULL }, + { "vt_cur_menu_lang", ventoy_cmd_cur_menu_lang, 0, NULL, "", "", NULL }, }; int ventoy_register_all_cmd(void) diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h index 89119ac8..75d98da3 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h @@ -1053,6 +1053,10 @@ extern int g_ventoy_case_insensitive; extern int g_ventoy_fn_mutex; extern grub_uint8_t g_ventoy_chain_type; extern int g_vhdboot_enable; +extern int g_default_menu_mode; +extern char g_ventoy_hotkey_tip[256]; +extern int g_ventoy_menu_refresh; +extern int g_ventoy_virt_esc; #define VENTOY_IMG_WHITE_LIST 1 #define VENTOY_IMG_BLACK_LIST 2 @@ -1258,6 +1262,9 @@ grub_err_t ventoy_cmd_browser_disk(grub_extcmd_context_t ctxt, int argc, char ** int ventoy_get_fs_type(const char *fs); int ventoy_img_name_valid(const char *filename, grub_size_t namelen); void * ventoy_alloc_chain(grub_size_t size); +int ventoy_plugin_load_menu_lang(const char *lang); +const char *ventoy_get_vmenu_title(const char *vMenu); +grub_err_t ventoy_cmd_cur_menu_lang(grub_extcmd_context_t ctxt, int argc, char **args); #endif /* __VENTOY_DEF_H__ */ diff --git a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c index b0dd1d52..aad1cbfa 100644 --- a/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c +++ b/GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c @@ -56,12 +56,14 @@ static injection_config *g_injection_head = NULL; static auto_memdisk *g_auto_memdisk_head = NULL; static image_list *g_image_list_head = NULL; static conf_replace *g_conf_replace_head = NULL; +static VTOY_JSON *g_menu_lang_json = NULL; static int g_theme_id = 0; static int g_theme_num = 0; 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 int ventoy_plugin_is_parent(const char *pat, int patlen, const char *isopath) { @@ -2446,6 +2448,7 @@ grub_err_t ventoy_cmd_load_plugin(grub_extcmd_context_t ctxt, int argc, char **a int ret = 0; int offset = 0; char *buf = NULL; + const char *env = NULL; grub_uint8_t *code = NULL; grub_file_t file; VTOY_JSON *json = NULL; @@ -2539,6 +2542,9 @@ grub_err_t ventoy_cmd_load_plugin(grub_extcmd_context_t ctxt, int argc, char **a grub_env_unset("VTOY_MENU_TIP_ENABLE"); } + env = grub_env_get("VTOY_MENU_LANGUAGE"); + ventoy_plugin_load_menu_lang(env ? env : "en_US"); + VENTOY_CMD_RETURN(GRUB_ERR_NONE); } @@ -3369,7 +3375,7 @@ grub_err_t ventoy_cmd_select_theme_cfg(grub_extcmd_context_t ctxt, int argc, cha } pos += grub_snprintf(buf + pos, bufsize - pos, - "menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {\n" + "menuentry '@VTMENU_RETURN_PREVIOUS' --class=vtoyret VTOY_RET {\n" "echo 'Return ...'\n" "}\n"); @@ -3467,3 +3473,87 @@ grub_err_t ventoy_cmd_set_theme_path(grub_extcmd_context_t ctxt, int argc, char VENTOY_CMD_RETURN(GRUB_ERR_NONE); } +const char *ventoy_get_vmenu_title(const char *vMenu) +{ + return vtoy_json_get_string_ex(g_menu_lang_json->pstChild, vMenu); +} + +int ventoy_plugin_load_menu_lang(const char *lang) +{ + int ret = 1; + grub_file_t file = NULL; + char *buf = NULL; + + if (grub_strcmp(lang, g_cur_menu_language) == 0) + { + debug("Same menu lang %s\n", lang); + return 0; + } + grub_snprintf(g_cur_menu_language, sizeof(g_cur_menu_language), "%s", lang); + + debug("Load menu lang %s\n", g_cur_menu_language); + + if (g_menu_lang_json) + { + vtoy_json_destroy(g_menu_lang_json); + g_menu_lang_json = NULL; + } + + g_menu_lang_json = vtoy_json_create(); + if (!g_menu_lang_json) + { + goto end; + } + + file = ventoy_grub_file_open(GRUB_FILE_TYPE_LINUX_INITRD, "(vt_menu_tarfs)/menu/%s.json", lang); + if (!file) + { + goto end; + } + + buf = grub_malloc(file->size + 1); + if (!buf) + { + grub_printf("Failed to malloc memory %lu.\n", (ulong)(file->size + 1)); + goto end; + } + + buf[file->size] = 0; + grub_file_read(file, buf, file->size); + + vtoy_json_parse(g_menu_lang_json, buf); + + if (g_default_menu_mode == 0) + { + grub_snprintf(g_ventoy_hotkey_tip, sizeof(g_ventoy_hotkey_tip), "%s", ventoy_get_vmenu_title("VTMENU_STR_HOTKEY_TREE")); + } + else + { + grub_snprintf(g_ventoy_hotkey_tip, sizeof(g_ventoy_hotkey_tip), "%s", ventoy_get_vmenu_title("VTMENU_STR_HOTKEY_LIST")); + } + + g_ventoy_virt_esc = 2; + g_ventoy_menu_refresh = 1; + ret = 0; + +end: + + check_free(file, grub_file_close); + grub_check_free(buf); + + return ret; +} + +grub_err_t ventoy_cmd_cur_menu_lang(grub_extcmd_context_t ctxt, int argc, char **args) +{ + (void)ctxt; + (void)argc; + (void)args; + + grub_printf("%s\n", g_cur_menu_language); + grub_printf("%s\n", g_ventoy_hotkey_tip); + grub_refresh(); + + VENTOY_CMD_RETURN(0); +} + diff --git a/INSTALL/grub/checksum.cfg b/INSTALL/grub/checksum.cfg index 21dd0de0..b57de6ef 100644 --- a/INSTALL/grub/checksum.cfg +++ b/INSTALL/grub/checksum.cfg @@ -1,7 +1,7 @@ if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.md5" ]; then set default=0 - menuentry "Calculate and check md5sum" --class=checksum_md5 { + menuentry "@VTMENU_CHKSUM_MD5_CALC_CHK" --class=checksum_md5 { md5sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}" vt_1st_line "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.md5" vtReadChecksum @@ -18,7 +18,7 @@ if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.md5" ]; then read vtInputKey } else - menuentry "Calculate md5sum" --class=checksum_md5 { + menuentry "@VTMENU_CHKSUM_MD5_CALC" --class=checksum_md5 { md5sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}" echo -e "\n\npress ENTER to exit ..." @@ -28,7 +28,7 @@ fi if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha1" ]; then set default=1 - menuentry "Calculate and check sha1sum" --class=checksum_sha1 { + menuentry "@VTMENU_CHKSUM_SHA1_CALC_CHK" --class=checksum_sha1 { sha1sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}" vt_1st_line "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha1" vtReadChecksum @@ -45,7 +45,7 @@ if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha1" ]; then read vtInputKey } else - menuentry "Calculate sha1sum" --class=checksum_sha1 { + menuentry "@VTMENU_CHKSUM_SHA1_CALC" --class=checksum_sha1 { sha1sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}" echo -e "\n\npress ENTER to exit ..." @@ -57,7 +57,7 @@ fi if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha256" ]; then set default=2 - menuentry "Calculate and check sha256sum" --class=checksum_sha256 { + menuentry "@VTMENU_CHKSUM_SHA256_CALC_CHK" --class=checksum_sha256 { sha256sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}" vt_1st_line "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha256" vtReadChecksum @@ -74,7 +74,7 @@ if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha256" ]; then read vtInputKey } else - menuentry "Calculate sha256sum" --class=checksum_sha256 { + menuentry "@VTMENU_CHKSUM_SHA256_CALC" --class=checksum_sha256 { sha256sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}" echo -e "\n\npress ENTER to exit ..." @@ -86,7 +86,7 @@ fi if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha512" ]; then set default=3 - menuentry "Calculate and check sha512sum" --class=checksum_sha512{ + menuentry "@VTMENU_CHKSUM_SHA512_CALC_CHK" --class=checksum_sha512{ sha512sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}" vt_1st_line "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha512" vtReadChecksum @@ -103,7 +103,7 @@ if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha512" ]; then read vtInputKey } else - menuentry "Calculate sha512sum" --class=checksum_sha512{ + menuentry "@VTMENU_CHKSUM_SHA512_CALC" --class=checksum_sha512{ sha512sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}" echo -e "\n\npress ENTER to exit ..." @@ -112,6 +112,6 @@ else fi -menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET { +menuentry '@VTMENU_RETURN_PREVIOUS' --class=vtoyret VTOY_RET { echo 'Return ...' } diff --git a/INSTALL/grub/debug.cfg b/INSTALL/grub/debug.cfg index 31525238..12db218e 100644 --- a/INSTALL/grub/debug.cfg +++ b/INSTALL/grub/debug.cfg @@ -1,10 +1,11 @@ +source $prefix/menulang.cfg source $prefix/power.cfg source $prefix/hwinfo.cfg source $prefix/keyboard.cfg -submenu "Resolution Configuration" --class=debug_resolution --class=F5tool { - menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET { +submenu "@VTMENU_RESOLUTION_CFG" --class=debug_resolution --class=F5tool { + menuentry '@VTMENU_RETURN_PREVIOUS' --class=vtoyret VTOY_RET { echo 'Return ...' } @@ -28,27 +29,27 @@ submenu "Resolution Configuration" --class=debug_resolution --class=F5tool { done } -submenu "Screen Display Mode" --class=debug_screen_mode --class=F5tool { - menuentry 'Force Text Mode' --class=debug_text_mode --class=debug_screen_mode --class=F5tool { +submenu "@VTMENU_SCREEN_MODE" --class=debug_screen_mode --class=F5tool { + menuentry '@VTMENU_SCREEN_TEXT_MODE' --class=debug_text_mode --class=debug_screen_mode --class=F5tool { terminal_output console } - menuentry 'Force Graphics Mode' --class=debug_gui_mode --class=debug_screen_mode --class=F5tool { + menuentry '@VTMENU_SCREEN_GUI_MODE' --class=debug_gui_mode --class=debug_screen_mode --class=F5tool { terminal_output gfxterm } - menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET { + menuentry '@VTMENU_RETURN_PREVIOUS' --class=vtoyret VTOY_RET { echo 'Return ...' } } -if [ $VTOY_THEME_COUNT -gt 1 ]; then - submenu "Theme Select" --class=debug_theme_select --class=F5tool { +if [ -n "$VTOY_THEME_COUNT" -a $VTOY_THEME_COUNT -gt 1 ]; then + submenu "@VTMENU_THEME_SELECT" --class=debug_theme_select --class=F5tool { vt_select_theme_cfg } fi if [ "$grub_platform" != "pc" ]; then submenu 'Ventoy UEFI Utilities' --class=debug_util --class=F5tool { - menuentry 'Show EFI Drivers' --class=debug_util_efidrv --class=debug_util --class=F5tool { + menuentry '@VTMENU_UTIL_SHOW_EFI_DRV' --class=debug_util_efidrv --class=debug_util --class=F5tool { vt_push_pager chainloader ${vtoy_path}/vtoyutil_${VTOY_EFI_ARCH}.efi env_param=${env_param} ${vtdebug_flag} feature=show_efi_drivers boot @@ -57,22 +58,22 @@ if [ "$grub_platform" != "pc" ]; then read vtInputKey } - menuentry 'Fixup Windows BlinitializeLibrary Failure' --class=debug_util_blinit --class=debug_util --class=F5tool { + menuentry '@VTMENU_UTIL_FIX_BLINIT_FAIL' --class=debug_util_blinit --class=debug_util --class=F5tool { chainloader ${vtoy_path}/vtoyutil_${VTOY_EFI_ARCH}.efi env_param=${env_param} ${vtdebug_flag} feature=fix_windows_mmap boot echo -e "\npress ENTER to exit ..." read vtInputKey } - menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET { + menuentry '@VTMENU_RETURN_PREVIOUS' --class=vtoyret VTOY_RET { echo 'Return ...' } } fi -submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --class=F5tool { - menuentry 'Check global control plugin configuration' --class=debug_control --class=debug_json --class=F5tool { +submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool { + menuentry '@VTMENU_JSON_CHK_CONTROL' --class=debug_control --class=debug_json --class=F5tool { set pager=1 vt_check_plugin_json $vt_plugin_path control $vtoy_iso_part @@ -81,7 +82,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --cla unset pager } - menuentry 'Check theme plugin configuration' --class=debug_theme --class=debug_json --class=F5tool { + menuentry '@VTMENU_JSON_CHK_THEME' --class=debug_theme --class=debug_json --class=F5tool { set pager=1 vt_check_plugin_json $vt_plugin_path theme $vtoy_iso_part @@ -90,7 +91,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --cla unset pager } - menuentry 'Check auto install plugin configuration' --class=debug_autoinstall --class=debug_json --class=F5tool { + menuentry '@VTMENU_JSON_CHK_AUTOINS' --class=debug_autoinstall --class=debug_json --class=F5tool { set pager=1 vt_check_plugin_json $vt_plugin_path auto_install $vtoy_iso_part @@ -99,7 +100,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --cla unset pager } - menuentry 'Check persistence plugin configuration' --class=debug_persistence --class=debug_json --class=F5tool { + menuentry '@VTMENU_JSON_CHK_PERSIST' --class=debug_persistence --class=debug_json --class=F5tool { set pager=1 vt_check_plugin_json $vt_plugin_path persistence $vtoy_iso_part @@ -111,7 +112,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --cla unset pager } - menuentry 'Check menu alias plugin configuration' --class=debug_menualias --class=debug_json --class=F5tool { + menuentry '@VTMENU_JSON_CHK_MENU_ALIAS' --class=debug_menualias --class=debug_json --class=F5tool { set pager=1 vt_check_plugin_json $vt_plugin_path menu_alias $vtoy_iso_part @@ -120,7 +121,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --cla unset pager } - menuentry 'Check menu tip plugin configuration' --class=debug_menutip --class=debug_json --class=F5tool { + menuentry '@VTMENU_JSON_CHK_MENU_TIP' --class=debug_menutip --class=debug_json --class=F5tool { set pager=1 vt_check_plugin_json $vt_plugin_path menu_tip $vtoy_iso_part @@ -129,7 +130,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --cla unset pager } - menuentry 'Check menu class plugin configuration' --class=debug_menuclass --class=debug_json --class=F5tool { + menuentry '@VTMENU_JSON_CHK_MENU_CLASS' --class=debug_menuclass --class=debug_json --class=F5tool { set pager=1 vt_check_plugin_json $vt_plugin_path menu_class $vtoy_iso_part @@ -138,7 +139,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --cla unset pager } - menuentry 'Check injection plugin configuration' --class=debug_injection --class=debug_json --class=F5tool { + menuentry '@VTMENU_JSON_CHK_INJECTION' --class=debug_injection --class=debug_json --class=F5tool { set pager=1 vt_check_plugin_json $vt_plugin_path injection $vtoy_iso_part @@ -147,7 +148,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --cla unset pager } - menuentry 'Check auto memdisk plugin configuration' --class=debug_automemdisk --class=debug_json --class=F5tool { + menuentry '@VTMENU_JSON_CHK_AUTO_MEMDISK' --class=debug_automemdisk --class=debug_json --class=F5tool { set pager=1 vt_check_plugin_json $vt_plugin_path auto_memdisk $vtoy_iso_part @@ -156,7 +157,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --cla unset pager } - menuentry 'Check image list plugin configuration' --class=debug_imagelist --class=debug_json --class=F5tool { + menuentry '@VTMENU_JSON_CHK_IMG_LIST' --class=debug_imagelist --class=debug_json --class=F5tool { set pager=1 vt_check_plugin_json $vt_plugin_path image_list $vtoy_iso_part @@ -165,7 +166,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --cla unset pager } - menuentry 'Check image blacklist plugin configuration' --class=debug_imageblacklist --class=debug_json --class=F5tool { + menuentry '@VTMENU_JSON_CHK_IMG_BLIST' --class=debug_imageblacklist --class=debug_json --class=F5tool { set pager=1 vt_check_plugin_json $vt_plugin_path image_blacklist $vtoy_iso_part @@ -174,7 +175,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --cla unset pager } - menuentry 'Check boot conf replace plugin configuration' --class=debug_bootconf_replace --class=debug_json --class=F5tool { + menuentry '@VTMENU_JSON_CHK_CONF_REPLACE' --class=debug_bootconf_replace --class=debug_json --class=F5tool { set pager=1 vt_check_plugin_json $vt_plugin_path conf_replace $vtoy_iso_part @@ -183,7 +184,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --cla unset pager } - menuentry 'Check dud plugin configuration' --class=debug_dud --class=debug_json --class=F5tool { + menuentry '@VTMENU_JSON_CHK_DUD' --class=debug_dud --class=debug_json --class=F5tool { set pager=1 vt_check_plugin_json $vt_plugin_path dud $vtoy_iso_part @@ -192,7 +193,7 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --cla unset pager } - menuentry 'Check password plugin configuration' --class=debug_pwd --class=debug_json --class=F5tool { + menuentry '@VTMENU_JSON_CHK_PASSWORD' --class=debug_pwd --class=debug_json --class=F5tool { set pager=1 vt_check_plugin_json $vt_plugin_path password $vtoy_iso_part @@ -201,21 +202,12 @@ submenu 'Check plugin json configuration (ventoy.json)' --class=debug_json --cla unset pager } - menuentry 'Check custom boot plugin configuration' --class=debug_custom_boot --class=debug_json --class=F5tool { - set pager=1 - vt_check_plugin_json $vt_plugin_path custom_boot $vtoy_iso_part - - echo -e "\npress ENTER to exit ..." - read vtInputKey - unset pager - } - - menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET { + menuentry '@VTMENU_RETURN_PREVIOUS' --class=vtoyret VTOY_RET { echo 'Return ...' } } -menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET { +menuentry '@VTMENU_RETURN_PREVIOUS' --class=vtoyret VTOY_RET { echo 'Return ...' } diff --git a/INSTALL/grub/grub.cfg b/INSTALL/grub/grub.cfg index b3977d62..179cc6d6 100644 --- a/INSTALL/grub/grub.cfg +++ b/INSTALL/grub/grub.cfg @@ -108,6 +108,11 @@ function ventoy_show_help { fi } +function ventoy_load_menu_lang_file { + vt_load_file_to_mem "auto" $vtoy_efi_part/grub/menu.tar.gz vtoy_menu_lang_mem + loopback vt_menu_tarfs mem:${vtoy_menu_lang_mem_addr}:size:${vtoy_menu_lang_mem_size} +} + function get_os_type { set vtoy_os=Linux @@ -2344,7 +2349,7 @@ function img_unsupport_menuentry { ############################################################# ############################################################# -set VENTOY_VERSION="1.0.82" +set VENTOY_VERSION="1.0.83" #ACPI not compatible with Window7/8, so disable by default set VTOY_PARAM_NO_ACPI=1 @@ -2433,6 +2438,9 @@ fi #Load Partition Table vt_load_part_table $vtoydev +#Load menu lang file +ventoy_load_menu_lang_file + #Load Plugin if [ -f $vtoy_iso_part/ventoy/ventoy.json ]; then clear @@ -2442,6 +2450,7 @@ else vt_check_json_path_case $vtoy_iso_part fi + if [ -n "$VTOY_MENU_TIMEOUT" ]; then set timeout=$VTOY_MENU_TIMEOUT else @@ -2463,10 +2472,8 @@ fi if [ $VTOY_DEFAULT_MENU_MODE -eq 0 ]; then set VTOY_F3_CMD="vt_dynamic_menu 1 1" - set VTOY_HOTKEY_TIP="h:Help F1:Memdisk F2:Browser F3:TreeView F4:Localboot F5:Tools F6:ExMenu" else set VTOY_F3_CMD="vt_dynamic_menu 1 0" - set VTOY_HOTKEY_TIP="h:Help F1:Memdisk F2:Browser F3:ListView F4:Localboot F5:Tools F6:ExMenu" fi terminal_output console @@ -2575,7 +2582,6 @@ export VTOY_HELP_CMD export VTOY_CHKSUM_CMD export VTOY_HELP_TXT_LANGUAGE export VTOY_CHKSUM_FILE_PATH -export VTOY_HOTKEY_TIP #colect all image files (iso files) diff --git a/INSTALL/grub/hwinfo.cfg b/INSTALL/grub/hwinfo.cfg index 3d3be5ac..a72daad8 100644 --- a/INSTALL/grub/hwinfo.cfg +++ b/INSTALL/grub/hwinfo.cfg @@ -1,4 +1,4 @@ -menuentry 'Hardware Information' --class=debug_hwinfo --class=F5tool { +menuentry '@VTMENU_HWINFO' --class=debug_hwinfo --class=F5tool { smbios -t 4 -s 0x10 --set=cpu_brand set system_vendor="-"; diff --git a/INSTALL/grub/keyboard.cfg b/INSTALL/grub/keyboard.cfg index 8145dcbf..8e499e66 100644 --- a/INSTALL/grub/keyboard.cfg +++ b/INSTALL/grub/keyboard.cfg @@ -1,4 +1,4 @@ -submenu "Keyboard Layouts" --class=debug_krdlayout --class=F5tool { +submenu "@VTMENU_KEYBRD_LAYOUT" --class=debug_krdlayout --class=F5tool { menuentry QWERTY_USA --class=debug_kbd --class=debug_krdlayout --class=F5tool { set_keyboard_layout QWERTY_USA } diff --git a/INSTALL/grub/localboot.cfg b/INSTALL/grub/localboot.cfg index 9366b68c..ce333a3a 100644 --- a/INSTALL/grub/localboot.cfg +++ b/INSTALL/grub/localboot.cfg @@ -1,6 +1,6 @@ if [ "$grub_platform" = "pc" ]; then - menuentry 'Search and boot Windows' --class=boot_windows --class=F4boot { + menuentry '@VTMENU_LB_SBOOT_WINDOWS' --class=boot_windows --class=F4boot { set partid=3 while [ $partid -le 128 ]; do @@ -38,7 +38,7 @@ if [ "$grub_platform" = "pc" ]; then fi } - menuentry 'Search and boot Grub4dos' --class=boot_g4d --class=F4boot { + menuentry '@VTMENU_LB_SBOOT_G4D' --class=boot_g4d --class=F4boot { if search -n -s -f /grldr; then ntldr /grldr else @@ -46,19 +46,19 @@ if [ "$grub_platform" = "pc" ]; then fi } - menuentry 'Boot the 1st local disk' --class=boot_disk --class=F4boot { + menuentry '@VTMENU_LB_SBOOT_HDD1' --class=boot_disk --class=F4boot { set root=(hd0,1) chainloader +1 boot } - menuentry 'Boot the 2nd local disk' --class=boot_disk --class=F4boot { + menuentry '@VTMENU_LB_SBOOT_HDD2' --class=boot_disk --class=F4boot { set root=(hd1,1) chainloader +1 boot } - menuentry 'Boot the 3rd local disk' --class=boot_disk --class=F4boot { + menuentry '@VTMENU_LB_SBOOT_HDD3' --class=boot_disk --class=F4boot { set root=(hd2,1) chainloader +1 boot @@ -66,7 +66,7 @@ if [ "$grub_platform" = "pc" ]; then else - menuentry 'Search and boot Windows' --class=boot_windows --class=F4boot { + menuentry '@VTMENU_LB_SBOOT_WINDOWS' --class=boot_windows --class=F4boot { set partid=3 while [ $partid -le 128 ]; do @@ -102,7 +102,7 @@ else } if [ "$grub_cpu" = "i386" ]; then - menuentry 'Search and boot BOOTIA32.EFI' --class=boot_uefi --class=F4boot { + menuentry '@VTMENU_LB_SBOOT_IA32EFI' --class=boot_uefi --class=F4boot { set VTOY_SEARCH_NO_VTOYEFI=1 if search -n -s -f /efi/boot/bootia32.efi; then unset VTOY_SEARCH_NO_VTOYEFI @@ -115,7 +115,7 @@ else fi } - menuentry 'Search and boot xorboot' --class=boot_xorboot --class=F4boot { + menuentry '@VTMENU_LB_SBOOT_XORBOOT' --class=boot_xorboot --class=F4boot { set VTOY_SEARCH_NO_VTOYEFI=1 if search -n -s -f /efi/xorboot/xorboot32.xor; then unset VTOY_SEARCH_NO_VTOYEFI @@ -132,7 +132,7 @@ else fi } elif [ "$grub_cpu" = "arm64" ]; then - menuentry 'Search and boot BOOTAA64.EFI' --class=boot_uefi --class=F4boot { + menuentry '@VTMENU_LB_SBOOT_AA64EFI' --class=boot_uefi --class=F4boot { set VTOY_SEARCH_NO_VTOYEFI=1 if search -n -s -f /efi/boot/bootaa64.efi; then unset VTOY_SEARCH_NO_VTOYEFI @@ -145,7 +145,7 @@ else fi } else - menuentry 'Search and boot BOOTX64.EFI' --class=boot_uefi --class=F4boot { + menuentry '@VTMENU_LB_SBOOT_X64EFI' --class=boot_uefi --class=F4boot { set VTOY_SEARCH_NO_VTOYEFI=1 if search -n -s -f /efi/boot/bootx64.efi; then unset VTOY_SEARCH_NO_VTOYEFI @@ -158,7 +158,7 @@ else fi } - menuentry 'Search and boot xorboot' --class=boot_xorboot --class=F4boot { + menuentry '@VTMENU_LB_SBOOT_XORBOOT' --class=boot_xorboot --class=F4boot { set VTOY_SEARCH_NO_VTOYEFI=1 if search -n -s -f /efi/xorboot/xorboot.xor; then unset VTOY_SEARCH_NO_VTOYEFI @@ -179,6 +179,6 @@ else fi -menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET { +menuentry '@VTMENU_RETURN_PREVIOUS' --class=vtoyret VTOY_RET { echo 'Return ...' } diff --git a/INSTALL/grub/menu/en_US.json b/INSTALL/grub/menu/en_US.json new file mode 100644 index 00000000..00d37a93 --- /dev/null +++ b/INSTALL/grub/menu/en_US.json @@ -0,0 +1,81 @@ +{ + "VTMENU_LANGUAGE_NAME": "en_US (English)", + + "VTMENU_STR_HOTKEY_LIST": "h:Help F1:Memdisk F2:Browser F3:ListView F4:Localboot F5:Tools F6:ExMenu", + "VTMENU_STR_HOTKEY_TREE": "h:Help F1:Memdisk F2:Browser F3:TreeView F4:Localboot F5:Tools F6:ExMenu", + "VTMENU_RETURN_PREVIOUS": "Return to previous menu [Esc]", + + "VTMENU_MENU_LANG": "Menu Language Select", + + "VTMENU_LB_SBOOT_WINDOWS": "Search and boot Windows", + "VTMENU_LB_SBOOT_G4D": "Search and boot Grub4dos", + "VTMENU_LB_SBOOT_HDD1": "Boot the 1st local disk", + "VTMENU_LB_SBOOT_HDD2": "Boot the 2nd local disk", + "VTMENU_LB_SBOOT_HDD3": "Boot the 3rd local disk", + "VTMENU_LB_SBOOT_X64EFI": "Search and boot BOOTX64.EFI", + "VTMENU_LB_SBOOT_IA32EFI": "Search and boot BOOTIA32.EFI", + "VTMENU_LB_SBOOT_AA64EFI": "Search and boot BOOTAA64.EFI", + "VTMENU_LB_SBOOT_XORBOOT": "Search and boot xorboot", + + "VTMENU_FILE_CHKSUM": "File checksum", + "VTMENU_CHKSUM_MD5_CALC": "Calculate md5sum", + "VTMENU_CHKSUM_SHA1_CALC": "Calculate sha1sum", + "VTMENU_CHKSUM_SHA256_CALC": "Calculate sha256sum", + "VTMENU_CHKSUM_SHA512_CALC": "Calculate sha512sum", + "VTMENU_CHKSUM_MD5_CALC_CHK": "Calculate and check md5sum", + "VTMENU_CHKSUM_SHA1_CALC_CHK": "Calculate and check sha1sum", + "VTMENU_CHKSUM_SHA256_CALC_CHK": "Calculate and check sha256sum", + "VTMENU_CHKSUM_SHA512_CALC_CHK": "Calculate and check sha512sum", + + "VTMENU_POWER": "Power", + "VTMENU_POWER_REBOOT": "Reboot", + "VTMENU_POWER_HALT": "Halt", + "VTMENU_POWER_BOOT_EFIFW": "Reboot to EFI setup", + + "VTMENU_KEYBRD_LAYOUT": "Keyboard Layouts", + "VTMENU_HWINFO": "Hardware Information", + + "VTMENU_RESOLUTION_CFG": "Resolution Configuration", + "VTMENU_SCREEN_MODE": "Screen Display Mode", + "VTMENU_SCREEN_TEXT_MODE": "Force Text Mode", + "VTMENU_SCREEN_GUI_MODE": "Force Graphics Mode", + + "VTMENU_THEME_SELECT": "Theme Select", + + "VTMENU_UTIL_SHOW_EFI_DRV": "Show EFI Drivers", + "VTMENU_UTIL_FIX_BLINIT_FAIL": "Fixup Windows BlinitializeLibrary Failure", + + "VTMENU_JSON_CHK_JSON": "Check plugin json configuration (ventoy.json)", + "VTMENU_JSON_CHK_CONTROL": "Check global control plugin configuration", + "VTMENU_JSON_CHK_THEME": "Check theme plugin configuration", + "VTMENU_JSON_CHK_AUTOINS": "Check auto install plugin configuration", + "VTMENU_JSON_CHK_PERSIST": "Check persistence plugin configuration", + "VTMENU_JSON_CHK_MENU_ALIAS": "Check menu alias plugin configuration", + "VTMENU_JSON_CHK_MENU_TIP": "Check menu tip plugin configuration", + "VTMENU_JSON_CHK_MENU_CLASS": "Check menu class plugin configuration", + "VTMENU_JSON_CHK_INJECTION": "Check injection plugin configuration", + "VTMENU_JSON_CHK_AUTO_MEMDISK": "Check auto memdisk plugin configuration", + "VTMENU_JSON_CHK_IMG_LIST": "Check image list plugin configuration", + "VTMENU_JSON_CHK_IMG_BLIST": "Check image blacklist plugin configuration", + "VTMENU_JSON_CHK_CONF_REPLACE": "Check boot conf replace plugin configuration", + "VTMENU_JSON_CHK_DUD": "Check dud plugin configuration", + "VTMENU_JSON_CHK_PASSWORD": "Check password plugin configuration", + + "VTMENU_NORMAL_MODE": "Boot in normal mode", + "VTMENU_WIMBOOT_MODE": "Boot in wimboot mode", + "VTMENU_GRUB2_MODE": "Boot in grub2 mode", + "VTMENU_MEMDISK_MODE": "Boot in memdisk mode", + + "VTMENU_RET_TO_LISTVIEW": "Return to ListView", + "VTMENU_RET_TO_TREEVIEW": "Return to TreeView", + + "VTMENU_NO_AUTOINS_SCRIPT": "Boot without auto installation template", + "VTMENU_AUTOINS_USE": "Boot with", + + "VTMENU_NO_PERSIST": "Boot without persistence", + "VTMENU_PERSIST_USE": "Boot with", + + "VTMENU_BROWER_RETURN": "Return", + + "MENU_STR_XXX": "" +} diff --git a/INSTALL/grub/menu/zh_CN.json b/INSTALL/grub/menu/zh_CN.json new file mode 100644 index 00000000..9bb4958b --- /dev/null +++ b/INSTALL/grub/menu/zh_CN.json @@ -0,0 +1,81 @@ +{ + "VTMENU_LANGUAGE_NAME": "zh_CN (简体中文)", + + "VTMENU_STR_HOTKEY_LIST": "h:帮助 F1:内存模式 F2:本地浏览 F3:列表模式 F4:本地启动 F5:工具 F6:扩展菜单", + "VTMENU_STR_HOTKEY_TREE": "h:帮助 F1:内存模式 F2:本地浏览 F3:树形模式 F4:本地启动 F5:工具 F6:扩展菜单", + "VTMENU_RETURN_PREVIOUS": "返回上一级菜单 [Esc]", + + "VTMENU_MENU_LANG": "菜单语言", + + "VTMENU_LB_SBOOT_WINDOWS": "搜索并启动 Windows", + "VTMENU_LB_SBOOT_G4D": "搜索并启动 Grub4dos", + "VTMENU_LB_SBOOT_HDD1": "启动本地硬盘1中的系统", + "VTMENU_LB_SBOOT_HDD2": "启动本地硬盘2中的系统", + "VTMENU_LB_SBOOT_HDD3": "启动本地硬盘3中的系统", + "VTMENU_LB_SBOOT_X64EFI": "搜索并启动 BOOTX64.EFI", + "VTMENU_LB_SBOOT_IA32EFI": "搜索并启动 BOOTIA32.EFI", + "VTMENU_LB_SBOOT_AA64EFI": "搜索并启动 BOOTAA64.EFI", + "VTMENU_LB_SBOOT_XORBOOT": "搜索并启动 xorboot", + + "VTMENU_FILE_CHKSUM": "文件校验", + "VTMENU_CHKSUM_MD5_CALC": "计算 MD5 校验值", + "VTMENU_CHKSUM_SHA1_CALC": "计算 SHA1 校验值", + "VTMENU_CHKSUM_SHA256_CALC": "计算 SHA256 校验值", + "VTMENU_CHKSUM_SHA512_CALC": "计算 SHA512 校验值", + "VTMENU_CHKSUM_MD5_CALC_CHK": "计算并检查 MD5 校验值", + "VTMENU_CHKSUM_SHA1_CALC_CHK": "计算并检查 SHA1 校验值", + "VTMENU_CHKSUM_SHA256_CALC_CHK": "计算并检查 SHA256 校验值", + "VTMENU_CHKSUM_SHA512_CALC_CHK": "计算并检查 SHA512 校验值", + + "VTMENU_POWER": "电源", + "VTMENU_POWER_REBOOT": "重启", + "VTMENU_POWER_HALT": "关机", + "VTMENU_POWER_BOOT_EFIFW": "重启进入 UEFI 设置菜单", + + "VTMENU_KEYBRD_LAYOUT": "键盘布局", + "VTMENU_HWINFO": "硬件信息", + + "VTMENU_RESOLUTION_CFG": "屏幕分辨率", + "VTMENU_SCREEN_MODE": "显示模式", + "VTMENU_SCREEN_TEXT_MODE": "文本模式", + "VTMENU_SCREEN_GUI_MODE": "图形模式", + + "VTMENU_THEME_SELECT": "主题选择", + + "VTMENU_UTIL_SHOW_EFI_DRV": "显示 UEFI 驱动", + "VTMENU_UTIL_FIX_BLINIT_FAIL": "修复 Windows BlinitializeLibrary 错误", + + "VTMENU_JSON_CHK_JSON": "检查插件配置文件 (ventoy.json)", + "VTMENU_JSON_CHK_CONTROL": "配置检查 —— 全局控制插件", + "VTMENU_JSON_CHK_THEME": "配置检查 —— 主题插件", + "VTMENU_JSON_CHK_AUTOINS": "配置检查 —— 自动安装插件", + "VTMENU_JSON_CHK_PERSIST": "配置检查 —— 持久化插件", + "VTMENU_JSON_CHK_MENU_ALIAS": "配置检查 —— 菜单别名插件", + "VTMENU_JSON_CHK_MENU_TIP": "配置检查 —— 菜单提示插件", + "VTMENU_JSON_CHK_MENU_CLASS": "配置检查 —— 菜单类型插件", + "VTMENU_JSON_CHK_INJECTION": "配置检查 —— 文件注入插件", + "VTMENU_JSON_CHK_AUTO_MEMDISK": "配置检查 —— 自动内存盘模式插件", + "VTMENU_JSON_CHK_IMG_LIST": "配置检查 —— 文件列表插件(白名单)", + "VTMENU_JSON_CHK_IMG_BLIST": "配置检查 —— 文件列表插件(黑名单)", + "VTMENU_JSON_CHK_CONF_REPLACE": "配置检查 —— 启动配置替换插件", + "VTMENU_JSON_CHK_DUD": "配置检查 —— Driver Update Disk插件", + "VTMENU_JSON_CHK_PASSWORD": "配置检查 —— 密码插件", + + "VTMENU_NORMAL_MODE": "以正常模式启动", + "VTMENU_WIMBOOT_MODE": "以 wimboot 模式启动", + "VTMENU_GRUB2_MODE": "以 grub2 模式启动", + "VTMENU_MEMDISK_MODE": "以内存盘模式启动", + + "VTMENU_RET_TO_LISTVIEW": "返回到列表模式", + "VTMENU_RET_TO_TREEVIEW": "返回到树形模式", + + "VTMENU_NO_AUTOINS_SCRIPT": "不使用自动安装脚本", + "VTMENU_AUTOINS_USE": "使用", + + "VTMENU_NO_PERSIST": "不使用持久化数据文件", + "VTMENU_PERSIST_USE": "使用", + + "VTMENU_BROWER_RETURN": "返回", + + "MENU_STR_XXX": "" +} diff --git a/INSTALL/grub/menulang.cfg b/INSTALL/grub/menulang.cfg new file mode 100644 index 00000000..35d0d80f --- /dev/null +++ b/INSTALL/grub/menulang.cfg @@ -0,0 +1,3 @@ +submenu "@VTMENU_MENU_LANG" --class=debug_menu_lang --class=F5tool { +#ventoy_pack.sh will generate menuentry here + diff --git a/INSTALL/grub/power.cfg b/INSTALL/grub/power.cfg index 13b00cbf..e60eca02 100644 --- a/INSTALL/grub/power.cfg +++ b/INSTALL/grub/power.cfg @@ -1,25 +1,25 @@ -submenu "Power" --class=debug_power --class=F5tool { - menuentry Reboot --class=debug_reboot --class=debug_power --class=F5tool { +submenu "@VTMENU_POWER" --class=debug_power --class=F5tool { + menuentry "@VTMENU_POWER_REBOOT" --class=debug_reboot --class=debug_power --class=F5tool { echo -e '\n\nSystem is rebooting ... \n' sleep 1 reboot } - menuentry Halt --class=debug_halt --class=debug_power --class=F5tool { + menuentry "@VTMENU_POWER_HALT" --class=debug_halt --class=debug_power --class=F5tool { echo -e '\n\nSystem is halting ... \n' sleep 1 halt } if [ "$grub_platform" != "pc" ]; then - menuentry 'Reboot to EFI setup' --class=debug_efisetup --class=debug_power --class=F5tool { + menuentry '@VTMENU_POWER_BOOT_EFIFW' --class=debug_efisetup --class=debug_power --class=F5tool { echo -e '\n\nRebooting to enter UEFI firmware setup ... \n' sleep 1 fwsetup } fi - menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET { + menuentry '@VTMENU_RETURN_PREVIOUS' --class=vtoyret VTOY_RET { echo 'Return ...' } } diff --git a/INSTALL/ventoy_pack.sh b/INSTALL/ventoy_pack.sh index 97915f10..d39ac6bb 100644 --- a/INSTALL/ventoy_pack.sh +++ b/INSTALL/ventoy_pack.sh @@ -88,6 +88,26 @@ tar czf help.tar.gz ./help/ rm -rf ./help cd ../../ +#tar menu txt & update menulang.cfg +cd $tmpmnt/grub/ + +for vtlang in $(ls menu/); do + vtlangname=${vtlang%.*} + vtlangtitle=$(grep VTMENU_LANGUAGE_NAME menu/$vtlang | awk -F\" '{print $4}') + echo "menuentry \"$vtlangtitle\" --class=menu_lang_item --class=debug_menu_lang --class=F5tool {" >> menulang.cfg + echo " vt_load_menu_lang $vtlangname" >> menulang.cfg + echo "}" >> menulang.cfg +done +echo "menuentry '@VTMENU_RETURN_PREVIOUS' --class=vtoyret VTOY_RET {" >> menulang.cfg +echo " echo 'Return ...'" >> menulang.cfg +echo "}" >> menulang.cfg +echo "}" >> menulang.cfg + +tar czf menu.tar.gz ./menu/ +rm -rf ./menu +cd ../../ + + cp $OPT ./ventoy $tmpmnt/ cp $OPT ./EFI $tmpmnt/ diff --git a/LANGUAGES/check.sh b/LANGUAGES/check.sh index a18c1a8d..836befd7 100644 --- a/LANGUAGES/check.sh +++ b/LANGUAGES/check.sh @@ -8,10 +8,23 @@ fi gcc -DFOR_VTOY_JSON_CHECK $VTOY_PATH/Ventoy2Disk/Ventoy2Disk/VentoyJson.c -I $VTOY_PATH/Ventoy2Disk/Ventoy2Disk/ -o checkjson +RET=0 + ./checkjson $VTOY_PATH/LANGUAGES/languages.json ret=$? +if [ $ret -eq 0 ]; then + for i in $(ls $VTOY_PATH/INSTALL/grub/menu); do + ./checkjson $VTOY_PATH/INSTALL/grub/menu/$i + ret=$? + if [ $ret -ne 0 ]; then + echo "INSTALL/grub/menu/$i invalid json format" + break + fi + done +else + echo "languages.json invalid json format" +fi rm -f ./checkjson [ $ret -eq 0 ] - diff --git a/Plugson/pack.sh b/Plugson/pack.sh index 46fbf032..52bc9e5d 100644 --- a/Plugson/pack.sh +++ b/Plugson/pack.sh @@ -21,6 +21,10 @@ fi ls -1 ../INSTALL/grub/help/ | while read line; do echo -n ${line:0:5} >> ./www/helplist done +[ -f ./www/menulist ] && rm -f ./www/menulist +ls -1 ../INSTALL/grub/menu/ | while read line; do + echo -n ${line:0:5} >> ./www/menulist +done echo -n "$plugson_verion" > ./www/buildtime tar cf www.tar www diff --git a/Plugson/src/Web/ventoy_http.c b/Plugson/src/Web/ventoy_http.c index a8a86dfb..900045eb 100644 --- a/Plugson/src/Web/ventoy_http.c +++ b/Plugson/src/Web/ventoy_http.c @@ -72,6 +72,7 @@ static const char *g_plugin_name[plugin_type_max] = }; static char g_ventoy_help_lang[MAX_LANGUAGE][8]; +static char g_ventoy_menu_lang[MAX_LANGUAGE][8]; static char g_pub_path[2 * MAX_PATH]; static data_control g_data_control[bios_max + 1]; @@ -522,6 +523,7 @@ void ventoy_data_default_control(data_control *data) strlcpy(data->default_kbd_layout, "QWERTY_USA"); strlcpy(data->help_text_language, "en_US"); + strlcpy(data->menu_language, "en_US"); } int ventoy_data_cmp_control(data_control *data1, data_control *data2) @@ -551,7 +553,8 @@ int ventoy_data_cmp_control(data_control *data1, data_control *data2) if (strcmp(data1->default_search_root, data2->default_search_root) || strcmp(data1->default_image, data2->default_image) || strcmp(data1->default_kbd_layout, data2->default_kbd_layout) || - strcmp(data1->help_text_language, data2->help_text_language)) + strcmp(data1->help_text_language, data2->help_text_language) || + strcmp(data1->menu_language, data2->menu_language)) { return 1; } @@ -595,6 +598,7 @@ int ventoy_data_save_control(data_control *data, const char *title, char *buf, i VTOY_JSON_FMT_CTRL_STRN(L2, "VTOY_DEFAULT_KBD_LAYOUT", default_kbd_layout); VTOY_JSON_FMT_CTRL_STRN(L2, "VTOY_HELP_TXT_LANGUAGE", help_text_language); + VTOY_JSON_FMT_CTRL_STRN(L2, "VTOY_MENU_LANGUAGE", menu_language); if (strcmp(def->default_search_root, data->default_search_root)) { @@ -642,6 +646,7 @@ int ventoy_data_json_control(data_control *ctrl, char *buf, int buflen) VTOY_JSON_FMT_SINT("secondary_menu_timeout", ctrl->secondary_menu_timeout); VTOY_JSON_FMT_STRN("default_kbd_layout", ctrl->default_kbd_layout); VTOY_JSON_FMT_STRN("help_text_language", ctrl->help_text_language); + VTOY_JSON_FMT_STRN("menu_language", ctrl->menu_language); valid = 0; if (ctrl->default_search_root[0] && ventoy_is_directory_exist("%s%s", g_cur_dir, ctrl->default_search_root)) @@ -669,7 +674,15 @@ int ventoy_data_json_control(data_control *ctrl, char *buf, int buflen) } VTOY_JSON_FMT_ARY_ENDEX(); + VTOY_JSON_FMT_KEY("menu_list"); + VTOY_JSON_FMT_ARY_BEGIN(); + for (i = 0; g_ventoy_menu_lang[i][0]; i++) + { + VTOY_JSON_FMT_ITEM(g_ventoy_menu_lang[i]); + } + VTOY_JSON_FMT_ARY_ENDEX(); + VTOY_JSON_FMT_OBJ_END(); VTOY_JSON_FMT_END(pos); @@ -713,6 +726,7 @@ static int ventoy_api_save_control(struct mg_connection *conn, VTOY_JSON *json) VTOY_JSON_STR("default_image", ctrl->default_image); VTOY_JSON_STR("default_search_root", ctrl->default_search_root); VTOY_JSON_STR("help_text_language", ctrl->help_text_language); + VTOY_JSON_STR("menu_language", ctrl->menu_language); VTOY_JSON_STR("default_kbd_layout", ctrl->default_kbd_layout); ret = ventoy_data_save_all(); @@ -4085,6 +4099,17 @@ static int ventoy_parse_control(VTOY_JSON *json, void *p) } } } + else if (strcmp(child->pcName, "VTOY_MENU_LANGUAGE") == 0) + { + for (i = 0; g_ventoy_menu_lang[i][0]; i++) + { + if (strcmp(child->unData.pcStrVal, g_ventoy_menu_lang[i]) == 0) + { + strlcpy(data->menu_language, child->unData.pcStrVal); + break; + } + } + } else if (strcmp(child->pcName, "VTOY_MENU_TIMEOUT") == 0) { data->menu_timeout = (int)strtol(child->unData.pcStrVal, NULL, 10); @@ -5326,6 +5351,19 @@ int ventoy_http_init(void) } free(Buffer); } + + Buffer = NULL; + BufLen = 0; + ventoy_read_file_to_buf("www/menulist", 4, (void **)&Buffer, &BufLen); + if (Buffer) + { + for (i = 0; i < BufLen / 5; i++) + { + memcpy(g_ventoy_menu_lang[i], Buffer + i * 5, 5); + g_ventoy_menu_lang[i][5] = 0; + } + free(Buffer); + } #else ventoy_file *file; file = ventoy_tar_find_file("www/helplist"); @@ -5337,6 +5375,16 @@ int ventoy_http_init(void) g_ventoy_help_lang[i][5] = 0; } } + + file = ventoy_tar_find_file("www/menulist"); + if (file) + { + for (i = 0; i < file->size / 5; i++) + { + memcpy(g_ventoy_menu_lang[i], (char *)(file->addr) + i * 5, 5); + g_ventoy_menu_lang[i][5] = 0; + } + } #endif if (!g_pub_json_buffer) diff --git a/Plugson/src/Web/ventoy_http.h b/Plugson/src/Web/ventoy_http.h index 0ec1e22c..27b7508f 100644 --- a/Plugson/src/Web/ventoy_http.h +++ b/Plugson/src/Web/ventoy_http.h @@ -22,7 +22,7 @@ #include -#define MAX_LANGUAGE 128 +#define MAX_LANGUAGE 256 #define L1 " " #define L2 " " @@ -84,6 +84,7 @@ typedef struct data_control char default_image[MAX_PATH]; char default_kbd_layout[32]; char help_text_language[32]; + char menu_language[32]; }data_control; #define display_mode_gui 0 diff --git a/Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe b/Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe index 109da876..4267b012 100644 Binary files a/Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe and b/Plugson/vs/VentoyPlugson/Release/VentoyPlugson.exe differ diff --git a/Plugson/www/menulist b/Plugson/www/menulist new file mode 100644 index 00000000..c28c1f65 --- /dev/null +++ b/Plugson/www/menulist @@ -0,0 +1 @@ +en_USzh_CN \ No newline at end of file diff --git a/Plugson/www/plugson_control.html b/Plugson/www/plugson_control.html index 8cfbfcba..c490c537 100644 --- a/Plugson/www/plugson_control.html +++ b/Plugson/www/plugson_control.html @@ -32,6 +32,42 @@ + +
+
+

VTOY_MENU_LANGUAGE + —— 菜单语言

+
+ +
+
+
+ + + + + + + + + + + + + +
选项设置 + +
选项说明 + Ventoy 菜单的语言版本。默认是 "en_US"。 +
Option Description + Ventoy menu language. Default is "en_US", +
+
+
+ +
@@ -1092,6 +1128,7 @@ data.filter_vtoy = parseInt($('input:radio[name=id_ctrl_radio_filt_vtoy]:checked').val()); data.help_text_language = $('select[id=id_ctrl_sel_help_lang').val(); + data.menu_language = $('select[id=id_ctrl_sel_menu_lang').val(); } function VtoyFillCurrentPageItem(data) { @@ -1192,8 +1229,18 @@ $('select[id=id_ctrl_sel_help_lang').append(opt); } } + $('select[id=id_ctrl_sel_help_lang').val(data.help_language); - $('select[id=id_ctrl_sel_help_lang').val(data.help_text_language); + //VTOY_MENU_LANGUAGE + if ($("select[id=id_ctrl_sel_menu_lang")[0].options.length === 0) + { + for (var i = 0; i < data.menu_list.length; i++) { + var hlang = data.menu_list[i]; + var opt = ''; + $('select[id=id_ctrl_sel_menu_lang').append(opt); + } + } + $('select[id=id_ctrl_sel_menu_lang').val(data.menu_language); } function VtoySaveCurrentPage() { @@ -1329,6 +1376,7 @@ $('select[id=id_ctrl_sel_max_depth]').change(VtoySaveCurrentPage); $('select[id=id_ctrl_sel_kbd]').change(VtoySaveCurrentPage); $('select[id=id_ctrl_sel_help_lang]').change(VtoySaveCurrentPage); + $('select[id=id_ctrl_sel_menu_lang]').change(VtoySaveCurrentPage); $('input[id=id_ctrl_text_timeout]').change(function() { var value = $('input:text[id=id_ctrl_text_timeout]').val(); if (/^[0-9][0-9]*$/.test(value)) {