diff --git a/data_from_portwine/locales/PortProton.pot b/data_from_portwine/locales/PortProton.pot index 29838ccb..acb0b629 100644 --- a/data_from_portwine/locales/PortProton.pot +++ b/data_from_portwine/locales/PortProton.pot @@ -7,7 +7,7 @@ msgid "" msgstr "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" - "POT-Creation-Date: 2024-09-19 00:55+0500\n" + "POT-Creation-Date: 2024-09-19 21:02+0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -1552,7 +1552,7 @@ msgid "scripts" msgstr "" #, sh-format -msgid "Copyright © $DATE Castro-Fidel (linux-gaming.ru)" +msgid "Copyright © ${DATE} Castro-Fidel (linux-gaming.ru)" msgstr "" msgid "This program comes with absolutely no warranty.\n" @@ -1564,11 +1564,10 @@ msgid "Author: Casro-Fidel (Mikhail Tergoev)\n" "Developer assistants and testers:" msgstr "" -msgid "MIT License" -msgstr "" - #, sh-format -msgid "Copyright © $DATE Castro-Fidel (linux-gaming.ru)\n" +msgid "MIT License\n" + "\n" + "Copyright © ${DATE} Castro-Fidel (linux-gaming.ru)\n" "\n" "Permission is hereby granted, free of charge, to any person " "obtaining a copy\n" diff --git a/data_from_portwine/locales/es/LC_MESSAGES/PortProton.po b/data_from_portwine/locales/es/LC_MESSAGES/PortProton.po index ce031de9..c87604cf 100644 --- a/data_from_portwine/locales/es/LC_MESSAGES/PortProton.po +++ b/data_from_portwine/locales/es/LC_MESSAGES/PortProton.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-19 00:55+0500\n" +"POT-Creation-Date: 2024-09-19 20:52+0500\n" "PO-Revision-Date: 2024-09-15 15:29+0500\n" "Last-Translator: \n" "Language-Team: \n" @@ -2011,7 +2011,7 @@ msgid "scripts" msgstr "Actualizar scripts:" #, sh-format -msgid "Copyright © $DATE Castro-Fidel (linux-gaming.ru)" +msgid "Copyright © ${DATE} Castro-Fidel (linux-gaming.ru)" msgstr "" msgid "" @@ -2025,12 +2025,11 @@ msgid "" "Developer assistants and testers:" msgstr "" -msgid "MIT License" -msgstr "" - #, sh-format msgid "" -"Copyright © $DATE Castro-Fidel (linux-gaming.ru)\n" +"MIT License\n" +"\n" +"Copyright © ${DATE} Castro-Fidel (linux-gaming.ru)\n" "\n" "Permission is hereby granted, free of charge, to any person obtaining a " "copy\n" diff --git a/data_from_portwine/locales/ru/LC_MESSAGES/PortProton.po b/data_from_portwine/locales/ru/LC_MESSAGES/PortProton.po index 94c9bfc1..12b9517b 100644 --- a/data_from_portwine/locales/ru/LC_MESSAGES/PortProton.po +++ b/data_from_portwine/locales/ru/LC_MESSAGES/PortProton.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-09-19 00:55+0500\n" -"PO-Revision-Date: 2024-09-18 22:48+0500\n" +"POT-Creation-Date: 2024-09-19 20:52+0500\n" +"PO-Revision-Date: 2024-09-19 21:03+0500\n" "Last-Translator: \n" "Language-Team: \n" "Language: ru_RU\n" @@ -1976,9 +1976,9 @@ msgstr "СОХРАНИТЬ" msgid "scripts" msgstr "версия" -#, fuzzy, sh-format -msgid "Copyright © $DATE Castro-Fidel (linux-gaming.ru)" -msgstr "Авторские права © $DATE Castro-Fidel (linux-gaming.ru)" +#, sh-format +msgid "Copyright © ${DATE} Castro-Fidel (linux-gaming.ru)" +msgstr "Авторские права © ${DATE} Castro-Fidel (linux-gaming.ru)" msgid "" "This program comes with absolutely no warranty.\n" @@ -1996,12 +1996,11 @@ msgstr "" "\n" "Помощники разработчика и тестировщики:" -msgid "MIT License" -msgstr "Лицензия Массачусетского технологического института (MIT License)" - #, sh-format msgid "" -"Copyright © $DATE Castro-Fidel (linux-gaming.ru)\n" +"MIT License\n" +"\n" +"Copyright © ${DATE} Castro-Fidel (linux-gaming.ru)\n" "\n" "Permission is hereby granted, free of charge, to any person obtaining a " "copy\n" @@ -2027,7 +2026,9 @@ msgid "" "THE\n" "SOFTWARE." msgstr "" -"Авторские права © $DATE Castro-Fidel (linux-gaming.ru)\n" +"Лицензия Массачусетского технологического института (MIT License)\n" +"\n" +"Авторские права © ${DATE} Castro-Fidel (linux-gaming.ru)\n" "\n" "Настоящим предоставляется бесплатное разрешение любому лицу, получившему " "копию данного\n" @@ -2136,6 +2137,9 @@ msgstr "ПРИСОЕДЕНИТЬСЯ" msgid "THIRD PARTY LIBRARIES" msgstr "БИБЛИОТЕКИ" +#~ msgid "MIT License" +#~ msgstr "Лицензия Массачусетского технологического института (MIT License)" + #~ msgid "(Can be selected and copied)" #~ msgstr "(можно выделить и скопировать)" diff --git a/data_from_portwine/scripts/functions_helper b/data_from_portwine/scripts/functions_helper index 53d8581a..f5126fe9 100755 --- a/data_from_portwine/scripts/functions_helper +++ b/data_from_portwine/scripts/functions_helper @@ -97,12 +97,15 @@ export -f change_locale generate_pot () { sed 's/{translations\[/(gettext \"/g' functions_helper > functions_helper_tmp sed -i 's/]}/")/g' functions_helper_tmp + sed -i 's/eval_translations/gettext/g' functions_helper_tmp sed 's/{translations\[/(gettext \"/g' start.sh > start.sh_tmp sed -i 's/]}/")/g' start.sh_tmp + sed -i 's/eval_translations/gettext/g' start.sh_tmp sed 's/{translations\[/(gettext \"/g' setup.sh > setup.sh_tmp sed -i 's/]}/")/g' setup.sh_tmp + sed -i 's/eval_translations/gettext/g' setup.sh_tmp #Когда присходит предупреждение: синтаксис $"..." запрещен по соображениям безопасности; используйте eval_gettext #и ругается на строку в которой нет перевода, можно использовать sed -i '//d' и убрать эту строку @@ -138,6 +141,15 @@ generate_pot () { } export -f generate_pot +eval_translations () { + # Для того чтобы раскрывать переменную уже после создания массива + # Вместо {translations[\$TEST text]} нужно (eval_translations "\${TEST} text" "TEST=test") в переводе переменная должна быть в {} + # В остальных случаях можно использовать {translations[\$TEST text]} ,но переменную нужно обьявлять до создания массива + # до source "${PORT_SCRIPTS_PATH}/translations/$LANGUAGE" или можно использовать команды {translations[\$(cat file.txt) text]} + # но тогда выполнение команды будет происходить во время создания массива всегда, а не там где это требуется + echo "${translations[$1]//\$*"}"/${2//*=/}}" +} + create_translations () { if [[ ! -d "${PORT_SCRIPTS_PATH}/translations" ]] ; then create_new_dir "${PORT_SCRIPTS_PATH}/translations" @@ -201,6 +213,9 @@ EOF fi if [[ $msgid =~ "\$" ]] ; then msgid=${msgid//"\$"/\\$} + if [[ $msgstr =~ "\${" ]] ; then + msgstr=${msgstr//"\$"/\\$} + fi fi echo \["$msgid"\]="$msgstr" >> "${PORT_SCRIPTS_PATH}/translations/$LANGUAGE" fi @@ -4700,7 +4715,8 @@ gui_gamescope () { done else if check_flatpak ; then - GAMESCOPE_NEED_INSTALL="${translations[Gamescope is not detected on the system, to install it, run the command in the terminal:\\nflatpak install -y runtime/org.freedesktop.Platform.VulkanLayer.gamescope/x86_64/\${GAMESCOPE_VERSION}\\n(Can be selected and copied)]}" + GAMESCOPE_VERSION="$(grep 'VERSION_ID=' /etc/os-release)" + GAMESCOPE_NEED_INSTALL=$(eval_translations "Gamescope is not detected on the system, to install it, run the command in the terminal:\\nflatpak install -y runtime/org.freedesktop.Platform.VulkanLayer.gamescope/x86_64/\${GAMESCOPE_VERSION}\\n(Can be selected and copied)" "GAMESCOPE_VERSION=${GAMESCOPE_VERSION//VERSION_ID=/}") YAD_TEXT_SELECTION="--selectable-labels" else GAMESCOPE_NEED_INSTALL="${translations[Gamescope is not detected on the system, please contact the manufacturer of your distribution\\nor search the Internet for information on how to install gamescope on your system.]}" @@ -5844,7 +5860,7 @@ gui_credits () { --text-align=center --text="PortProton v. ${install_ver} ${translations[scripts]} v. ${scripts_install_ver}" --text-info <<< "https://linux-gaming.ru -${translations[Copyright © \$DATE Castro-Fidel (linux-gaming.ru)]} +$(eval_translations "Copyright © \${DATE} Castro-Fidel (linux-gaming.ru)" "DATE=$(date +%Y)") ${translations[This program comes with absolutely no warranty. See the License for details.]}" 2>/dev/null & @@ -5855,9 +5871,9 @@ See the License for details.]}" 2>/dev/null & Developer assistants and testers:]} $(credits_devel)" 2>/dev/null & - "${pw_yad}" --plug="${KEY_CREDITS}" --tabnum=3 --text-info --scroll <<< "${translations[MIT License]} + "${pw_yad}" --plug="${KEY_CREDITS}" --tabnum=3 --text-info --scroll <<< "$(eval_translations "MIT License -${translations[Copyright © \$DATE Castro-Fidel (linux-gaming.ru) +Copyright © \${DATE} Castro-Fidel (linux-gaming.ru) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal @@ -5875,7 +5891,7 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE.]}" 2>/dev/null & +SOFTWARE." "DATE=$(date +%Y)")" 2>/dev/null & "${pw_yad}" --plug="${KEY_CREDITS}" --tabnum=4 \ --text-info --show-uri --scroll \ diff --git a/data_from_portwine/scripts/start.sh b/data_from_portwine/scripts/start.sh index f81c1709..951a3be9 100755 --- a/data_from_portwine/scripts/start.sh +++ b/data_from_portwine/scripts/start.sh @@ -168,13 +168,6 @@ if [[ ! -f "${PORT_SCRIPTS_PATH}/translations/$LANGUAGE" ]] ; then create_translations fi -# для переводов нужно экспортировать переменные заранее -# так же можно использовать сразу команду или функцию -# по типу $(...), но тоже заранее функцию нужно экспортировать -DATE=$(date +%Y) -GAMESCOPE_VERSION="$(grep 'VERSION_ID=' /etc/os-release)" -GAMESCOPE_VERSION="${GAMESCOPE_VERSION//VERSION_ID=/}" - unset translations # shellcheck source=/dev/null source "${PORT_SCRIPTS_PATH}/translations/$LANGUAGE"