changes...

This commit is contained in:
2024-09-19 23:38:26 +05:00
parent d44835c5cb
commit f70fd02e93
5 changed files with 67 additions and 70 deletions

View File

@ -143,11 +143,11 @@ export -f generate_pot
eval_translations () {
# Для того чтобы раскрывать переменную уже после создания массива
# Вместо {translations[\$TEST text]} нужно (eval_translations "\${TEST} text" "TEST=test") в переводе переменная должна быть в {}
# Вместо {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//*=/}}"
echo "${translations[$1]//\$*"%"/${2//*=/}}"
}
create_translations () {
@ -213,7 +213,7 @@ EOF
fi
if [[ $msgid =~ "\$" ]] ; then
msgid=${msgid//"\$"/\\$}
if [[ $msgstr =~ "\${" ]] ; then
if [[ $msgstr =~ "\$%" ]] ; then
msgstr=${msgstr//"\$"/\\$}
fi
fi
@ -4716,7 +4716,7 @@ gui_gamescope () {
else
if check_flatpak ; then
GAMESCOPE_VERSION="$(grep 'VERSION_ID=' /etc/os-release)"
GAMESCOPE_NEED_INSTALL=$(eval_translations "<b>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)</b>" "GAMESCOPE_VERSION=${GAMESCOPE_VERSION//VERSION_ID=/}")
GAMESCOPE_NEED_INSTALL=$(eval_translations "<b>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)</b>" "GAMESCOPE_VERSION=${GAMESCOPE_VERSION//VERSION_ID=/}")
YAD_TEXT_SELECTION="--selectable-labels"
else
GAMESCOPE_NEED_INSTALL="${translations[<b>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.</b>]}"
@ -5857,10 +5857,10 @@ gui_credits () {
source "${PORT_WINE_PATH}/data/scripts/thanks"
"${pw_yad}" --plug="${KEY_CREDITS}" --tabnum=1 --show-uri --scroll \
--text-align=center --text="PortProton v. ${install_ver}
${translations[scripts]} v. ${scripts_install_ver}" --text-info <<< "https://linux-gaming.ru
--text-align=center --text="${translations[PortProton v. \${install_ver}
scripts v. \${scripts_install_ver}]}" --text-info <<< "https://linux-gaming.ru
$(eval_translations "Copyright © \${DATE} Castro-Fidel (linux-gaming.ru)" "DATE=$(date +%Y)")
$(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 &
@ -5873,7 +5873,7 @@ $(credits_devel)" 2>/dev/null &
"${pw_yad}" --plug="${KEY_CREDITS}" --tabnum=3 --text-info --scroll <<< "$(eval_translations "MIT License
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

View File

@ -161,30 +161,14 @@ export pw_yad="${PW_GUI_THEMES_PATH}/gui/yad_gui_pp"
change_locale
scripts_install_ver=$(<"${PORT_WINE_TMP_PATH}/scripts_ver")
export scripts_install_ver
if [[ ! -f "${PORT_SCRIPTS_PATH}/translations/$LANGUAGE" ]] ; then
create_translations
fi
unset translations
# shellcheck source=/dev/null
source "${PORT_SCRIPTS_PATH}/translations/$LANGUAGE"
if [[ $TRANSLATIONS_VER != "$scripts_install_ver" ]] ; then
try_remove_dir "${PORT_SCRIPTS_PATH}/translations"
create_translations
# shellcheck source=/dev/null
source "${PORT_SCRIPTS_PATH}/translations/$LANGUAGE"
fi
export urlg="https://linux-gaming.ru/portproton/"
export url_cloud="https://cloud.linux-gaming.ru/portproton"
export PW_WINELIB="${PORT_WINE_TMP_PATH}/libs${PW_LIBS_VER}"
try_remove_dir "${PW_WINELIB}/var"
install_ver="$(<"${PORT_WINE_TMP_PATH}/PortProton_ver")"
export install_ver
scripts_install_ver=$(<"${PORT_WINE_TMP_PATH}/scripts_ver")
export scripts_install_ver
export WINETRICKS_DOWNLOADER="curl"
export USER_CONF="${PORT_WINE_PATH}/data/user.conf"
check_user_conf
@ -370,6 +354,21 @@ if [[ "${SKIP_CHECK_UPDATES}" != 1 ]] ; then
export PW_FILESYSTEM
fi
if [[ ! -f "${PORT_SCRIPTS_PATH}/translations/$LANGUAGE" ]] ; then
create_translations
fi
unset translations
# shellcheck source=/dev/null
source "${PORT_SCRIPTS_PATH}/translations/$LANGUAGE"
if [[ $TRANSLATIONS_VER != "$scripts_install_ver" ]] ; then
try_remove_dir "${PORT_SCRIPTS_PATH}/translations"
create_translations
# shellcheck source=/dev/null
source "${PORT_SCRIPTS_PATH}/translations/$LANGUAGE"
fi
# create lock file
if ! check_flatpak ; then
if [[ -f "${PW_TMPFS_PATH}/portproton.lock" ]] ; then