Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit632fbe7

Browse files
committed
pg_archivecleanup: Add NLS
Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
1 parent84ad68d commit632fbe7

File tree

2 files changed

+41
-36
lines changed

2 files changed

+41
-36
lines changed

‎src/bin/pg_archivecleanup/nls.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# src/bin/pg_archivecleanup/nls.mk
2+
CATALOG_NAME = pg_archivecleanup
3+
AVAIL_LANGUAGES =
4+
GETTEXT_FILES = pg_archivecleanup.c

‎src/bin/pg_archivecleanup/pg_archivecleanup.c

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Initialize(void)
7070
if (stat(archiveLocation,&stat_buf)!=0||
7171
!S_ISDIR(stat_buf.st_mode))
7272
{
73-
fprintf(stderr,"%s: archive location \"%s\" does not exist\n",
73+
fprintf(stderr,_("%s: archive location \"%s\" does not exist\n"),
7474
progname,archiveLocation);
7575
exit(2);
7676
}
@@ -146,34 +146,34 @@ CleanupPriorWALFiles(void)
146146
printf("%s\n",WALFilePath);
147147
if (debug)
148148
fprintf(stderr,
149-
"%s: file \"%s\" would be removed\n",
149+
_("%s: file \"%s\" would be removed\n"),
150150
progname,WALFilePath);
151151
continue;
152152
}
153153

154154
if (debug)
155-
fprintf(stderr,"%s: removing file \"%s\"\n",
155+
fprintf(stderr,_("%s: removing file \"%s\"\n"),
156156
progname,WALFilePath);
157157

158158
rc=unlink(WALFilePath);
159159
if (rc!=0)
160160
{
161-
fprintf(stderr,"%s: ERROR: could not remove file \"%s\": %s\n",
161+
fprintf(stderr,_("%s: ERROR: could not remove file \"%s\": %s\n"),
162162
progname,WALFilePath,strerror(errno));
163163
break;
164164
}
165165
}
166166
}
167167

168168
if (errno)
169-
fprintf(stderr,"%s: could not read archive location \"%s\": %s\n",
169+
fprintf(stderr,_("%s: could not read archive location \"%s\": %s\n"),
170170
progname,archiveLocation,strerror(errno));
171171
if (closedir(xldir))
172-
fprintf(stderr,"%s: could not close archive location \"%s\": %s\n",
172+
fprintf(stderr,_("%s: could not close archive location \"%s\": %s\n"),
173173
progname,archiveLocation,strerror(errno));
174174
}
175175
else
176-
fprintf(stderr,"%s: could not open archive location \"%s\": %s\n",
176+
fprintf(stderr,_("%s: could not open archive location \"%s\": %s\n"),
177177
progname,archiveLocation,strerror(errno));
178178
}
179179

@@ -246,8 +246,8 @@ SetWALFileNameForCleanup(void)
246246

247247
if (!fnameOK)
248248
{
249-
fprintf(stderr,"%s: invalid filename input\n",progname);
250-
fprintf(stderr,"Try \"%s --help\" for more information.\n",progname);
249+
fprintf(stderr,_("%s: invalid filename input\n"),progname);
250+
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),progname);
251251
exit(2);
252252
}
253253
}
@@ -260,25 +260,25 @@ SetWALFileNameForCleanup(void)
260260
staticvoid
261261
usage(void)
262262
{
263-
printf("%s removes older WAL files from PostgreSQL archives.\n\n",progname);
264-
printf("Usage:\n");
265-
printf(" %s [OPTION]... ARCHIVELOCATION OLDESTKEPTWALFILE\n",progname);
266-
printf("\nOptions:\n");
267-
printf(" -d generate debug output (verbose mode)\n");
268-
printf(" -n dry run, show the names of the files that would be removed\n");
269-
printf(" -V, --version output version information, then exit\n");
270-
printf(" -x EXT clean up files if they have this extension\n");
271-
printf(" -?, --help show this help, then exit\n");
272-
printf("\n"
273-
"For use as archive_cleanup_command in recovery.conf when standby_mode = on:\n"
274-
" archive_cleanup_command = 'pg_archivecleanup [OPTION]... ARCHIVELOCATION %%r'\n"
275-
"e.g.\n"
276-
" archive_cleanup_command = 'pg_archivecleanup /mnt/server/archiverdir %%r'\n");
277-
printf("\n"
278-
"Or for use as a standalone archive cleaner:\n"
279-
"e.g.\n"
280-
" pg_archivecleanup /mnt/server/archiverdir 000000010000000000000010.00000020.backup\n");
281-
printf("\nReport bugs to <pgsql-bugs@postgresql.org>.\n");
263+
printf(_("%s removes older WAL files from PostgreSQL archives.\n\n"),progname);
264+
printf(_("Usage:\n"));
265+
printf(_(" %s [OPTION]... ARCHIVELOCATION OLDESTKEPTWALFILE\n"),progname);
266+
printf(_("\nOptions:\n"));
267+
printf(_(" -d generate debug output (verbose mode)\n"));
268+
printf(_(" -n dry run, show the names of the files that would be removed\n"));
269+
printf(_(" -V, --version output version information, then exit\n"));
270+
printf(_(" -x EXT clean up files if they have this extension\n"));
271+
printf(_(" -?, --help show this help, then exit\n"));
272+
printf(_("\n"
273+
"For use as archive_cleanup_command in recovery.conf when standby_mode = on:\n"
274+
" archive_cleanup_command = 'pg_archivecleanup [OPTION]... ARCHIVELOCATION %%r'\n"
275+
"e.g.\n"
276+
" archive_cleanup_command = 'pg_archivecleanup /mnt/server/archiverdir %%r'\n"));
277+
printf(_("\n"
278+
"Or for use as a standalone archive cleaner:\n"
279+
"e.g.\n"
280+
" pg_archivecleanup /mnt/server/archiverdir 000000010000000000000010.00000020.backup\n"));
281+
printf(_("\nReport bugs to <pgsql-bugs@postgresql.org>.\n"));
282282
}
283283

