mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
gettext repair
This commit is contained in:
parent
a47294ed7a
commit
80afdf28aa
1 changed files with 67 additions and 66 deletions
133
dh
133
dh
|
@ -2,42 +2,40 @@
|
|||
|
||||
# bugs notice
|
||||
function some_bugs() {
|
||||
echo "$(gettext "Done")
|
||||
PS: $(gettext "You saw some bugs?")
|
||||
$(gettext "Could you please provide feedback?")
|
||||
$(gettext "How do you like DistroHopper?")
|
||||
$(gettext "What can be improved, added, changed?")
|
||||
$(gettext " Let me know...")
|
||||
$(gettext "Flawless distro hopping...") zenobit"
|
||||
echo $"Done"
|
||||
echo $"PS: You saw some bugs?"
|
||||
echo $"Could you please provide feedback?"
|
||||
echo $"How do you like DistroHopper?"
|
||||
echo $"What can be improved, added, changed?"
|
||||
echo $" Let me know..."
|
||||
echo $"Flawless distro hopping..." && echo "zenobit"
|
||||
}
|
||||
|
||||
function show_help() {
|
||||
printf "DistroHopper v. $version\nquickemu v. $("$prefix"quickemu --version)\n"
|
||||
echo "
|
||||
$(gettext "Possible arguments:")
|
||||
-h --help $(gettext "Show this help and exit")
|
||||
---------------------------------------------------------
|
||||
-d --dir $(gettext "Set default directory where VMs are stored")
|
||||
-i --install $(gettext "Install DistroHopper")
|
||||
---------------------------------------------------------
|
||||
-m --mode $(gettext "Portable mode")
|
||||
---------------------------------------------------------
|
||||
-s --supported $(gettext "Update supported VMs")
|
||||
-r --ready $(gettext "Update ready to run VMs")
|
||||
---------------------------------------------------------
|
||||
-t --tui $(gettext "Run TUI")
|
||||
-g --gui $(gettext "Run GUI")
|
||||
---------------------------------------------------------
|
||||
-a --add $(gettext "Add new distro to quickget")
|
||||
-f --functions $(gettext "Sort functions in quickget")
|
||||
-p --push $(gettext "Push changed quickget to quickemu project #todo")
|
||||
---------------------------------------------------------
|
||||
-c --copy $(gettext "Copy all ISOs to target dir (for Ventoy)")
|
||||
---------------------------------------------------------
|
||||
$(gettext "Homepage:") dh.osowoso.xyz
|
||||
$(gettext "Project hosted at:") https://github.com/oSoWoSo/DistroHopper
|
||||
$(gettext "Chat group on SimpleX:") https://tinyurl.com/7hm4kcjx
|
||||
"
|
||||
echo $"Possible arguments:"
|
||||
echo $" -h --help Show this help and exit"
|
||||
echo "---------------------------------------------------------"
|
||||
echo $" -d --dir Set default directory where VMs are stored"
|
||||
echo $" -i --install Install DistroHopper"
|
||||
echo "---------------------------------------------------------"
|
||||
echo $" -m --mode Portable mode"
|
||||
echo "---------------------------------------------------------"
|
||||
echo $" -s --supported Update supported VMs"
|
||||
echo $" -r --ready Update ready to run VMs"
|
||||
echo "---------------------------------------------------------"
|
||||
echo $" -t --tui Run TUI"
|
||||
echo $" -g --gui Run GUI"
|
||||
echo "---------------------------------------------------------"
|
||||
echo $" -a --add Add new distro to quickget"
|
||||
echo $" -f --functions Sort functions in quickget"
|
||||
echo $" -p --push Push changed quickget to quickemu project #todo"
|
||||
echo "---------------------------------------------------------"
|
||||
echo $" -c --copy Copy all ISOs to target dir (for Ventoy)"
|
||||
echo "---------------------------------------------------------"
|
||||
echo $"Homepage: dh.osowoso.xyz"
|
||||
echo $"Project hosted at: https://github.com/oSoWoSo/DistroHopper"
|
||||
echo $"Chat group on SimpleX: https://tinyurl.com/7hm4kcjx"
|
||||
}
|
||||
|
||||
function portable() {
|
||||
|
@ -60,13 +58,13 @@ function mode_installed() {
|
|||
|
||||
# installation
|
||||
function check_gui_dependencies() {
|
||||
[ -f "$PREFIX/yad" ] || echo "$(gettext "You are missing yad...")
|
||||
It's needed for GUI!"
|
||||
[ -f "$PREFIX/yad" ] || echo $"You are missing yad...
|
||||
Needed for GUI!"
|
||||
}
|
||||
|
||||
function check_tui_dependencies() {
|
||||
[ -f "$PREFIX/fzf" ] || echo "$(gettext "You are missing fzf...")
|
||||
It's needed for TUI!"
|
||||
[ -f "$PREFIX/fzf" ] || echo $"You are missing fzf...
|
||||
Needed for TUI!"
|
||||
}
|
||||
|
||||
function set_variables() {
|
||||
|
@ -89,9 +87,9 @@ function set_variables() {
|
|||
|
||||
function create_structure() {
|
||||
source distrohopper.conf
|
||||
echo "$(gettext "creating config dir...")"
|
||||
echo $"creating config dir..."
|
||||
mkdir -p "$DH_CONFIG_DIR"
|
||||
echo "$(gettext "creating icons dir as root...")"
|
||||
echo $"creating icons dir as root..."
|
||||
mkdir -p "$DH_ICON_DIR" >/dev/null 2>&1 || sudo mkdir -p "$DH_ICON_DIR"
|
||||
}
|
||||
|
||||
|
@ -114,9 +112,9 @@ function install_dh() {
|
|||
cp dh quickget quickemu macrecovery windowskey "$PREFIX" >/dev/null 2>&1 || sudo cp dh quickget quickemu macrecovery windowskey "$PREFIX"
|
||||
# quickget also to config directory for adding new distros...
|
||||
cp quickget "$DH_CONFIG_DIR/"
|
||||
echo "$(gettext "Copying icons...")"
|
||||
echo $"Copying icons..."
|
||||
cp icons/* "$DH_ICON_DIR/" >/dev/null 2>&1 || sudo cp icons/* "$DH_ICON_DIR/"
|
||||
echo "$(gettext "Copying to config dir...")"
|
||||
echo $"Copying to config dir..."
|
||||
cp -r ready "$DH_CONFIG_DIR/"
|
||||
cp -r supported "$DH_CONFIG_DIR/"
|
||||
|
||||
|
@ -126,14 +124,14 @@ function install_process() {
|
|||
check_tui_dependencies
|
||||
check_gui_dependencies
|
||||
#check_quickemu_dependencies
|
||||
echo "$(gettext "Creating directory structure...")" \
|
||||
echo $"Creating directory structure..." \
|
||||
&& create_structure \
|
||||
&& echo "$(gettext "Setting up directory...")" \
|
||||
&& echo $"Setting up directory..." \
|
||||
&& set_dir \
|
||||
&& echo "$(gettext "Installing needed...")" \
|
||||
&& echo "$(gettext "For now voidlinux only")" \
|
||||
&& echo $"Installing needed..." \
|
||||
&& echo $"For now voidlinux only" \
|
||||
&& install_prereq \
|
||||
&& echo "$(gettext "Installing DistroHopper to bin...")" \
|
||||
&& echo $"Installing DistroHopper to bin..." \
|
||||
&& install_dh
|
||||
}
|
||||
|
||||
|
@ -142,7 +140,7 @@ function renew_ready() {
|
|||
cd "$VMS_DIR" || exit 1
|
||||
rm "$DH_CONFIG_DIR"/ready/*.desktop
|
||||
if [ ! -e *.conf ]; then
|
||||
echo "$(gettext "No .conf files found")"
|
||||
echo $"No .conf files found"
|
||||
return
|
||||
fi
|
||||
for vm_conf in *.conf; do
|
||||
|
@ -274,7 +272,7 @@ function run_tui() {
|
|||
printf ' Prepared VMs:\n-------------\n\n'
|
||||
# Check if there are any VMs
|
||||
if [ ${#vms[@]} -eq 0 ]; then
|
||||
echo "$(gettext "No VMs found.")"
|
||||
echo $"No VMs found."
|
||||
exit 1
|
||||
fi
|
||||
# Print the names of the available VMs
|
||||
|
@ -395,17 +393,15 @@ function sort_functions() {
|
|||
}
|
||||
|
||||
function localization() {
|
||||
# načtení souboru s lokalizací
|
||||
. gettext.sh
|
||||
# nastavení domovského adresáře pro lokalizace
|
||||
TEXTDOMAIN=distrohopper
|
||||
TEXTDOMAINDIR=./locale
|
||||
# nastavení domovského jména pro skript
|
||||
TEXTDOMAIN=dh
|
||||
# použití gettext() pro lokalizaci výpisu
|
||||
#echo $(gettext "Hello, world!")
|
||||
#echo $"Hello, world!")
|
||||
# ask for language
|
||||
create_translation_source
|
||||
}
|
||||
|
||||
# run
|
||||
function create_translation_source() {
|
||||
cat > header.tmp <<EOF
|
||||
msgid ""
|
||||
|
@ -435,11 +431,12 @@ EOF
|
|||
bash --dump-po-strings dh > locale/strings_dump-$version.po
|
||||
}
|
||||
|
||||
# run
|
||||
set_variables
|
||||
localization
|
||||
|
||||
if [[ $# -eq 0 ]]; then
|
||||
printf "$(gettext "No argumet provided!\n\n")"
|
||||
printf $"No argumet provided!\n\n"
|
||||
show_help
|
||||
exit 0
|
||||
fi
|
||||
|
@ -457,62 +454,66 @@ do
|
|||
shift
|
||||
;;
|
||||
-i|--install)
|
||||
echo "$(gettext "Starting installation...")"
|
||||
echo $"Starting installation..."
|
||||
install_process
|
||||
shift
|
||||
;;
|
||||
-m|--mode)
|
||||
echo "$(gettext "Switching to portable mode!")"
|
||||
echo $"Switching to portable mode!"
|
||||
mode_portable
|
||||
shift
|
||||
;;
|
||||
-s|--supported)
|
||||
echo "$(gettext "Updating supported VMs...")"
|
||||
echo $"Updating supported VMs..."
|
||||
renew_supported
|
||||
shift
|
||||
;;
|
||||
-r|--ready)
|
||||
echo "$(gettext "Updating ready VMs...")"
|
||||
echo $"Updating ready VMs..."
|
||||
renew_ready
|
||||
shift
|
||||
;;
|
||||
-t|--tui)
|
||||
echo "$(gettext "Running TUI...")"
|
||||
echo $"Running TUI..."
|
||||
run_tui
|
||||
shift
|
||||
;;
|
||||
-g|--gui)
|
||||
echo "$(gettext "Starting DistroHopper GUI...")"
|
||||
echo $"Starting DistroHopper GUI..."
|
||||
run_gui
|
||||
shift
|
||||
;;
|
||||
-a|--add)
|
||||
echo "$(gettext "Adding new distro started...")"
|
||||
echo $"Adding new distro started..."
|
||||
add_distro
|
||||
shift
|
||||
;;
|
||||
-f|--functions)
|
||||
echo "$(gettext "Sorting functions in template...")"
|
||||
echo $"Sorting functions in template..."
|
||||
sort_functions
|
||||
shift
|
||||
;;
|
||||
-p|--push)
|
||||
echo "$(gettext "Pushing changes to... #TODO")"
|
||||
echo $"Pushing changes to... #TODO"
|
||||
push_changes
|
||||
shift
|
||||
;;
|
||||
-c|--copy)
|
||||
echo "$(gettext "Copying ISOs to dir. It will take some time...")"
|
||||
echo $"Copying ISOs to dir. It will take some time..."
|
||||
isos_to_dir
|
||||
shift
|
||||
;;
|
||||
-e|--test)
|
||||
echo "$(gettext "Running supported test...")"
|
||||
echo $"Running supported test..."
|
||||
renew_supported_test
|
||||
shift
|
||||
;;
|
||||
-l|--language)
|
||||
localization
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
printf "$(gettext "Invalid option: $1\n\n")"
|
||||
printf $"Invalid option: $1\n\n"
|
||||
show_help
|
||||
exit 1
|
||||
;;
|
||||
|
|
Loading…
Reference in a new issue