1
1
/* Concatenates several translation catalogs.
2
Copyright (C) 2001-2007 Free Software Foundation, Inc.
2
Copyright (C) 2001-2007, 2009-2010 Free Software Foundation, Inc.
3
3
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
5
5
This program is free software: you can redistribute it and/or modify
69
70
{ "force-po", no_argument, &force_po, 1 },
70
71
{ "help", no_argument, NULL, 'h' },
71
72
{ "indent", no_argument, NULL, 'i' },
73
{ "lang", required_argument, NULL, CHAR_MAX + 7 },
72
74
{ "no-escape", no_argument, NULL, 'e' },
73
75
{ "no-location", no_argument, &line_comment, 0 },
74
76
{ "no-wrap", no_argument, NULL, CHAR_MAX + 2 },
115
117
catalog_output_format_ty output_syntax = &output_format_po;
116
118
bool sort_by_msgid = false;
117
119
bool sort_by_filepos = false;
120
/* Language (ISO-639 code) and optional territory (ISO-3166 code). */
121
const char *catalogname = NULL;
119
123
/* Set program name for messages. */
120
124
set_program_name (argv[0]);
143
147
use_first = false;
145
149
while ((optchar = getopt_long (argc, argv, "<:>:D:eEf:Fhino:pPst:uVw:",
146
long_options, NULL)) != EOF)
150
long_options, NULL)) != EOF)
149
case '\0': /* Long option. */
153
case '\0': /* Long option. */
156
value = strtol (optarg, &endp, 10);
160
value = strtol (optarg, &endp, 10);
166
value = strtol (optarg, &endp, 10);
170
value = strtol (optarg, &endp, 10);
173
dir_list_append (optarg);
177
dir_list_append (optarg);
177
message_print_style_escape (false);
181
message_print_style_escape (false);
181
message_print_style_escape (true);
185
message_print_style_escape (true);
189
sort_by_filepos = true;
193
sort_by_filepos = true;
197
message_print_style_indent ();
201
message_print_style_indent ();
205
output_file = optarg;
209
output_file = optarg;
209
output_syntax = &output_format_properties;
213
output_syntax = &output_format_properties;
213
input_syntax = &input_format_properties;
217
input_syntax = &input_format_properties;
217
sort_by_msgid = true;
221
sort_by_msgid = true;
221
message_print_style_uniforum ();
225
message_print_style_uniforum ();
240
value = strtol (optarg, &endp, 10);
242
message_page_width_set (value);
244
value = strtol (optarg, &endp, 10);
246
message_page_width_set (value);
246
250
case CHAR_MAX + 1:
250
254
case CHAR_MAX + 2: /* --no-wrap */
251
message_page_width_ignore ();
255
message_page_width_ignore ();
254
258
case CHAR_MAX + 3: /* --stringtable-input */
255
input_syntax = &input_format_stringtable;
259
input_syntax = &input_format_stringtable;
258
262
case CHAR_MAX + 4: /* --stringtable-output */
259
output_syntax = &output_format_stringtable;
263
output_syntax = &output_format_stringtable;
262
266
case CHAR_MAX + 5: /* --color */
263
if (handle_color_option (optarg))
264
usage (EXIT_FAILURE);
267
if (handle_color_option (optarg))
268
usage (EXIT_FAILURE);
267
271
case CHAR_MAX + 6: /* --style */
268
handle_style_option (optarg);
272
handle_style_option (optarg);
275
case CHAR_MAX + 7: /* --lang */
276
catalogname = optarg;
272
usage (EXIT_FAILURE);
280
usage (EXIT_FAILURE);
276
284
/* Version information requested. */
301
309
/* Verify selected options. */
302
310
if (!line_comment && sort_by_filepos)
303
311
error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
304
"--no-location", "--sort-by-file");
312
"--no-location", "--sort-by-file");
306
314
if (sort_by_msgid && sort_by_filepos)
307
315
error (EXIT_FAILURE, 0, _("%s and %s are mutually exclusive"),
308
"--sort-output", "--sort-by-file");
316
"--sort-output", "--sort-by-file");
310
318
/* Check the message selection criteria for sanity. */
311
319
if (more_than >= less_than || less_than < 2)
312
320
error (EXIT_FAILURE, 0,
313
_("impossible selection criteria specified (%d < n < %d)"),
314
more_than, less_than);
321
_("impossible selection criteria specified (%d < n < %d)"),
322
more_than, less_than);
316
324
/* Determine list of files we have to process. */
317
325
if (files_from != NULL)
325
333
/* Read input files, then filter, convert and merge messages. */
327
335
catenate_msgdomain_list (file_list, input_syntax,
328
output_syntax->requires_utf8 ? "UTF-8" : to_code);
336
output_syntax->requires_utf8 ? "UTF-8" : to_code);
330
338
string_list_free (file_list);
335
343
else if (sort_by_msgid)
336
344
msgdomain_list_sort_by_msgid (result);
346
/* Set the Language field in the header. */
347
if (catalogname != NULL)
348
msgdomain_list_set_header_field (result, "Language:", catalogname);
338
350
/* Write the PO file. */
339
351
msgdomain_list_print (result, output_file, output_syntax, force_po, false);
418
430
--use-first use first available translation for each\n\
419
431
message, don't merge several translations\n"));
433
--lang=CATALOGNAME set 'Language' field in the header entry\n"));
421
435
--color use colors and other text attributes always\n\
422
436
--color=WHEN use colors and other text attributes if WHEN.\n\
423
437
WHEN may be 'always', 'never', 'auto', or 'html'.\n"));