+2002-05-22 Bruno Haible <bruno@clisp.org>
+
+ * msgl-iconv.h (iconv_message_list): Add from_filename argument.
+ (iconv_msgdomain_list): Likewise.
+ * msgl-iconv.c (iconv_message_list): Add from_filename argument.
+ Don't give an error for POT files containing charset=CHARSET.
+ (iconv_msgdomain_list): Add from_filename argument.
+ * msgl-cat.c (catenate_msgdomain_list): Don't give an error for
+ POT files containing charset=CHARSET. Pass input file name to
+ iconv_message_list.
+ * msgconv.c (main): Pass input file name to iconv_msgdomain_list.
+ * write-java.c (msgdomain_write_java): Update.
+ * write-tcl.c (msgdomain_write_tcl): Update.
+ * x-glade.c (do_extract_glade): Update.
+ * x-python.c (extract_python): Update.
+ * x-tcl.c (extract_tcl): Update.
+
2002-05-18 Bruno Haible <bruno@clisp.org>
* Makefile.am (RM): New variable.
to_code = locale_charset ();
/* Read input file and convert. */
- result = iconv_msgdomain_list (read_po_file (input_file), to_code);
+ result = iconv_msgdomain_list (read_po_file (input_file), to_code,
+ input_file);
/* Sort the results. */
if (sort_by_filepos)
/* Message list concatenation and duplicate handling.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
canon_charset = po_charset_canonicalize (charset);
if (canon_charset == NULL)
- error (EXIT_FAILURE, 0,
- _("\
+ {
+ /* Don't give an error for POT files, because
+ POT files usually contain only ASCII
+ msgids. */
+ const char *filename = files[n];
+ size_t filenamelen = strlen (filename);
+
+ if (filenamelen >= 4
+ && memcmp (filename + filenamelen - 4,
+ ".pot", 4) == 0
+ && strcmp (charset, "CHARSET") == 0)
+ canon_charset = po_charset_ascii;
+ else
+ error (EXIT_FAILURE, 0,
+ _("\
present charset \"%s\" is not a portable encoding name"),
- charset);
+ charset);
+ }
if (canon_from_code == NULL)
canon_from_code = canon_charset;
header entry with its canonical equivalent. */
if (!(to_code == NULL && canon_charsets[n][k] == canon_to_code))
iconv_message_list (mdlp->item[k]->messages, canon_charsets[n][k],
- canon_to_code);
+ canon_to_code, files[n]);
}
/* Fill the resulting messages. */
void
-iconv_message_list (mlp, canon_from_code, canon_to_code)
+iconv_message_list (mlp, canon_from_code, canon_to_code, from_filename)
message_list_ty *mlp;
const char *canon_from_code;
const char *canon_to_code;
+ const char *from_filename;
{
bool canon_from_code_overridden = (canon_from_code != NULL);
size_t j;
if (canon_charset == NULL)
{
if (!canon_from_code_overridden)
- error (EXIT_FAILURE, 0,
- _("\
+ {
+ /* Don't give an error for POT files, because POT
+ files usually contain only ASCII msgids. */
+ const char *filename = from_filename;
+ size_t filenamelen;
+
+ if (filename != NULL
+ && (filenamelen = strlen (filename)) >= 4
+ && memcmp (filename + filenamelen - 4, ".pot", 4)
+ == 0
+ && strcmp (charset, "CHARSET") == 0)
+ canon_charset = po_charset_ascii;
+ else
+ error (EXIT_FAILURE, 0,
+ _("\
present charset \"%s\" is not a portable encoding name"),
- charset);
+ charset);
+ }
}
else
{
}
msgdomain_list_ty *
-iconv_msgdomain_list (mdlp, to_code)
+iconv_msgdomain_list (mdlp, to_code, from_filename)
msgdomain_list_ty *mdlp;
const char *to_code;
+ const char *from_filename;
{
const char *canon_to_code;
size_t k;
to_code);
for (k = 0; k < mdlp->nitems; k++)
- iconv_message_list (mdlp->item[k]->messages, NULL, canon_to_code);
+ iconv_message_list (mdlp->item[k]->messages, NULL, canon_to_code,
+ from_filename);
return mdlp;
}
/* Message list character set conversion.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
extern void
iconv_message_list PARAMS ((message_list_ty *mlp,
const char *canon_from_code,
- const char *canon_to_code));
+ const char *canon_to_code,
+ const char *from_filename));
/* Converts all the message lists in MDLP to the encoding TO_CODE. */
extern msgdomain_list_ty *
iconv_msgdomain_list PARAMS ((msgdomain_list_ty *mdlp,
- const char *to_code));
+ const char *to_code,
+ const char *from_filename));
#endif /* _MSGL_ICONV_H */
/* Writing Java ResourceBundles.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002 Free Software Foundation, Inc.
Written by Bruno Haible <haible@clisp.cons.org>, 2001.
This program is free software; you can redistribute it and/or modify
retval = 1;
/* Convert the messages to Unicode. */
- iconv_message_list (mlp, NULL, po_charset_canonicalize ("UTF-8"));
+ iconv_message_list (mlp, NULL, po_charset_canonicalize ("UTF-8"), NULL);
cleanup_list.tmpdir = NULL;
cleanup_list.subdir_count = 0;
}
/* Convert the messages to Unicode. */
- iconv_message_list (mlp, NULL, po_charset_canonicalize ("UTF-8"));
+ iconv_message_list (mlp, NULL, po_charset_canonicalize ("UTF-8"), NULL);
/* Now create the file. */
{
if (!is_ascii_message_list (mlp))
{
const char *canon_utf_8 = po_charset_canonicalize ("UTF-8");
- iconv_message_list (mlp, canon_utf_8, canon_utf_8);
+ iconv_message_list (mlp, canon_utf_8, canon_utf_8, NULL);
}
/* Close scanner. */
if (!is_ascii_message_list (mlp))
{
const char *canon_utf_8 = po_charset_canonicalize ("UTF-8");
- iconv_message_list (mlp, canon_utf_8, canon_utf_8);
+ iconv_message_list (mlp, canon_utf_8, canon_utf_8, NULL);
}
fp = NULL;
if (!is_ascii_message_list (mlp))
{
const char *canon_utf_8 = po_charset_canonicalize ("UTF-8");
- iconv_message_list (mlp, canon_utf_8, canon_utf_8);
+ iconv_message_list (mlp, canon_utf_8, canon_utf_8, NULL);
}
fp = NULL;