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