fixed merge pot

This commit is contained in:
Mikhail Tergoev
2024-11-01 17:25:37 +03:00
parent 34e4bbc809
commit 10584f54f7
6 changed files with 187 additions and 72 deletions

View File

@ -200,28 +200,17 @@ change_locale () {
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
sed 's/{translations\[/(gettext \"/g' add_in_steam.sh > add_in_steam.sh_tmp
sed -i 's/]}/")/g' add_in_steam.sh_tmp
sed -i 's/eval_translations/gettext/g' add_in_steam.sh_tmp
local FILES_FOR_GETTEXT i
FILES_FOR_GETTEXT=(functions_helper start.sh setup.sh add_in_steam.sh help_info)
for i in ${FILES_FOR_GETTEXT[@]} ; do
sed 's/{translations\[/(gettext \"/g' "${PORT_SCRIPTS_PATH}/$i" > "${PORT_SCRIPTS_PATH}/${i}_tmp"
sed -i 's/]}/")/g' "${PORT_SCRIPTS_PATH}/${i}_tmp"
sed -i 's/eval_translations/gettext/g' "${PORT_SCRIPTS_PATH}/${i}_tmp"
done
#Когда присходит предупреждение: синтаксис $"..." запрещен по соображениям безопасности; используйте eval_gettext
#и ругается на строку в которой нет перевода, можно использовать sed -i '//d' и убрать эту строку
#либо отредактировать сам код, чтобы не было такой ошибки (к примеру вместо двойных ковычек использовать в таком месте одинарные)
for lang in $LANGUAGES_LIST
do
for lang in $LANGUAGES_LIST ; do
echo "${lang}"
create_new_dir "${PORT_WINE_PATH}/data/locales/${lang}/LC_MESSAGES/"
LANG_PO="${PORT_WINE_PATH}/data/locales/${lang}/LC_MESSAGES/PortProton.po"
@ -233,6 +222,7 @@ generate_pot () {
"data/scripts/setup.sh_tmp" \
"data/scripts/functions_helper_tmp" \
"data/scripts/add_in_steam.sh_tmp" \
"data/scripts/help_info_tmp" \
-o "$TEMPLATE_POT"
popd 1>/dev/null || fatal
if [[ -f "$LANG_PO" ]] ; then
@ -248,6 +238,7 @@ generate_pot () {
try_remove_file "${PORT_SCRIPTS_PATH}/setup.sh_tmp"
try_remove_file "${PORT_SCRIPTS_PATH}/functions_helper_tmp"
try_remove_file "${PORT_SCRIPTS_PATH}/add_in_steam.sh_tmp"
try_remove_file "${PORT_SCRIPTS_PATH}/help_info_tmp"
try_remove_dir "${PW_CACHE_LANG_PATH}"
}
export -f generate_pot
@ -2534,7 +2525,7 @@ pw_check_command () {
unset TIMEOUT_CMD
return 1
else
print_info "$S_CMD - found"
# print_info "$S_CMD - found"
unset TIMEOUT_CMD
return 0
fi

View File

@ -0,0 +1,18 @@
#!/bin/bash
files_from_autoinstall=$(ls "${PORT_SCRIPTS_PATH}/pw_autoinstall")
echo -e "${translations[use]}: [--repair] [--reinstall] [--autoinstall]
--repair ${translations[Forces all scripts to be updated to a working state
(helps if PortProton is not working)]}
--reinstall ${translations[Reinstalls PortProton and resets all settings to default]}
--generate-pot ${translations[Creates a files with translations .pot and .po]}
--debug ${translations[Debug scripts for PortProton
(saved log in]} $PORT_WINE_PATH/scripts-debug.log)
--update ${translations[Check update scripts for PortProton]}
--launch ${translations[Launches the application immediately, requires the path to the .exe file]}
--edit-db ${translations[After the variable, the path to the .exe file is required and then the variables.
(List their variables and values for example PW_MANGOHUD=1 PW_VKBASALT=0, etc.)]}
--autoinstall ${translations[--autoinstall and the name of what needs to be installed is given in the list below:]}
$(echo $files_from_autoinstall | awk '{for (i = 1; i <= NF; i++) {if (i % 10 == 0) {print ""} printf "%s ", $i}}')
"

View File

@ -18,7 +18,6 @@ echo '
██║░░░░░╚█████╔╝██║░░██║░░░██║░░░██║░░░░░██║░░██║╚█████╔╝░░░██║░░░╚█████╔╝██║░╚███║
╚═╝░░░░░░╚════╝░╚═╝░░╚═╝░░░╚═╝░░░╚═╝░░░░░╚═╝░░╚═╝░╚════╝░░░░╚═╝░░░░╚════╝░╚═╝░░╚══╝
'
$PW_DEBUG
if [[ $(id -u) = 0 ]] \
@ -366,68 +365,50 @@ fi
### CLI ###
case "$1" in
'--help' )
files_from_autoinstall=$(ls "${PORT_SCRIPTS_PATH}/pw_autoinstall")
echo -e "
use: [--repair] [--reinstall] [--autoinstall]
--repair forces all scripts to be updated to a working state
(helps if PortProton is not working)
--reinstall reinstall files of the portproton to default settings
--autoinstall [script_frome_pw_autoinstall] autoinstall from the list below:
"
echo ${files_from_autoinstall}
echo "
--generate-pot generated pot file
"
echo "
--debug debug scripts for PortProton
(saved log in $PORT_WINE_PATH/scripts-debug.log)
"
echo "
--update check update scripts for PortProton
"
exit 0 ;;
'--reinstall' )
--help)
# shellcheck source=/dev/null
source "${PORT_SCRIPTS_PATH}/help_info"
exit 0
;;
--reinstall)
export PW_REINSTALL_FROM_TERMINAL=1
pw_reinstall_pp ;;
'--autoinstall' )
pw_reinstall_pp
;;
--autoinstall)
export PW_YAD_SET="$2"
pw_autoinstall_from_db
exit 0 ;;
'--generate-pot' )
exit 0
;;
--generate-pot)
generate_pot
exit 0 ;;
'--debug' )
exit 0
;;
--debug)
clear
export PW_DEBUG="set -x"
/usr/bin/env bash -c ${pw_full_command_line[@]} 2>&1 | tee "$PORT_WINE_PATH/scripts-debug.log" &
exit 0 ;;
'--server-file-access' )
exit 0
;;
--server-file-access)
echo
curl -s --list-only "https://cloud.linux-gaming.ru/log/$(date +20%y_%m)_file_access.log" | sort -V -k 2,2 \
| sed 's/count=//g' | awk '{a=$1; $1=$2; $2=a} 1' | awk 'BEGIN {print "Count: Name:"} {print}' | column -t
echo
exit 0 ;;
'--update' )
gui_pw_update ;;
'--launch' )
exit 0
;;
--update)
gui_pw_update
;;
--launch)
portwine_launch
stop_portwine ;;
'--edit-db' )
stop_portwine
;;
--edit-db)
# --edit-db /полный/путь/до/файла.exe PW_MANGOHUD=1 PW_VKBASALT=0 (и т.д) для примера
set_several_variables ${@:3}
edit_db_from_gui $keys_all
exit 0 ;;
exit 0
;;
esac
### GUI ###