You've already forked pg_probackup
							
							
				mirror of
				https://github.com/postgrespro/pg_probackup.git
				synced 2025-10-31 00:17:52 +02:00 
			
		
		
		
	PBCKP-97: added localization of messages
* PBCKP-97: Adding localization files Added localization of messages. Fixed some bugs. Added the --enable-nls tag for tests. Added a test to check the localization of messages. Co-authored-by: Vyacheslav Makarov <v.makarov@postgrespro.ru>
This commit is contained in:
		
				
					committed by
					
						 GitHub
						GitHub
					
				
			
			
				
	
			
			
			
						parent
						
							141e96a0e6
						
					
				
				
					commit
					4b2df86d69
				
			| @@ -41,6 +41,7 @@ env: | ||||
| #    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=delta | ||||
| #    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=locking | ||||
| #    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=merge | ||||
| #    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=option | ||||
| #    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=OFF MODE=page | ||||
| #    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=ptrack | ||||
| #    - PG_VERSION=13 PG_BRANCH=REL_13_STABLE PTRACK_PATCH_PG_BRANCH=REL_13_STABLE MODE=replica | ||||
|   | ||||
							
								
								
									
										14
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								README.md
									
									
									
									
									
								
							| @@ -224,3 +224,17 @@ Postgres Professional, Moscow, Russia. | ||||
