@@ -70,7 +70,7 @@ Initialize(void)
70
70
if (stat (archiveLocation , & stat_buf ) != 0 ||
71
71
!S_ISDIR (stat_buf .st_mode ))
72
72
{
73
- fprintf (stderr , "%s: archive location \"%s\" does not exist\n" ,
73
+ fprintf (stderr , _ ( "%s: archive location \"%s\" does not exist\n" ) ,
74
74
progname , archiveLocation );
75
75
exit (2 );
76
76
}
@@ -146,34 +146,34 @@ CleanupPriorWALFiles(void)
146
146
printf ("%s\n" , WALFilePath );
147
147
if (debug )
148
148
fprintf (stderr ,
149
- "%s: file \"%s\" would be removed\n" ,
149
+ _ ( "%s: file \"%s\" would be removed\n" ) ,
150
150
progname , WALFilePath );
151
151
continue ;
152
152
}
153
153
154
154
if (debug )
155
- fprintf (stderr , "%s: removing file \"%s\"\n" ,
155
+ fprintf (stderr , _ ( "%s: removing file \"%s\"\n" ) ,
156
156
progname , WALFilePath );
157
157
158
158
rc = unlink (WALFilePath );
159
159
if (rc != 0 )
160
160
{
161
- fprintf (stderr , "%s: ERROR: could not remove file \"%s\": %s\n" ,
161
+ fprintf (stderr , _ ( "%s: ERROR: could not remove file \"%s\": %s\n" ) ,
162
162
progname , WALFilePath , strerror (errno ));
163
163
break ;
164
164
}
165
165
}
166
166
}
167
167
168
168
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" ) ,
170
170
progname , archiveLocation , strerror (errno ));
171
171
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" ) ,
173
173
progname , archiveLocation , strerror (errno ));
174
174
}
175
175
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" ) ,
177
177
progname , archiveLocation , strerror (errno ));
178
178
}
179
179
@@ -246,8 +246,8 @@ SetWALFileNameForCleanup(void)
246
246
247
247
if (!fnameOK )
248
248
{
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 );
251
251
exit (2 );
252
252
}
253
253
}
@@ -260,25 +260,25 @@ SetWALFileNameForCleanup(void)
260
260
static void
261
261
usage (void )
262
262
{
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" ) );
282
282
}
283
283
284
284
/*------------ MAIN ----------------------------------------*/
@@ -287,6 +287,7 @@ main(int argc, char **argv)
287
287
{
288
288
int c ;
289
289
290
+ set_pglocale_pgservice (argv [0 ], PG_TEXTDOMAIN ("pg_archivecleanup" ));
290
291
progname = get_progname (argv [0 ]);
291
292
292
293
if (argc > 1 )
@@ -318,7 +319,7 @@ main(int argc, char **argv)
318
319
* from xlogfile names */
319
320
break ;
320
321
default :
321
- fprintf (stderr , "Try \"%s --help\" for more information.\n" , progname );
322
+ fprintf (stderr , _ ( "Try \"%s --help\" for more information.\n" ) , progname );
322
323
exit (2 );
323
324
break ;
324
325
}
@@ -338,8 +339,8 @@ main(int argc, char **argv)
338
339
}
339
340
else
340
341
{
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 );
343
344
exit (2 );
344
345
}
345
346
@@ -350,15 +351,15 @@ main(int argc, char **argv)
350
351
}
351
352
else
352
353
{
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 );
355
356
exit (2 );
356
357
}
357
358
358
359
if (optind < argc )
359
360
{
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 );
362
363
exit (2 );
363
364
}
364
365
@@ -376,7 +377,7 @@ main(int argc, char **argv)
376
377
{
377
378
snprintf (WALFilePath , MAXPGPATH , "%s/%s" ,
378
379
archiveLocation , exclusiveCleanupFileName );
379
- fprintf (stderr , "%s: keep WAL file \"%s\" and later\n" ,
380
+ fprintf (stderr , _ ( "%s: keep WAL file \"%s\" and later\n" ) ,
380
381
progname , WALFilePath );
381
382
}
382
383
0 commit comments