summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2001-07-09 17:46:43 +0000
committerBruno Haible <bruno@clisp.org>2001-07-09 17:46:43 +0000
commita0909f9ade39db88d3972bd2b7b4ab7bd9f74d7e (patch)
tree5b638f50f32c83c089aae0268c6fc373dccc6f2e /src
parent89e77b43689e7d311884fc9396b971aff7395c12 (diff)
downloadexternal_gettext-a0909f9ade39db88d3972bd2b7b4ab7bd9f74d7e.zip
external_gettext-a0909f9ade39db88d3972bd2b7b4ab7bd9f74d7e.tar.gz
external_gettext-a0909f9ade39db88d3972bd2b7b4ab7bd9f74d7e.tar.bz2
Warn if the msgid is not entirely ASCII.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/write-po.c25
2 files changed, 31 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 154fbc0..04a11ea 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2001-07-09 Bruno Haible <haible@clisp.cons.org>
+
+ * write-po.c (has_nonascii): New function.
+ (message_print): Warn if the msgid is not fully ASCII.
+ (message_print_obsolete): Likewise.
+
2001-07-05 Bruno Haible <haible@clisp.cons.org>
* msgcomm.c (is_message_selected): Keep the header entry.
diff --git a/src/write-po.c b/src/write-po.c
index 5274d2b..05b0df9 100644
--- a/src/write-po.c
+++ b/src/write-po.c
@@ -39,6 +39,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "linebreak.h"
#include "system.h"
#include "error.h"
+#include "xerror.h"
#include "libgettext.h"
@@ -56,6 +57,7 @@ static void wrap PARAMS ((FILE *fp, const char *line_prefix, const char *name,
const char *value, enum is_wrap do_wrap,
const char *charset));
static void print_blank_line PARAMS ((FILE *fp));
+static bool has_nonascii PARAMS ((const char *str));
static void message_print PARAMS ((const message_ty *mp, FILE *fp,
const char *charset, bool blank_line,
bool debug));
@@ -514,6 +516,15 @@ print_blank_line (fp)
putc ('\n', fp);
}
+static bool
+has_nonascii (str)
+ const char *str;
+{
+ for (; *str; str++)
+ if (!c_isascii ((unsigned char) *str))
+ return true;
+ return false;
+}
static void
message_print (mp, fp, charset, blank_line, debug)
@@ -664,6 +675,13 @@ message_print (mp, fp, charset, blank_line, debug)
/* Print each of the message components. Wrap them nicely so they
are as readable as possible. If there is no recorded msgstr for
this domain, emit an empty string. */
+ if (has_nonascii (mp->msgid))
+ multiline_warning (xasprintf (_("warning: ")),
+ xasprintf (_("\
+The following msgid contains non-ASCII characters.\n\
+This will cause problems to translators who use a character encoding\n\
+different from yours. Consider using a pure ASCII msgid instead.\n\
+%s\n"), mp->msgid));
wrap (fp, NULL, "msgid", mp->msgid, mp->do_wrap, charset);
if (mp->msgid_plural != NULL)
wrap (fp, NULL, "msgid_plural", mp->msgid_plural, mp->do_wrap, charset);
@@ -751,6 +769,13 @@ message_print_obsolete (mp, fp, charset, blank_line)
/* Print each of the message components. Wrap them nicely so they
are as readable as possible. */
+ if (has_nonascii (mp->msgid))
+ multiline_warning (xasprintf (_("warning: ")),
+ xasprintf (_("\
+The following msgid contains non-ASCII characters.\n\
+This will cause problems to translators who use a character encoding\n\
+different from yours. Consider using a pure ASCII msgid instead.\n\
+%s\n"), mp->msgid));
wrap (fp, "#~ ", "msgid", mp->msgid, mp->do_wrap, charset);
if (mp->msgid_plural != NULL)
wrap (fp, "#~ ", "msgid_plural", mp->msgid_plural, mp->do_wrap, charset);