#include <grub/i18n.h>
#include <grub/normal.h>
+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,
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;
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;
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[] =
{
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);
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) { \
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))
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;
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);
}
}
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);
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"));
}
}
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)
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);
}
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);
}
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;
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;
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;
}
{ "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)
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
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__ */
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)
{
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;
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);
}
}
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");
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);
+}
+
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
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 ..."
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
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 ..."
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
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 ..."
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
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 ..."
fi
-menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
+menuentry '@VTMENU_RETURN_PREVIOUS' --class=vtoyret VTOY_RET {
echo 'Return ...'
}
+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 ...'
}
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 ...'
}
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
#############################################################
#############################################################
-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
#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
vt_check_json_path_case $vtoy_iso_part
fi
+
if [ -n "$VTOY_MENU_TIMEOUT" ]; then
set timeout=$VTOY_MENU_TIMEOUT
else
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
export VTOY_CHKSUM_CMD
export VTOY_HELP_TXT_LANGUAGE
export VTOY_CHKSUM_FILE_PATH
-export VTOY_HOTKEY_TIP
#colect all image files (iso files)
-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="-";
-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
}
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
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
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
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
}
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
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
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
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
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
fi
-menuentry 'Return to previous menu [Esc]' --class=vtoyret VTOY_RET {
+menuentry '@VTMENU_RETURN_PREVIOUS' --class=vtoyret VTOY_RET {
echo 'Return ...'
}
--- /dev/null
+{
+ "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": ""
+}
--- /dev/null
+{
+ "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": ""
+}
--- /dev/null
+submenu "@VTMENU_MENU_LANG" --class=debug_menu_lang --class=F5tool {
+#ventoy_pack.sh will generate menuentry here
+
-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 ...'
}
}
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/
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 ]
-
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
};
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];
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)
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;
}
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))
{
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))
}
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);
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();
}
}
}
+ 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);
}
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");
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)
#include <civetweb.h>
-#define MAX_LANGUAGE 128
+#define MAX_LANGUAGE 256
#define L1 " "
#define L2 " "
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
--- /dev/null
+en_USzh_CN
\ No newline at end of file
</ul>\r
</div>\r
\r
+\r
+ <div class="box box-primary box-solid">\r
+ <div class="box-header with-border">\r
+ <h3 class="box-title" style="font-size: 14px;font-weight: bold;">VTOY_MENU_LANGUAGE\r
+ <span id="id_span_desc_cn"> —— 菜单语言</span></h3>\r
+ <div class="box-tools pull-right">\r
+ <button class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>\r
+ </div><!-- /.box-tools -->\r
+ </div><!-- /.box-header -->\r
+ <div class="box-body no-padding">\r
+ <table class="table table-bordered no-padding">\r
+ <tr style="font-weight:bold;">\r
+ <td class="td_ctrl_col" id="td_title_setting">选项设置</td>\r
+ <td>\r
+ <select id="id_ctrl_sel_menu_lang" name="name_ctrl_sel_menu_lang" class="form-control">\r
+ \r
+ </select>\r
+ </td>\r
+ </tr>\r
+ <tr id="tr_title_desc_cn">\r
+ <td class="td_ctrl_col">选项说明</td>\r
+ <td>\r
+ Ventoy 菜单的语言版本。默认是 "en_US"。\r
+ </td>\r
+ </tr>\r
+ <tr id="tr_title_desc_en">\r
+ <td class="td_ctrl_col">Option Description</td>\r
+ <td>\r
+ Ventoy menu language. Default is "en_US", \r
+ </td>\r
+ </tr>\r
+ </table>\r
+ </div><!-- /.box-body -->\r
+ </div><!-- /.box -->\r
+\r
+\r
\r
<div class="box box-primary box-solid">\r
<div class="box-header with-border">\r
data.filter_vtoy = parseInt($('input:radio[name=id_ctrl_radio_filt_vtoy]:checked').val());\r
\r
data.help_text_language = $('select[id=id_ctrl_sel_help_lang').val();\r
+ data.menu_language = $('select[id=id_ctrl_sel_menu_lang').val();\r
}\r
\r
function VtoyFillCurrentPageItem(data) {\r
$('select[id=id_ctrl_sel_help_lang').append(opt);\r
}\r
}\r
+ $('select[id=id_ctrl_sel_help_lang').val(data.help_language);\r
\r
- $('select[id=id_ctrl_sel_help_lang').val(data.help_text_language);\r
+ //VTOY_MENU_LANGUAGE\r
+ if ($("select[id=id_ctrl_sel_menu_lang")[0].options.length === 0)\r
+ {\r
+ for (var i = 0; i < data.menu_list.length; i++) {\r
+ var hlang = data.menu_list[i];\r
+ var opt = '<option title="'+hlang+'">'+hlang+'</option>';\r
+ $('select[id=id_ctrl_sel_menu_lang').append(opt);\r
+ }\r
+ }\r
+ $('select[id=id_ctrl_sel_menu_lang').val(data.menu_language);\r
}\r
\r
function VtoySaveCurrentPage() {\r
$('select[id=id_ctrl_sel_max_depth]').change(VtoySaveCurrentPage);\r
$('select[id=id_ctrl_sel_kbd]').change(VtoySaveCurrentPage);\r
$('select[id=id_ctrl_sel_help_lang]').change(VtoySaveCurrentPage);\r
+ $('select[id=id_ctrl_sel_menu_lang]').change(VtoySaveCurrentPage);\r
$('input[id=id_ctrl_text_timeout]').change(function() {\r
var value = $('input:text[id=id_ctrl_text_timeout]').val();\r
if (/^[0-9][0-9]*$/.test(value)) {\r