menu language update

This commit is contained in:
longpanda 2022-12-18 17:30:29 +08:00
parent 2de7d9ffe0
commit 83f22173a5
25 changed files with 286 additions and 32 deletions

View File

@ -0,0 +1,174 @@
/* echo.c - Command to display a line of text */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2010 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/dl.h>
#include <grub/misc.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
#include <grub/term.h>
GRUB_MOD_LICENSE ("GPLv3+");
extern const char *ventoy_get_vmenu_title(const char *vMenu);
static const struct grub_arg_option options[] =
{
{0, 'n', 0, N_("Do not output the trailing newline."), 0, 0},
{0, 'e', 0, N_("Enable interpretation of backslash escapes."), 0, 0},
{0, 'v', 0, N_("ventoy menu language."), 0, 0},
{0, 'V', 0, N_("ventoy menu language with pre-newline."), 0, 0},
{0, 0, 0, 0, 0, 0}
};
static grub_err_t
grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
{
struct grub_arg_list *state = ctxt->state;
char ch;
int vtmenu = 0;
int newline = 1;
int i;
/* Check if `-n' was used. */
if (state[0].set)
newline = 0;
if (state[2].set || state[3].set)
vtmenu = 1;
for (i = 0; i < argc; i++)
{
char *arg = *args;
/* Unescaping results in a string no longer than the original. */
char *unescaped = grub_malloc (grub_strlen (arg) + 1);
char *p = unescaped;
args++;
if (!unescaped)
return grub_errno;
while (*arg)
{
/* In case `-e' is used, parse backslashes. */
if (*arg == '\\' && state[1].set)
{
arg++;
if (*arg == '\0')
break;
switch (*arg)
{
case '\\':
*p++ = '\\';
break;
case 'a':
*p++ = '\a';
break;
case 'c':
newline = 0;
break;
case 'f':
*p++ = '\f';
break;
case 'n':
*p++ = '\n';
break;
case 'r':
*p++ = '\r';
break;
case 't':
*p++ = '\t';
break;
case 'v':
*p++ = '\v';
break;
}
arg++;
continue;
}
/* This was not an escaped character, or escaping is not
enabled. */
*p++ = *arg;
arg++;
}
*p = '\0';
if (vtmenu && grub_strncmp(unescaped, "VTMENU_", 7) == 0)
{
p = unescaped;
while ((*p >= 'A' && *p <= 'Z') || *p == '_')
{
p++;
}
ch = *p;
*p = 0;
if (state[3].set)
{
grub_xputs("\n");
}
grub_xputs(ventoy_get_vmenu_title(unescaped));
*p = ch;
grub_xputs(p);
}
else
{
grub_xputs (unescaped);
}
grub_free (unescaped);
/* If another argument follows, insert a space. */
if ((0 == vtmenu) && (i != argc - 1))
grub_printf (" " );
}
if (newline)
grub_printf ("\n");
grub_refresh ();
return 0;
}
static grub_extcmd_t cmd;
GRUB_MOD_INIT(echo)
{
cmd = grub_register_extcmd ("echo", grub_cmd_echo,
GRUB_COMMAND_ACCEPT_DASH
| GRUB_COMMAND_OPTIONS_AT_START,
N_("[-e|-n] STRING"), N_("Display a line of text."),
options);
}
GRUB_MOD_FINI(echo)
{
grub_unregister_extcmd (cmd);
}

View File

@ -14,14 +14,14 @@ if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.md5" ]; then
echo "$vtReadChecksum"
fi
echo -e "\n\npress ENTER to exit ..."
echo -ven "\n\n" "VTMENU_ENTER_EXIT ..."
read vtInputKey
}
else
menuentry "@VTMENU_CHKSUM_MD5_CALC" --class=checksum_md5 {
md5sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}"
echo -e "\n\npress ENTER to exit ..."
echo -ven "\n\n" "VTMENU_ENTER_EXIT ..."
read vtInputKey
}
fi
@ -41,14 +41,14 @@ if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha1" ]; then
echo "$vtReadChecksum"
fi
echo -e "\n\npress ENTER to exit ..."
echo -ven "\n\n" "VTMENU_ENTER_EXIT ..."
read vtInputKey
}
else
menuentry "@VTMENU_CHKSUM_SHA1_CALC" --class=checksum_sha1 {
sha1sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}"
echo -e "\n\npress ENTER to exit ..."
echo -ven "\n\n" "VTMENU_ENTER_EXIT ..."
read vtInputKey
}
fi
@ -70,14 +70,14 @@ if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha256" ]; then
echo "$vtReadChecksum"
fi
echo -e "\n\npress ENTER to exit ..."
echo -ven "\n\n" "VTMENU_ENTER_EXIT ..."
read vtInputKey
}
else
menuentry "@VTMENU_CHKSUM_SHA256_CALC" --class=checksum_sha256 {
sha256sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}"
echo -e "\n\npress ENTER to exit ..."
echo -ven "\n\n" "VTMENU_ENTER_EXIT ..."
read vtInputKey
}
fi
@ -99,14 +99,14 @@ if [ -e "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}.sha512" ]; then
echo "$vtReadChecksum"
fi
echo -e "\n\npress ENTER to exit ..."
echo -ven "\n\n" "VTMENU_ENTER_EXIT ..."
read vtInputKey
}
else
menuentry "@VTMENU_CHKSUM_SHA512_CALC" --class=checksum_sha512{
sha512sum "${vtoy_iso_part}${VTOY_CHKSUM_FILE_PATH}"
echo -e "\n\npress ENTER to exit ..."
echo -ven "\n\n" "VTMENU_ENTER_EXIT ..."
read vtInputKey
}
fi

