mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	| @@ -17,17 +17,45 @@ | |||||||
| # | # | ||||||
| # -------------------------------------------------------------------------------------------------- | # -------------------------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|  | number_of_keys() { | ||||||
|  | 	[ -f "$1" ] && jq 'path(..) | select(length == 2) | .[1]' "$1" | wc -l || echo "0" | ||||||
|  | } | ||||||
|  |  | ||||||
| stats() { | stats() { | ||||||
| 	# Print the number of existing strings on the JSON files for each locale | 	# Print the number of existing strings on the JSON files for each locale | ||||||
| 	s=$(jq 'path(..) | select(length == 2) | .[1]' "${paths[0]}/en/server.json" | wc -l) | 	s=$(number_of_keys "${paths[0]}/en/server.json") | ||||||
| 	c=$(jq 'path(..) | select(length == 2) | .[1]' "${paths[1]}/en/translation.json" | wc -l) | 	c=$(number_of_keys "${paths[1]}/en/translation.json") | ||||||
| 	echo "|locale |server strings |client strings |" | 	echo "| locale |server strings |client strings |" | ||||||
| 	echo "|-------|---------------|---------------|" | 	echo "|--------|---------------|---------------|" | ||||||
| 	echo "|   en   |      ${s}      |     ${c}      |" | 	echo "|   en   |      ${s}      |     ${c}      |" | ||||||
| 	for locale in "${locales[@]}"; do | 	for locale in "${locales[@]}"; do | ||||||
| 		s=$(jq 'path(..) | select(length == 2) | .[1]' "${paths[0]}/${locale}/server.json" | wc -l) | 		s=$(number_of_keys "${paths[0]}/${locale}/server.json") | ||||||
| 		c=$(jq 'path(..) | select(length == 2) | .[1]' "${paths[1]}/${locale}/translation.json" | wc -l) | 		c=$(number_of_keys "${paths[1]}/${locale}/translation.json") | ||||||
| 		echo "|  ${locale}   |      ${s}      |     ${c}      |" | 		n1=$(((8 - ${#locale}) / 2)) | ||||||
|  | 		n2=$((n1 == 1 ? n1 + 1 : n1)) | ||||||
|  | 		echo "|$(printf "%${n1}s")${locale}$(printf "%${n2}s")|      ${s}      |     ${c}      |" | ||||||
|  | 	done | ||||||
|  | } | ||||||
|  |  | ||||||
|  | update_1() { | ||||||
|  | 	# Update PO files from English and localized JSON files as source | ||||||
|  | 	# NOTE: if you want a new language you need to first create the JSON files | ||||||
|  | 	# on their corresponding place with `{}` as content to avoid error on `json2po` | ||||||
|  | 	local locales=("$@") | ||||||
|  | 	for path in "${paths[@]}"; do | ||||||
|  | 		for locale in "${locales[@]}"; do | ||||||
|  | 			json2po -t "${path}/en" "${path}/${locale}" "${path}/po-${locale}" | ||||||
|  | 		done | ||||||
|  | 	done | ||||||
|  | } | ||||||
|  |  | ||||||
|  | update_2() { | ||||||
|  | 	# Recover translation from PO files to localized JSON files | ||||||
|  | 	local locales=("$@") | ||||||
|  | 	for path in "${paths[@]}"; do | ||||||
|  | 		for locale in "${locales[@]}"; do | ||||||
|  | 			po2json -t "${path}/en" "${path}/po-${locale}" "${path}/${locale}" | ||||||
|  | 		done | ||||||
| 	done | 	done | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -35,11 +63,11 @@ help() { | |||||||
| 	echo -e "\nDescription:" | 	echo -e "\nDescription:" | ||||||
| 	echo -e "\tCreate PO files to make easier the labor of translation" | 	echo -e "\tCreate PO files to make easier the labor of translation" | ||||||
| 	echo -e "\nUsage:" | 	echo -e "\nUsage:" | ||||||
| 	echo -e "\t./translation.sh [--stats] [--update <OPT_LOCALE>] [--update2 <OPT_LOCALE>]" | 	echo -e "\t./translation.sh [--stats] [--update1 <OPT_LOCALE>] [--update2 <OPT_LOCALE>]" | ||||||
| 	echo -e "\nFlags:" | 	echo -e "\nFlags:" | ||||||
| 	echo -e "  --clear\n\tClear all po-* directories" | 	echo -e "  --clear\n\tClear all po-* directories" | ||||||
| 	echo -e "  --stats\n\tPrint the number of existing strings on the JSON files for each locale" | 	echo -e "  --stats\n\tPrint the number of existing strings on the JSON files for each locale" | ||||||
| 	echo -e "  --update <LOCALE>\n\tUpdate PO files from English and localized JSON files as source" | 	echo -e "  --update1 <LOCALE>\n\tUpdate PO files from English and localized JSON files as source" | ||||||
| 	echo -e "  --update2 <LOCALE>\n\tRecover translation from PO files to localized JSON files" | 	echo -e "  --update2 <LOCALE>\n\tRecover translation from PO files to localized JSON files" | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -51,7 +79,7 @@ file_path="$( | |||||||
| 	pwd -P | 	pwd -P | ||||||
| )" | )" | ||||||
| paths=("${file_path}/../translations/" "${file_path}/../src/public/translations/") | paths=("${file_path}/../translations/" "${file_path}/../src/public/translations/") | ||||||
| locales=(cn es fr ro) | locales=(cn de es fr pt_br ro tw) | ||||||
|  |  | ||||||
| if [ $# -eq 1 ]; then | if [ $# -eq 1 ]; then | ||||||
| 	if [ "$1" == "--clear" ]; then | 	if [ "$1" == "--clear" ]; then | ||||||
| @@ -62,34 +90,18 @@ if [ $# -eq 1 ]; then | |||||||
| 		done | 		done | ||||||
| 	elif [ "$1" == "--stats" ]; then | 	elif [ "$1" == "--stats" ]; then | ||||||
| 		stats | 		stats | ||||||
| 	elif [ "$1" == "--update" ]; then | 	elif [ "$1" == "--update1" ]; then | ||||||
| 		# Update PO files from English and localized JSON files as source | 		update_1 "${locales[@]}" | ||||||
| 		for path in "${paths[@]}"; do |  | ||||||
| 			for locale in "${locales[@]}"; do |  | ||||||
| 				json2po -t "${path}/en" "${path}/${locale}" "${path}/po-${locale}" |  | ||||||
| 			done |  | ||||||
| 		done |  | ||||||
| 	elif [ "$1" == "--update2" ]; then | 	elif [ "$1" == "--update2" ]; then | ||||||
| 		# Recover translation from PO files to localized JSON files | 		update_2 "${locales[@]}" | ||||||
| 		for path in "${paths[@]}"; do |  | ||||||
| 			for locale in "${locales[@]}"; do |  | ||||||
| 				po2json -t "${path}/en" "${path}/po-${locale}" "${path}/${locale}" |  | ||||||
| 			done |  | ||||||
| 		done |  | ||||||
| 	else | 	else | ||||||
| 		help | 		help | ||||||
| 	fi | 	fi | ||||||
| elif [ $# -eq 2 ]; then | elif [ $# -eq 2 ]; then | ||||||
| 	if [ "$1" == "--update" ]; then | 	if [ "$1" == "--update1" ]; then | ||||||
| 		locale="$2" | 		update_1 "$2" | ||||||
| 		for path in "${paths[@]}"; do |  | ||||||
| 			json2po -t "${path}/en" "${path}/${locale}" "${path}/po-${locale}" |  | ||||||
| 		done |  | ||||||
| 	elif [ "$1" == "--update2" ]; then | 	elif [ "$1" == "--update2" ]; then | ||||||
| 		locale="$2" | 		update_2 "$2" | ||||||
| 		for path in "${paths[@]}"; do |  | ||||||
| 			po2json -t "${path}/en" "${path}/po-${locale}" "${path}/${locale}" |  | ||||||
| 		done |  | ||||||
| 	else | 	else | ||||||
| 		help | 		help | ||||||
| 	fi | 	fi | ||||||
|   | |||||||
| @@ -51,7 +51,11 @@ | |||||||
|     "chosen_actions": "Acciones elegidas", |     "chosen_actions": "Acciones elegidas", | ||||||
|     "execute_bulk_actions": "Ejecutar acciones en bloque", |     "execute_bulk_actions": "Ejecutar acciones en bloque", | ||||||
|     "bulk_actions_executed": "Las acciones en bloque se han ejecutado con éxito.", |     "bulk_actions_executed": "Las acciones en bloque se han ejecutado con éxito.", | ||||||
|     "none_yet": "Ninguna todavía... agrega una acción haciendo clic en una de las disponibles arriba." |     "none_yet": "Ninguna todavía... agregue una acción haciendo clic en una de las disponibles arriba.", | ||||||
|  |     "labels": "Etiquetas", | ||||||
|  |     "relations": "Relaciones", | ||||||
|  |     "notes": "Notas", | ||||||
|  |     "other": "Otro" | ||||||
|   }, |   }, | ||||||
|   "clone_to": { |   "clone_to": { | ||||||
|     "clone_notes_to": "Clonar notas a...", |     "clone_notes_to": "Clonar notas a...", | ||||||
| @@ -1057,7 +1061,12 @@ | |||||||
|     "theme_label": "Tema", |     "theme_label": "Tema", | ||||||
|     "override_theme_fonts_label": "Sobreescribir fuentes de tema", |     "override_theme_fonts_label": "Sobreescribir fuentes de tema", | ||||||
|     "light_theme": "Claro", |     "light_theme": "Claro", | ||||||
|     "dark_theme": "Oscuro" |     "dark_theme": "Oscuro", | ||||||
|  |     "layout": "Disposición", | ||||||
|  |     "layout-vertical-title": "Vertical", | ||||||
|  |     "layout-horizontal-title": "Horizontal", | ||||||
|  |     "layout-vertical-description": "la barra del lanzador está en la izquierda (por defecto)", | ||||||
|  |     "layout-horizontal-description": "la barra de lanzamiento está debajo de la barra de pestañas, la barra de pestañas ahora tiene ancho completo." | ||||||
|   }, |   }, | ||||||
|   "zoom_factor": { |   "zoom_factor": { | ||||||
|     "title": "Factor de zoom (solo versión de escritorio)", |     "title": "Factor de zoom (solo versión de escritorio)", | ||||||
| @@ -1183,6 +1192,8 @@ | |||||||
|     "backup_now": "Realizar copia de seguridad ahora", |     "backup_now": "Realizar copia de seguridad ahora", | ||||||
|     "backup_database_now": "Realizar copia de seguridad de la base de datos ahora", |     "backup_database_now": "Realizar copia de seguridad de la base de datos ahora", | ||||||
|     "existing_backups": "Copias de seguridad existentes", |     "existing_backups": "Copias de seguridad existentes", | ||||||
|  |     "date-and-time": "Fecha y hora", | ||||||
|  |     "path": "Ruta", | ||||||
|     "database_backed_up_to": "Se ha realizado una copia de seguridad de la base de datos en", |     "database_backed_up_to": "Se ha realizado una copia de seguridad de la base de datos en", | ||||||
|     "no_backup_yet": "no hay copia de seguridad todavía" |     "no_backup_yet": "no hay copia de seguridad todavía" | ||||||
|   }, |   }, | ||||||
| @@ -1439,7 +1450,9 @@ | |||||||
|     "close_other_tabs": "Cerrar otras pestañas", |     "close_other_tabs": "Cerrar otras pestañas", | ||||||
|     "close_right_tabs": "Cerrar pestañas a la derecha", |     "close_right_tabs": "Cerrar pestañas a la derecha", | ||||||
|     "close_all_tabs": "Cerras todas las pestañas", |     "close_all_tabs": "Cerras todas las pestañas", | ||||||
|  |     "reopen_last_tab": "Reabrir última pestaña cerrada", | ||||||
|     "move_tab_to_new_window": "Mover esta pestaña a una nueva ventana", |     "move_tab_to_new_window": "Mover esta pestaña a una nueva ventana", | ||||||
|  |     "copy_tab_to_new_window": "Copiar esta pestaña a una ventana nueva", | ||||||
|     "new_tab": "Nueva pestaña" |     "new_tab": "Nueva pestaña" | ||||||
|   }, |   }, | ||||||
|   "toc": { |   "toc": { | ||||||
| @@ -1531,5 +1544,14 @@ | |||||||
|         "description": "las herramientas de edición aparecen en la pestaña de la cinta \"Formato\")." |         "description": "las herramientas de edición aparecen en la pestaña de la cinta \"Formato\")." | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  |   }, | ||||||
|  |   "electron_context_menu": { | ||||||
|  |     "add-term-to-dictionary": "Agregar \"{{term}}\" al diccionario.", | ||||||
|  |     "cut": "Cortar", | ||||||
|  |     "copy": "Copiar", | ||||||
|  |     "copy-link": "Copiar enlace", | ||||||
|  |     "paste": "Pegar", | ||||||
|  |     "paste-as-plain-text": "Pegar como texto plano", | ||||||
|  |     "search_online": "Buscar \"{{term}}\" con {{searchEngine}}" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								src/public/translations/pt_br/translation.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/public/translations/pt_br/translation.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | {} | ||||||
							
								
								
									
										1
									
								
								src/public/translations/tw/translation.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src/public/translations/tw/translation.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | {} | ||||||
		Reference in New Issue
	
	Block a user