summaryrefslogtreecommitdiffstats
path: root/gettext-tools/src/write-java.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2005-10-06 11:20:08 +0000
committerBruno Haible <bruno@clisp.org>2009-06-23 12:12:52 +0200
commitf1f805bcf63cd5073235be63957b064899427516 (patch)
tree1a66b301119e582f347450e57a8b40531996553d /gettext-tools/src/write-java.c
parent57424044ae0a92479daa4031fe01bc55a5afc5f8 (diff)
downloadexternal_gettext-f1f805bcf63cd5073235be63957b064899427516.zip
external_gettext-f1f805bcf63cd5073235be63957b064899427516.tar.gz
external_gettext-f1f805bcf63cd5073235be63957b064899427516.tar.bz2
Support for context dependent translations in PO files.
Diffstat (limited to 'gettext-tools/src/write-java.c')
-rw-r--r--gettext-tools/src/write-java.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/gettext-tools/src/write-java.c b/gettext-tools/src/write-java.c
index c645b8b..b197cd8 100644
--- a/gettext-tools/src/write-java.c
+++ b/gettext-tools/src/write-java.c
@@ -69,6 +69,7 @@
#include "c-ctype.h"
#include "error.h"
+#include "xerror.h"
#include "javacomp.h"
#include "message.h"
#include "mkdtemp.h"
@@ -873,7 +874,7 @@ write_java_code (FILE *stream, const char *class_name, message_list_ty *mlp,
struct expression *plural;
unsigned long int nplurals;
- header_entry = message_list_search (mlp, "");
+ header_entry = message_list_search (mlp, NULL, "");
extract_plural_expression (header_entry ? header_entry->msgstr : NULL,
&plural, &nplurals);
@@ -957,6 +958,25 @@ msgdomain_write_java (message_list_ty *mlp, const char *canon_encoding,
if (mlp->nitems == 0)
return 0;
+ /* Determine whether mlp has entries with context. */
+ {
+ bool has_context;
+ size_t j;
+
+ has_context = false;
+ for (j = 0; j < mlp->nitems; j++)
+ if (mlp->item[j]->msgctxt != NULL)
+ has_context = true;
+ if (has_context)
+ {
+ multiline_error (xstrdup (""),
+ xstrdup (_("\
+message catalog has context dependent translations\n\
+but the Java ResourceBundle format doesn't support contexts\n")));
+ return 1;
+ }
+ }
+
retval = 1;
/* Convert the messages to Unicode. */