View File

@ -56,14 +56,14 @@ if [ "$grub_platform" != "pc" ]; then
chainloader ${vtoy_path}/vtoyutil_${VTOY_EFI_ARCH}.efi env_param=${env_param} ${vtdebug_flag} feature=show_efi_drivers
boot
vt_pop_pager
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
}
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 ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
}
@ -79,7 +79,7 @@ submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool {
set pager=1
vt_check_plugin_json $vt_plugin_path control $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
unset pager
}
@ -88,7 +88,7 @@ submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool {
set pager=1
vt_check_plugin_json $vt_plugin_path theme $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
unset pager
}
@ -97,7 +97,7 @@ submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool {
set pager=1
vt_check_plugin_json $vt_plugin_path auto_install $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
unset pager
}
@ -109,7 +109,7 @@ submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool {
echo -e "\n############### dump persistence ###############"
vt_dump_persistence
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
unset pager
}
@ -118,7 +118,7 @@ submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool {
set pager=1
vt_check_plugin_json $vt_plugin_path menu_alias $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
unset pager
}
@ -127,7 +127,7 @@ submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool {
set pager=1
vt_check_plugin_json $vt_plugin_path menu_tip $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
unset pager
}
@ -136,7 +136,7 @@ submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool {
set pager=1
vt_check_plugin_json $vt_plugin_path menu_class $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
unset pager
}
@ -145,7 +145,7 @@ submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool {
set pager=1
vt_check_plugin_json $vt_plugin_path injection $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
unset pager
}
@ -154,7 +154,7 @@ submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool {
set pager=1
vt_check_plugin_json $vt_plugin_path auto_memdisk $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
unset pager
}
@ -163,7 +163,7 @@ submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool {
set pager=1
vt_check_plugin_json $vt_plugin_path image_list $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
unset pager
}
@ -172,7 +172,7 @@ submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool {
set pager=1
vt_check_plugin_json $vt_plugin_path image_blacklist $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
unset pager
}
@ -181,7 +181,7 @@ submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool {
set pager=1
vt_check_plugin_json $vt_plugin_path conf_replace $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
unset pager
}
@ -190,7 +190,7 @@ submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool {
set pager=1
vt_check_plugin_json $vt_plugin_path dud $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
unset pager
}
@ -199,7 +199,7 @@ submenu '@VTMENU_JSON_CHK_JSON' --class=debug_json --class=F5tool {
set pager=1
vt_check_plugin_json $vt_plugin_path password $vtoy_iso_part
echo -e "\npress ENTER to exit ..."
echo -Vn "VTMENU_ENTER_EXIT ..."
read vtInputKey
unset pager
}

View File