284284
/*------------ MAIN ----------------------------------------*/
@@ -287,6 +287,7 @@ main(int argc, char **argv)
287287
{
288288
intc;
289289

290+
set_pglocale_pgservice(argv[0],PG_TEXTDOMAIN("pg_archivecleanup"));
290291
progname=get_progname(argv[0]);
291292

292293
if (argc>1)
@@ -318,7 +319,7 @@ main(int argc, char **argv)
318319
* from xlogfile names */
319320
break;
320321
default:
321-
fprintf(stderr,"Try \"%s --help\" for more information.\n",progname);
322+
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),progname);
322323
exit(2);
323324
break;
324325
}
@@ -338,8 +339,8 @@ main(int argc, char **argv)
338339
}
339340
else
340341
{
341-
fprintf(stderr,"%s: must specify archive location\n",progname);
342-
fprintf(stderr,"Try \"%s --help\" for more information.\n",progname);
342+
fprintf(stderr,_("%s: must specify archive location\n"),progname);
343+
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),progname);
343344
exit(2);
344345
}
345346

@@ -350,15 +351,15 @@ main(int argc, char **argv)
350351
}
351352
else
352353
{
353-
fprintf(stderr,"%s: must specify restartfilename\n",progname);
354-
fprintf(stderr,"Try \"%s --help\" for more information.\n",progname);
354+
fprintf(stderr,_("%s: must specify restartfilename\n"),progname);
355+
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),progname);
355356
exit(2);
356357
}
357358

358359
if (optind<argc)
359360
{
360-
fprintf(stderr,"%s: too many parameters\n",progname);
361-
fprintf(stderr,"Try \"%s --help\" for more information.\n",progname);
361+
fprintf(stderr,_("%s: too many parameters\n"),progname);
362+
fprintf(stderr,_("Try \"%s --help\" for more information.\n"),progname);
362363
exit(2);
363364
}
364365

@@ -376,7 +377,7 @@ main(int argc, char **argv)
376377
{
377378
snprintf(WALFilePath,MAXPGPATH,"%s/%s",
378379
archiveLocation,exclusiveCleanupFileName);
379-
fprintf(stderr,"%s: keep WAL file \"%s\" and later\n",
380+
fprintf(stderr,_("%s: keep WAL file \"%s\" and later\n"),
380381
progname,WALFilePath);
381382
}
382383

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp