@@ -204,10 +204,20 @@ static void
204
204
progress_report (int tablespacenum , const char * filename )
205
205
{
206
206
int percent = (int ) ((totaldone / 1024 ) * 100 / totalsize );
207
+ char totaldone_str [32 ];
208
+ char totalsize_str [32 ];
207
209
208
210
if (percent > 100 )
209
211
percent = 100 ;
210
212
213
+ /*
214
+ * Separate step to keep platform-dependent format code out of translatable
215
+ * strings. And we only test for INT64_FORMAT availability in snprintf,
216
+ * not fprintf.
217
+ */
218
+ snprintf (totaldone_str , sizeof (totaldone_str ), INT64_FORMAT , totaldone / 1024 );
219
+ snprintf (totalsize_str , sizeof (totalsize_str ), INT64_FORMAT , totalsize );
220
+
211
221
if (verbose )
212
222
{
213
223
if (!filename )
@@ -217,21 +227,23 @@ progress_report(int tablespacenum, const char *filename)
217
227
* call)
218
228
*/
219
229
fprintf (stderr ,
220
- INT64_FORMAT "/" INT64_FORMAT " kB (100%%) %d/%d tablespaces %35s\r" ,
221
- totaldone / 1024 , totalsize ,
222
- tablespacenum , tablespacecount , "" );
230
+ ngettext ("%s/%s kB (100%%), %d/%d tablespace %35s\r" ,
231
+ "%s/%s kB (100%%), %d/%d tablespaces %35s\r" ,
232
+ tablespacecount ),
233
+ totaldone_str , totalsize_str , tablespacenum , tablespacecount , "" );
223
234
else
224
235
fprintf (stderr ,
225
- INT64_FORMAT "/" INT64_FORMAT " kB (%d%%) %d/%d tablespaces (%-30.30s)\r" ,
226
- totaldone / 1024 , totalsize ,
227
- percent ,
228
- tablespacenum , tablespacecount , filename );
236
+ ngettext ( "%s/%s kB (%d%%), %d/%d tablespace (%-30.30s)\r" ,
237
+ "%s/%s kB (%d%%), %d/%d tablespaces (%-30.30s)\r" ,
238
+ tablespacecount ) ,
239
+ totaldone_str , totalsize_str , percent , tablespacenum , tablespacecount , filename );
229
240
}
230
241
else
231
- fprintf (stderr , INT64_FORMAT "/" INT64_FORMAT " kB (%d%%) %d/%d tablespaces\r" ,
232
- totaldone / 1024 , totalsize ,
233
- percent ,
234
- tablespacenum , tablespacecount );
242
+ fprintf (stderr ,
243
+ ngettext ("%s/%s kB (%d%%), %d/%d tablespace\r" ,
244
+ "%s/%s kB (%d%%), %d/%d tablespaces\r" ,
245
+ tablespacecount ),
246
+ totaldone_str , totalsize_str , percent , tablespacenum , tablespacecount );
235
247
}
236
248
237
249
0 commit comments