| ## Credits | ||||
|  | ||||
| `pg_probackup` utility is based on `pg_arman`, that was originally written by NTT and then developed and maintained by Michael Paquier. | ||||
|  | ||||
|  | ||||
| ### Localization files (*.po) | ||||
|  | ||||
| Description of how to add new translation languages. | ||||
| 1. Add a flag --enable-nls in configure. | ||||
| 2. Build postgres. | ||||
| 3. Adding to nls.mk in folder pg_probackup required files in GETTEXT_FILES. | ||||
| 4. In folder pg_probackup do 'make update-po'. | ||||
| 5. As a result, the progname.pot file will be created. Copy the content and add it to the file with the desired language. | ||||
| 6. Adding to nls.mk in folder pg_probackup required language in AVAIL_LANGUAGES. | ||||
|  | ||||
| For more information, follow the link below: | ||||
| https://postgrespro.ru/docs/postgresql/12/nls-translator | ||||
|   | ||||
							
								
								
									
										6
									
								
								nls.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								nls.mk
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| # contrib/pg_probackup/nls.mk | ||||
| CATALOG_NAME     = pg_probackup | ||||
| AVAIL_LANGUAGES  = ru | ||||
| GETTEXT_FILES    = src/help.c | ||||
| GETTEXT_TRIGGERS = $(FRONTEND_COMMON_GETTEXT_TRIGGERS) | ||||
| GETTEXT_FLAGS    = $(FRONTEND_COMMON_GETTEXT_FLAGS) | ||||
| @@ -267,9 +267,9 @@ help_pg_probackup(void) | ||||
| 	{ | ||||
| 		printf("\n"); | ||||
| 		if (PROGRAM_URL) | ||||
| 			printf("Read the website for details. <%s>\n", PROGRAM_URL); | ||||
| 			printf(_("Read the website for details <%s>.\n"), PROGRAM_URL); | ||||
| 		if (PROGRAM_EMAIL) | ||||
| 			printf("Report bugs to <%s>.\n", PROGRAM_EMAIL); | ||||
| 			printf(_("Report bugs to <%s>.\n"), PROGRAM_EMAIL); | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -308,6 +308,7 @@ main(int argc, char *argv[]) | ||||
| 	init_config(&instance_config, instance_name); | ||||
|  | ||||
| 	PROGRAM_NAME = get_progname(argv[0]); | ||||
| 	set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_probackup")); | ||||
| 	PROGRAM_FULL_PATH = palloc0(MAXPGPATH); | ||||
|  | ||||
| 	/* Get current time */ | ||||
|   | ||||
| @@ -31,7 +31,7 @@ Remote backup depends on key authentication to local machine via ssh as current | ||||
|  export PGPROBACKUP_SSH_REMOTE=ON | ||||
|  | ||||
| Run tests that are relied on advanced debugging features. For this mode, pg_probackup should be compiled without optimizations. For example: | ||||
| CFLAGS="-O0" ./configure --prefix=/path/to/prefix --enable-debug --enable-cassert --enable-depend --enable-tap-tests | ||||
| CFLAGS="-O0" ./configure --prefix=/path/to/prefix --enable-debug --enable-cassert --enable-depend --enable-tap-tests --enable-nls | ||||
|  | ||||
|  export PGPROBACKUP_GDB=ON | ||||
|  | ||||
|   | ||||
| @@ -180,5 +180,5 @@ pg_probackup - utility to manage backup/recovery of PostgreSQL database. | ||||
|                  [--ssh-options] | ||||
|                  [--help] | ||||
|  | ||||
| Read the website for details. <https://github.com/postgrespro/pg_probackup> | ||||
| Read the website for details <https://github.com/postgrespro/pg_probackup>. | ||||
| Report bugs to <https://github.com/postgrespro/pg_probackup/issues>. | ||||
|   | ||||
							
								
								
									
										184
									
								
								tests/expected/option_help_ru.out
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										184
									
								
								tests/expected/option_help_ru.out
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,184 @@ | ||||
|  | ||||
| pg_probackup - утилита для управления резервным копированием/восстановлением базы данных PostgreSQL. | ||||
|  | ||||
|   pg_probackup help [COMMAND] | ||||
|  | ||||
|   pg_probackup version | ||||
|  | ||||
|   pg_probackup init -B backup-path | ||||
|  | ||||
|   pg_probackup set-config -B backup-path --instance=instance_name | ||||
|                  [-D pgdata-path] | ||||
|                  [--external-dirs=external-directories-paths] | ||||
|                  [--log-level-console=log-level-console] | ||||
|                  [--log-level-file=log-level-file] | ||||
|                  [--log-filename=log-filename] | ||||
|                  [--error-log-filename=error-log-filename] | ||||
|                  [--log-directory=log-directory] | ||||
|                  [--log-rotation-size=log-rotation-size] | ||||
|                  [--log-rotation-age=log-rotation-age] | ||||
|                  [--retention-redundancy=retention-redundancy] | ||||
|                  [--retention-window=retention-window] | ||||
|                  [--wal-depth=wal-depth] | ||||
|                  [--compress-algorithm=compress-algorithm] | ||||
|                  [--compress-level=compress-level] | ||||
|                  [--archive-timeout=timeout] | ||||
|                  [-d dbname] [-h host] [-p port] [-U username] | ||||
|                  [--remote-proto] [--remote-host] | ||||
|                  [--remote-port] [--remote-path] [--remote-user] | ||||
|                  [--ssh-options] | ||||
|                  [--restore-command=cmdline] [--archive-host=destination] | ||||
|                  [--archive-port=port] [--archive-user=username] | ||||
|                  [--help] | ||||
|  | ||||
|   pg_probackup set-backup -B backup-path --instance=instance_name | ||||
|                  -i backup-id [--ttl=interval] [--expire-time=timestamp] | ||||
|                  [--note=text] | ||||
|                  [--help] | ||||
|  | ||||
|   pg_probackup show-config -B backup-path --instance=instance_name | ||||
|                  [--format=format] | ||||
|                  [--help] | ||||
|  | ||||
|   pg_probackup backup -B backup-path -b backup-mode --instance=instance_name | ||||
|                  [-D pgdata-path] [-C] | ||||
|                  [--stream [-S slot-name] [--temp-slot]] | ||||
|                  [--backup-pg-log] [-j num-threads] [--progress] | ||||
|                  [--no-validate] [--skip-block-validation] | ||||
|                  [--external-dirs=external-directories-paths] | ||||
|                  [--no-sync] | ||||
|                  [--log-level-console=log-level-console] | ||||
|                  [--log-level-file=log-level-file] | ||||
|                  [--log-filename=log-filename] | ||||
|                  [--error-log-filename=error-log-filename] | ||||
|                  [--log-directory=log-directory] | ||||
|                  [--log-rotation-size=log-rotation-size] | ||||
|                  [--log-rotation-age=log-rotation-age] [--no-color] | ||||
|                  [--delete-expired] [--delete-wal] [--merge-expired] | ||||
|                  [--retention-redundancy=retention-redundancy] | ||||
|                  [--retention-window=retention-window] | ||||
|                  [--wal-depth=wal-depth] | ||||
|                  [--compress] | ||||
|                  [--compress-algorithm=compress-algorithm] | ||||
|                  [--compress-level=compress-level] | ||||
|                  [--archive-timeout=archive-timeout] | ||||
|                  [-d dbname] [-h host] [-p port] [-U username] | ||||
|                  [-w --no-password] [-W --password] | ||||
|                  [--remote-proto] [--remote-host] | ||||
|                  [--remote-port] [--remote-path] [--remote-user] | ||||
|                  [--ssh-options] | ||||
|                  [--ttl=interval] [--expire-time=timestamp] [--note=text] | ||||
|                  [--help] | ||||
|  | ||||
|   pg_probackup restore -B backup-path --instance=instance_name | ||||
|                  [-D pgdata-path] [-i backup-id] [-j num-threads] | ||||
|                  [--recovery-target-time=time|--recovery-target-xid=xid | ||||
|                   |--recovery-target-lsn=lsn [--recovery-target-inclusive=boolean]] | ||||
|                  [--recovery-target-timeline=timeline] | ||||
|                  [--recovery-target=immediate|latest] | ||||
|                  [--recovery-target-name=target-name] | ||||
|                  [--recovery-target-action=pause|promote|shutdown] | ||||
|                  [--restore-command=cmdline] | ||||
|                  [-R | --restore-as-replica] [--force] | ||||
|                  [--primary-conninfo=primary_conninfo] | ||||
|                  [-S | --primary-slot-name=slotname] | ||||
|                  [--no-validate] [--skip-block-validation] | ||||
|                  [-T OLDDIR=NEWDIR] [--progress] | ||||
|                  [--external-mapping=OLDDIR=NEWDIR] | ||||
|                  [--skip-external-dirs] [--no-sync] | ||||
|                  [-I | --incremental-mode=none|checksum|lsn] | ||||
|                  [--db-include | --db-exclude] | ||||
|                  [--remote-proto] [--remote-host] | ||||
|                  [--remote-port] [--remote-path] [--remote-user] | ||||
|                  [--ssh-options] | ||||
|                  [--archive-host=hostname] | ||||
|                  [--archive-port=port] [--archive-user=username] | ||||
|                  [--help] | ||||
|  | ||||
|   pg_probackup validate -B backup-path [--instance=instance_name] | ||||
|                  [-i backup-id] [--progress] [-j num-threads] | ||||
|                  [--recovery-target-time=time|--recovery-target-xid=xid | ||||
|                   |--recovery-target-lsn=lsn [--recovery-target-inclusive=boolean]] | ||||
|                  [--recovery-target-timeline=timeline] | ||||
|                  [--recovery-target-name=target-name] | ||||
|                  [--skip-block-validation] | ||||
|                  [--help] | ||||
|  | ||||
|   pg_probackup checkdb [-B backup-path] [--instance=instance_name] | ||||
|                  [-D pgdata-path] [--progress] [-j num-threads] | ||||
|                  [--amcheck] [--skip-block-validation] | ||||
|                  [--heapallindexed] [--checkunique] | ||||
|                  [--help] | ||||
|  | ||||
|   pg_probackup show -B backup-path | ||||
|                  [--instance=instance_name [-i backup-id]] | ||||
|                  [--format=format] [--archive] | ||||
|                  [--no-color] [--help] | ||||
|  | ||||
|   pg_probackup delete -B backup-path --instance=instance_name | ||||
|                  [-j num-threads] [--progress] | ||||
|                  [--retention-redundancy=retention-redundancy] | ||||
|                  [--retention-window=retention-window] | ||||
|                  [--wal-depth=wal-depth] | ||||
|                  [-i backup-id | --delete-expired | --merge-expired | --status=backup_status] | ||||
|                  [--delete-wal] | ||||
|                  [--dry-run] [--no-validate] [--no-sync] | ||||
|                  [--help] | ||||
|  | ||||
|   pg_probackup merge -B backup-path --instance=instance_name | ||||
|                  -i backup-id [--progress] [-j num-threads] | ||||
|                  [--no-validate] [--no-sync] | ||||
|                  [--help] | ||||
|  | ||||
|   pg_probackup add-instance -B backup-path -D pgdata-path | ||||
|                  --instance=instance_name | ||||
|                  [--external-dirs=external-directories-paths] | ||||
|                  [--remote-proto] [--remote-host] | ||||
|                  [--remote-port] [--remote-path] [--remote-user] | ||||
|                  [--ssh-options] | ||||
|                  [--help] | ||||
|  | ||||
|   pg_probackup del-instance -B backup-path | ||||
|                  --instance=instance_name | ||||
|                  [--help] | ||||
|  | ||||
|   pg_probackup archive-push -B backup-path --instance=instance_name | ||||
|                  --wal-file-name=wal-file-name | ||||
|                  [--wal-file-path=wal-file-path] | ||||
|                  [-j num-threads] [--batch-size=batch_size] | ||||
|                  [--archive-timeout=timeout] | ||||
|                  [--no-ready-rename] [--no-sync] | ||||
|                  [--overwrite] [--compress] | ||||
|                  [--compress-algorithm=compress-algorithm] | ||||
|                  [--compress-level=compress-level] | ||||
|                  [--remote-proto] [--remote-host] | ||||
|                  [--remote-port] [--remote-path] [--remote-user] | ||||
|                  [--ssh-options] | ||||
|                  [--help] | ||||
|  | ||||
|   pg_probackup archive-get -B backup-path --instance=instance_name | ||||
|                  --wal-file-path=wal-file-path | ||||
|                  --wal-file-name=wal-file-name | ||||
|                  [-j num-threads] [--batch-size=batch_size] | ||||
|                  [--no-validate-wal] | ||||
|                  [--remote-proto] [--remote-host] | ||||
|                  [--remote-port] [--remote-path] [--remote-user] | ||||
|                  [--ssh-options] | ||||
|                  [--help] | ||||
|  | ||||
|   pg_probackup catchup  -b catchup-mode | ||||
|                  --source-pgdata=path_to_pgdata_on_remote_server | ||||
|                  --destination-pgdata=path_to_local_dir | ||||
|                  [--stream [-S slot-name] [--temp-slot | --perm-slot]] | ||||
|                  [-j num-threads] | ||||
|                  [-T OLDDIR=NEWDIR] | ||||
|                  [--exclude-path=path_prefix] | ||||
|                  [-d dbname] [-h host] [-p port] [-U username] | ||||
|                  [-w --no-password] [-W --password] | ||||
|                  [--remote-proto] [--remote-host] | ||||
|                  [--remote-port] [--remote-path] [--remote-user] | ||||
|                  [--ssh-options] | ||||
|                  [--help] | ||||
|  | ||||
| Подробнее читайте на сайте <https://github.com/postgrespro/pg_probackup>. | ||||
| Сообщайте об ошибках в <https://github.com/postgrespro/pg_probackup/issues>. | ||||
| @@ -1,6 +1,7 @@ | ||||
| import unittest | ||||
| import os | ||||
| from .helpers.ptrack_helpers import ProbackupTest, ProbackupException | ||||
| import locale | ||||
|  | ||||
|  | ||||
| module_name = 'option' | ||||
| @@ -226,3 +227,13 @@ class OptionTest(ProbackupTest, unittest.TestCase): | ||||
|  | ||||
|         # Clean after yourself | ||||
|         self.del_test_dir(module_name, fname) | ||||
|  | ||||
|     # @unittest.skip("skip") | ||||
|     def test_help_6(self): | ||||
|         """help options""" | ||||
|         self.test_env['LC_ALL'] = 'ru_RU.utf-8' | ||||
|         with open(os.path.join(self.dir_path, "expected/option_help_ru.out"), "rb") as help_out: | ||||
|             self.assertEqual( | ||||
|                 self.run_pb(["--help"]), | ||||
|                 help_out.read().decode("utf-8") | ||||
|             ) | ||||
|   | ||||
| @@ -47,7 +47,7 @@ cd postgres # Go to postgres dir | ||||
| if [ "$PG_PROBACKUP_PTRACK" = "ON" ]; then | ||||
|     git apply -3 ../ptrack/patches/${PTRACK_PATCH_PG_BRANCH}-ptrack-core.diff | ||||
| fi | ||||
| CFLAGS="-O0" ./configure --prefix=$PGHOME --enable-debug --enable-cassert --enable-depend --enable-tap-tests | ||||
| CFLAGS="-O0" ./configure --prefix=$PGHOME --enable-debug --enable-cassert --enable-depend --enable-tap-tests --enable-nls | ||||
| make -s -j$(nproc) install | ||||
| #make -s -j$(nproc) -C 'src/common' install | ||||
| #make -s -j$(nproc) -C 'src/port' install | ||||
|   | ||||
		Reference in New Issue
	
	Block a user