submenu "Change language (press F2)" --hotkey 'f2' { insmod regexp for langstr in "ru_RU=Russian" "en_US=English" "pt_BR=Portuguese" "kk_KZ=Kazakh" "uk_UA=Ukrainian"; do regexp -s 2:langname -s 1:langcode '(.*)=(.*)' "$langstr" menuentry "${langname}" "$langcode" { lang="$2" export lang configfile ${prefix}/grub.cfg } done menuentry "Return to the Main menu" { configfile ${prefix}/grub.cfg } }