Merge branch 'added-disabled-translations' of github.com:Htylol/PortWINE into Htylol-added-disabled-translations

This commit is contained in:
Mikhail Tergoev
2024-10-19 13:20:02 +03:00
4 changed files with 73 additions and 25 deletions

View File

@ -921,7 +921,7 @@ combobox_fix () {
local name1 name2
if [[ "$1" == "--disabled" ]] ; then
if [[ -z "$3" ]] ; then
echo "disabled"
echo "${translations[Disabled]}"
return 0
fi
name1="$2"
@ -950,8 +950,16 @@ combobox_fix () {
then name3="${name3%\!"${name1}"}"
fi
if [[ "$1" == "--disabled" ]] ; then
if [[ ${name1} != "disabled" ]]
then fix_disabled="!disabled"
if [[ ${name1} == "disabled" ]] ; then
name1="${translations[Disabled]}"
if [[ ${name3} =~ enabled ]] ; then
name3="${name3//enabled/${translations[Enable]}}"
fi
elif [[ ${name1} != "disabled" ]] ; then
fix_disabled="!${translations[Disable]}"
if [[ ${name1} == "enabled" ]] ; then
name1="${translations[Enabled]}"
fi
fi
echo "${name1}${name3}${fix_disabled}"
elif [[ "$1" == "--empty" ]] ; then
@ -2235,9 +2243,15 @@ edit_db_from_gui () {
&& [[ -f "$PORTWINE_DB_FILE" ]]
then
for mod_db in $@ ; do
proxy_mod_db="${!mod_db}"
if [[ $proxy_mod_db =~ (${translations[Disabled]}|${translations[Disable]}) ]] ; then
proxy_mod_db=disabled
elif [[ $proxy_mod_db =~ (${translations[Enabled]}|${translations[Enable]}) ]] ; then
proxy_mod_db=enabled
fi
if [[ $(<"${PORTWINE_DB_FILE}") =~ export\ ${mod_db}= ]]
then sed -i "s|export ${mod_db}=.*|export ${mod_db}=\"${!mod_db}\"|g" "${PORTWINE_DB_FILE}"
else echo "export ${mod_db}=\"${!mod_db}\"" >> "${PORTWINE_DB_FILE}"
then sed -i "s|export ${mod_db}=.*|export ${mod_db}=\"$proxy_mod_db\"|g" "${PORTWINE_DB_FILE}"
else echo "export ${mod_db}=\"$proxy_mod_db\"" >> "${PORTWINE_DB_FILE}"
fi
done
fi
@ -2246,15 +2260,21 @@ edit_db_from_gui () {
edit_user_conf_from_gui () {
for mod_db in $@ ; do
proxy_mod_db="${!mod_db}"
if [[ $proxy_mod_db =~ (${translations[Disabled]}|${translations[Disable]}) ]] ; then
proxy_mod_db=disabled
elif [[ $proxy_mod_db =~ (${translations[Enabled]}|${translations[Enable]}) ]] ; then
proxy_mod_db=enabled
fi
if ! grep "export ${mod_db}=" "${USER_CONF}" &>/dev/null
then echo "export ${mod_db}=\"${!mod_db}\"" >> "${USER_CONF}"
then echo "export ${mod_db}=\"$proxy_mod_db\"" >> "${USER_CONF}"
elif grep "export ${mod_db}=" "${USER_CONF}" | grep -v "#" &>/dev/null
then
if [[ "$(grep "export ${mod_db}=" "${USER_CONF}" | grep -v "#")" != "export ${mod_db}=\"${!mod_db}\"" ]]
then sed -ri "s/^export ${mod_db}=.*/export ${mod_db}=\"${!mod_db}\"/" "${USER_CONF}"
if [[ "$(grep "export ${mod_db}=" "${USER_CONF}" | grep -v "#")" != "export ${mod_db}=\"$proxy_mod_db\"" ]]
then sed -ri "s/^export ${mod_db}=.*/export ${mod_db}=\"$proxy_mod_db\"/" "${USER_CONF}"
fi
elif [[ "$(grep "export ${mod_db}=" "${USER_CONF}")" != "export ${mod_db}=${!mod_db}" ]]
then sed -ri "s/.*export ${mod_db}=.*/export ${mod_db}=\"${!mod_db}\"/g" "${USER_CONF}"
elif [[ "$(grep "export ${mod_db}=" "${USER_CONF}")" != "export ${mod_db}=$proxy_mod_db" ]]
then sed -ri "s/.*export ${mod_db}=.*/export ${mod_db}=\"$proxy_mod_db\"/g" "${USER_CONF}"
fi
done
return 0
@ -4485,7 +4505,7 @@ relaxed - Same as fifo but allows tearing when below the monitors refresh rate.]
PW_LOCALE_SELECT="${PW_ADD_SETTINGS[9]}"
PW_MESA_VK_WSI_PRESENT_MODE="${PW_ADD_SETTINGS[10]}"
if [[ "${CPU_LIMIT}" != "disabled" ]] ; then
if [[ "${CPU_LIMIT}" =~ [0-9]+ ]] ; then
PW_WINE_CPU_TOPOLOGY="${CPU_LIMIT}:$(seq -s, 0 $(( CPU_LIMIT - 1 )))"
else
PW_WINE_CPU_TOPOLOGY="disabled"
@ -5279,8 +5299,8 @@ gui_userconf () {
--field="${translations[Choose a graphics card to run the game]}!${translations[Select which video card will be used to run the game (used for all running games and programs in PortProton)]} :CB" "$(combobox_fix --disabled "$GPU_VAR" "$GET_GPU_NAMES")" \
--field="${translations[Choice wine audio driver]}!${translations[Fixes sound popling if choice alsa]} :CB" "$(combobox_fix --disabled "$SOUND_DRIVER_VAR" "alsa!oss!pulse")" \
--field="${translations[Choice gui themes]}!${translations[Allows you to select a theme for PortProton]} :CB" "$(combobox_fix "$GUI_THEME" "default!compact!classic")" \
--field="${translations[Time display]}!${translations[Displays time spent in an application or game]} :CB" "$(combobox_fix "$DESKTOP_WITH_TIME" "enabled!disabled")" \
--field="${translations[Sort shortcuts by time]}!${translations[This setting sorts the shortcuts in the main menu depending on the time spent in the application or game]} :CB" "$(combobox_fix "$SORT_WITH_TIME" "enabled!disabled")" \
--field="${translations[Time display]}!${translations[Displays time spent in an application or game]} :CB" "$(combobox_fix --disabled "$DESKTOP_WITH_TIME" "enabled")" \
--field="${translations[Sort shortcuts by time]}!${translations[This setting sorts the shortcuts in the main menu depending on the time spent in the application or game]} :CB" "$(combobox_fix --disabled "$SORT_WITH_TIME" "enabled")" \
1> "${PW_TMPFS_PATH}/tmp_yad_userconf_set_cb" 2>/dev/null &
"${pw_yad}" --key=$KEY_USERCONF_GUI --paned --sensitive \