@ -91,7 +91,7 @@ function ventoy_ext_menu {
unset ventoy_new_context
else
echo "ventoy_grub.cfg NOT exist."
echo -e "\npress ENTER to exit ..."
echo -V "VTMENU_ENTER_EXIT ..."
read vtInputKey
fi
}
@ -1501,7 +1501,7 @@ function iso_common_menuentry {
echo -e "\n $vt_volume_space $vt_chosen_size $vt_chosen_size_mod\n"
echo -e "\n The size of the iso file \"$vt_chosen_size\" is invalid. File corrupted ?\n"
echo -e " 此ISO文件的大小 \"$vt_chosen_size\" 有问题,请确认文件是否损坏。\n"
echo -e "\n press ENTER to continue (请按 回车 键继续) ..."
echo -v "VTMENU_ENTER_CONTINUE ..."
read vtInputKey
fi
fi
@ -1589,7 +1589,7 @@ function miso_common_menuentry {
function common_unsupport_menuentry {
echo -e "\n The name of the iso file could NOT contain space or non-ascii characters. \n"
echo -e " 文件名中不能有中文或空格 \n"
echo -e "\npress ENTER to exit (请按 回车 键返回) ..."
echo -V "VTMENU_ENTER_EXIT ..."
read vtInputKey
}
@ -1736,7 +1736,7 @@ function vhd_common_menuentry {
echo -e "!!! WARNING !!!\n"
echo -e "\nPartition1 ($vtoy_iso_fs) is NOT ntfs, the VHD(x) file may not boot normally \n"
echo -e "\nVHD(x) 文件所在分区不是 ntfs 格式, 可能无法正常启动 \n\n"
echo -n "press ENTER to continue boot (请按 回车 键继续) ..."
echo -vn "VTMENU_ENTER_CONTINUE ..."
read vtInputKey
fi
fi
@ -1845,7 +1845,7 @@ function vtoy_unsupport_menuentry {
function only_uefi_tip {
echo -e "\n This IMG file is only supported in UEFI mode. \n"
echo -e "\n press ENTER to exit ..."
echo -V "VTMENU_ENTER_EXIT ..."
read vtInputKey
}
@ -2103,7 +2103,7 @@ function ventoy_img_openwrt {
ventoy_gui_console
echo -e "\n ventoy_openwrt.xz not found. Please refer https://www.ventoy.net/en/doc_openwrt.html.\n"
echo -e " 未找到 ventoy_openwrt.xz 文件。请参考 https://www.ventoy.net/cn/doc_openwrt.html\n"
echo -e "\n press ENTER to exit (请按 回车 键返回) ..."
echo -V "VTMENU_ENTER_EXIT ..."
read vtInputKey
ventoy_cli_console
return
@ -2235,7 +2235,7 @@ function ventoy_img_memtest86 {
function img_unsupport_tip {
echo -e "\n This IMG file is NOT supported now. \n"
echo -e " 当前不支持启动此 IMG 文件 \n"
echo -e "\npress ENTER to exit (请按 回车 键返回) ..."
echo -V "VTMENU_ENTER_EXIT ..."
read vtInputKey
}

View File

@ -56,6 +56,6 @@ menuentry '@VTMENU_HWINFO' --class=debug_hwinfo --class=F5tool {
echo "BIOS ROM Size $bios_size"
echo -e "\n\n\npress ENTER to exit ..."
echo -ven "\n\n\n" "VTMENU_ENTER_EXIT ..."
read vtInputKey
}

View File

@ -63,5 +63,9 @@
"VTMENU_PERSIST_USE": "الإقلاع مع",
"VTMENU_BROWER_RETURN": "العودة",
"VTMENU_ENTER_EXIT": "اضغط على مفتاح Enter للخروج",
"VTMENU_ENTER_REBOOT": "اضغط على مفتاح Enter لإعادة التشغيل",
"VTMENU_ENTER_CONTINUE": "اضغط على مفتاح Enter للمتابعة",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "ফিরে",
"VTMENU_ENTER_EXIT": "প্রস্থান করার জন্য এন্টার কী টিপুন",
"VTMENU_ENTER_REBOOT": "রিবুট করতে এন্টার কী টিপুন",
"VTMENU_ENTER_CONTINUE": "চালিয়ে যেতে এন্টার কী টিপুন",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "Zurück",
"VTMENU_ENTER_EXIT": "Drücken Sie zum Beenden die Eingabetaste",
"VTMENU_ENTER_REBOOT": "Drücken Sie die Eingabetaste, um neu zu starten",
"VTMENU_ENTER_CONTINUE": "Drücken Sie die Eingabetaste, um fortzufahren",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "Return",
"VTMENU_ENTER_EXIT": "press Enter key to exit",
"VTMENU_ENTER_REBOOT": "press Enter key to reboot",
"VTMENU_ENTER_CONTINUE": "press Enter key to continue",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "Retour",
"VTMENU_ENTER_EXIT": "appuyez sur la touche Entrée pour quitter",
"VTMENU_ENTER_REBOOT": "appuyez sur la touche Entrée pour redémarrer",
"VTMENU_ENTER_CONTINUE": "appuyez sur la touche Entrée pour continuer",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "लौटें",
"VTMENU_ENTER_EXIT": "बाहर निकलने के लिए एंटर कुंजी दबाएं",
"VTMENU_ENTER_REBOOT": "रिबूट करने के लिए एंटर कुंजी दबाएं",
"VTMENU_ENTER_CONTINUE": "जारी रखने के लिए एंटर कुंजी दबाएं",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "Return",
"VTMENU_ENTER_EXIT": "pritisnite tipku Enter za izlaz",
"VTMENU_ENTER_REBOOT": "pritisnite tipku Enter za ponovno pokretanje",
"VTMENU_ENTER_CONTINUE": "pritisnite tipku Enter za nastavak",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "Vissza",
"VTMENU_ENTER_EXIT": "nyomja meg az Enter billentyűt a kilépéshez",
"VTMENU_ENTER_REBOOT": "nyomja meg az Enter billentyűt az újraindításhoz",
"VTMENU_ENTER_CONTINUE": "a folytatáshoz nyomja meg az Enter billentyűt",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "Kembali",
"VTMENU_ENTER_EXIT": "tekan tombol Enter untuk keluar",
"VTMENU_ENTER_REBOOT": "tekan tombol Enter untuk reboot",
"VTMENU_ENTER_CONTINUE": "tekan tombol Enter untuk melanjutkan",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "戻る",
"VTMENU_ENTER_EXIT": "Enterキーを押して終了します",
"VTMENU_ENTER_REBOOT": "Enterキーを押して再起動します",
"VTMENU_ENTER_CONTINUE": "Enterキーを押して続行します",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "დაბრუნება",
"VTMENU_ENTER_EXIT": "გასასვლელად დააჭირეთ Enter ღილაკს",
"VTMENU_ENTER_REBOOT": "დააჭირეთ Enter ღილაკს გადატვირთვისთვის",
"VTMENU_ENTER_CONTINUE": "გასაგრძელებლად დააჭირეთ Enter ღილაკს",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "돌아가기",
"VTMENU_ENTER_EXIT": "Enter 키를 눌러 종료",
"VTMENU_ENTER_REBOOT": "Enter 키를 눌러 재부팅",
"VTMENU_ENTER_CONTINUE": "계속하려면 Enter 키를 누르십시오",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "Powrót",
"VTMENU_ENTER_EXIT": "naciśnij klawisz Enter, aby wyjść",
"VTMENU_ENTER_REBOOT": "naciśnij klawisz Enter, aby ponownie uruchomić",
"VTMENU_ENTER_CONTINUE": "naciśnij klawisz Enter, aby kontynuować",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "Voltar",
"VTMENU_ENTER_EXIT": "pressione a tecla Enter para sair",
"VTMENU_ENTER_REBOOT": "pressione a tecla Enter para reiniciar",
"VTMENU_ENTER_CONTINUE": "pressione a tecla Enter para continuar",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "Вернуться",
"VTMENU_ENTER_EXIT": "нажмите клавишу Enter, чтобы выйти",
"VTMENU_ENTER_REBOOT": "нажмите клавишу Enter для перезагрузки",
"VTMENU_ENTER_CONTINUE": "нажмите клавишу Enter, чтобы продолжить",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "Return",
"VTMENU_ENTER_EXIT": "press Enter key to exit",
"VTMENU_ENTER_REBOOT": "press Enter key to reboot",
"VTMENU_ENTER_CONTINUE": "press Enter key to continue",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "திரும்பு",
"VTMENU_ENTER_EXIT": "வெளியேற Enter விசையை அழுத்தவும்",
"VTMENU_ENTER_REBOOT": "மறுதொடக்கம் செய்ய Enter விசையை அழுத்தவும்",
"VTMENU_ENTER_CONTINUE": "தொடர Enter விசையை அழுத்தவும்",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "Geri Dön",
"VTMENU_ENTER_EXIT": ıkmak için ENTER tuşuna basın",
"VTMENU_ENTER_REBOOT": "yeniden başlatmak için ENTER'a basın",
"VTMENU_ENTER_CONTINUE": "devam etmek için ENTER'a basın",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "返回",
"VTMENU_ENTER_EXIT": "按回车键退出",
"VTMENU_ENTER_REBOOT": "按回车键重启",
"VTMENU_ENTER_CONTINUE": "按回车键继续",
"MENU_STR_XXX": ""
}

View File

@ -77,5 +77,9 @@
"VTMENU_BROWER_RETURN": "返回",
"VTMENU_ENTER_EXIT": "按回車鍵退出",
"VTMENU_ENTER_REBOOT": "按回車鍵重啟",
"VTMENU_ENTER_CONTINUE": "按回車鍵繼續",
"MENU_STR_XXX": ""
}