From: Bruno Haible Date: Mon, 12 Jan 2004 11:15:50 +0000 (+0000) Subject: Improved handling of multi-part strings when there is a newline between X-Git-Tag: v0.14~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bb8ba7319ed3c6e13ee9ccfd9fd1f25287d9139;p=thirdparty%2Fgettext.git Improved handling of multi-part strings when there is a newline between the parts of the string. --- diff --git a/gettext-tools/src/ChangeLog b/gettext-tools/src/ChangeLog index d76d157f4..b0dbac29f 100644 --- a/gettext-tools/src/ChangeLog +++ b/gettext-tools/src/ChangeLog @@ -1,3 +1,45 @@ +2003-12-29 Bruno Haible + + * xgettext.h: Include stdlib.h, str-list.h. + (struct refcounted_string_list_ty): New type. + (add_reference, drop_reference): New functions. + (savable_comment, savable_comment_add, savable_comment_reset, + savable_comment_to_xgettext_comment): New declarations. + * xgettext.c (savable_comment): New variable. + (savable_comment_add, savable_comment_reset, + savable_comment_to_xgettext_comment): New functions. + * x-java.c (struct refcounted_string_list_ty, comment, add_reference, + drop_reference, x_java_comment_add, x_java_comment_reset, + x_java_comment_to_xgettext_comment): Remove. Use replacement from + xgettext.{h,c} instead. + * x-csharp.c (struct refcounted_string_list_ty, comment, add_reference, + drop_reference, x_csharp_comment_add, x_csharp_comment_reset, + x_csharp_comment_to_xgettext_comment): Remove. Use replacement from + xgettext.{h,c} instead. + * x-c.c (comment_line_end): Call savable_comment_add instead of + xgettext_comment_add. + (struct token_ty): Add 'comment' field. + (free_token): Free it. + (phase5_get): Initialize token's 'comment' field. + (phase6_get): Call savable_comment_reset instead of + xgettext_comment_reset. + (phase8a_get): Initialize token's 'comment' field. + (phase8b_get): Call savable_comment_reset instead of + xgettext_comment_reset. + (phase8c_get): In @"...", use the comment of the first token, not of + the second. + (struct xgettext_token_ty): Add 'comment' field. + (x_c_lex): Deal with the token's comment. + (extract_parenthesized): Call savable_comment_to_xgettext_comment and + savable_comment_reset. Free the token's comment field. + * x-python.c (comment_line_end): Call savable_comment_add instead of + xgettext_comment_add. + (struct token_ty): Add 'comment' field. + (phase5_get): Call savable_comment_reset instead of + xgettext_comment_reset. Initialize token's 'comment' field. + (extract_parenthesized): Call savable_comment_to_xgettext_comment and + savable_comment_reset. Free the token's comment field. + 2003-12-28 Bruno Haible * read-mo.h (read_mo_file): Change 'fn' into 'filename'. diff --git a/gettext-tools/src/x-c.c b/gettext-tools/src/x-c.c index 52a79ceeb..93a390f8c 100644 --- a/gettext-tools/src/x-c.c +++ b/gettext-tools/src/x-c.c @@ -591,7 +591,7 @@ comment_line_end (size_t chars_to_remove) buffer = xrealloc (buffer, bufmax); } buffer[buflen] = '\0'; - xgettext_comment_add (buffer); + savable_comment_add (buffer); } @@ -721,6 +721,8 @@ struct token_ty { token_type_ty type; char *string; /* for token_type_name, token_type_string_literal */ + refcounted_string_list_ty *comment; /* for token_type_string_literal, + token_type_objc_special */ long number; int line_number; }; @@ -883,6 +885,9 @@ free_token (token_ty *tp) { if (tp->type == token_type_name || tp->type == token_type_string_literal) free (tp->string); + if (tp->type == token_type_string_literal + || tp->type == token_type_objc_special) + drop_reference (tp->comment); } @@ -1134,6 +1139,7 @@ phase5_get (token_ty *tp) buffer[bufpos] = 0; tp->type = token_type_string_literal; tp->string = xstrdup (buffer); + tp->comment = add_reference (savable_comment); return; case '(': @@ -1160,6 +1166,7 @@ phase5_get (token_ty *tp) if (objc_extensions) { tp->type = token_type_objc_special; + tp->comment = add_reference (savable_comment); return; } /* FALLTHROUGH */ @@ -1312,7 +1319,7 @@ phase6_get (token_ty *tp) free_token (&buf[j]); /* We must reset the selected comments. */ - xgettext_comment_reset (); + savable_comment_reset (); } } @@ -1387,6 +1394,7 @@ phase8a_get (token_ty *tp) new_string[len + 2] = '\0'; free (tp->string); tp->string = new_string; + tp->comment = add_reference (savable_comment); tp->type = token_type_string_literal; } } @@ -1421,7 +1429,7 @@ phase8b_get (token_ty *tp) with non-white space tokens. */ ++newline_count; if (last_non_comment_line > last_comment_line) - xgettext_comment_reset (); + savable_comment_reset (); continue; } break; @@ -1453,6 +1461,8 @@ phase8c_get (token_ty *tp) return; } /* Drop the '@' token and return immediately the following string. */ + drop_reference (tmp.comment); + tmp.comment = tp->comment; *tp = tmp; } @@ -1523,6 +1533,9 @@ struct xgettext_token_ty xgettext_token_type_keyword, xgettext_token_type_symbol. */ char *string; + /* This field is used only for xgettext_token_type_string_literal. */ + refcounted_string_list_ty *comment; + /* These fields are only for xgettext_token_type_keyword, xgettext_token_type_string_literal. */ @@ -1595,10 +1608,15 @@ x_c_lex (xgettext_token_ty *tp) tp->type = xgettext_token_type_string_literal; tp->string = token.string; + tp->comment = token.comment; tp->pos.file_name = logical_file_name; tp->pos.line_number = token.line_number; return; + case token_type_objc_special: + drop_reference (token.comment); + /* FALLTHROUGH */ + default: last_non_comment_line = newline_count; @@ -1761,7 +1779,11 @@ extract_parenthesized (message_list_ty *mlp, case xgettext_token_type_string_literal: if (extract_all) - remember_a_message (mlp, token.string, inner_context, &token.pos); + { + savable_comment_to_xgettext_comment (token.comment); + remember_a_message (mlp, token.string, inner_context, &token.pos); + savable_comment_reset (); + } else { if (commas_to_skip == 0) @@ -1769,9 +1791,12 @@ extract_parenthesized (message_list_ty *mlp, if (plural_mp == NULL) { /* Seen an msgid. */ - message_ty *mp = - remember_a_message (mlp, token.string, - inner_context, &token.pos); + message_ty *mp; + + savable_comment_to_xgettext_comment (token.comment); + mp = remember_a_message (mlp, token.string, + inner_context, &token.pos); + savable_comment_reset (); if (plural_commas > 0) plural_mp = mp; } @@ -1786,6 +1811,7 @@ extract_parenthesized (message_list_ty *mlp, else free (token.string); } + drop_reference (token.comment); next_context_iter = null_context_list_iterator; selectorcall_context_iter = null_context_list_iterator; state = 0; diff --git a/gettext-tools/src/x-csharp.c b/gettext-tools/src/x-csharp.c index 150facdbd..4dd27e467 100644 --- a/gettext-tools/src/x-csharp.c +++ b/gettext-tools/src/x-csharp.c @@ -580,99 +580,6 @@ free_string_buffer (struct string_buffer *bp) /* ======================== Accumulating comments. ======================== */ -/* In this backend we cannot use the xgettext_comment* functions directly, - because in multiline string expressions like - "string1" + - "string2" - the newline between "string1" and "string2" would cause a call to - xgettext_comment_reset(), thus destroying the accumulated comments - that we need a little later, when we have concatenated the two strings - and pass them to remember_a_message(). - Instead, we do the bookkeeping of the accumulated comments directly, - and save a pointer to the accumulated comments when we read "string1". - In order to avoid excessive copying of strings, we use reference - counting. */ - -typedef struct refcounted_string_list_ty refcounted_string_list_ty; -struct refcounted_string_list_ty -{ - unsigned int refcount; - struct string_list_ty contents; -}; - -static refcounted_string_list_ty *comment; - -static inline refcounted_string_list_ty * -add_reference (refcounted_string_list_ty *rslp) -{ - if (rslp != NULL) - rslp->refcount++; - return rslp; -} - -static inline void -drop_reference (refcounted_string_list_ty *rslp) -{ - if (rslp != NULL) - { - if (rslp->refcount > 1) - rslp->refcount--; - else - { - string_list_destroy (&rslp->contents); - free (rslp); - } - } -} - -static void -x_csharp_comment_add (const char *str) -{ - if (comment == NULL) - { - comment = (refcounted_string_list_ty *) xmalloc (sizeof (*comment)); - comment->refcount = 1; - string_list_init (&comment->contents); - } - else if (comment->refcount > 1) - { - /* Unshare the list by making copies. */ - struct string_list_ty *oldcontents; - size_t i; - - comment->refcount--; - oldcontents = &comment->contents; - - comment = (refcounted_string_list_ty *) xmalloc (sizeof (*comment)); - comment->refcount = 1; - string_list_init (&comment->contents); - for (i = 0; i < oldcontents->nitems; i++) - string_list_append (&comment->contents, oldcontents->item[i]); - } - string_list_append (&comment->contents, str); -} - -static void -x_csharp_comment_reset () -{ - drop_reference (comment); - comment = NULL; -} - -static void -x_csharp_comment_to_xgettext_comment (refcounted_string_list_ty *rslp) -{ - xgettext_comment_reset (); - if (rslp != NULL) - { - size_t i; - - for (i = 0; i < rslp->contents.nitems; i++) - xgettext_comment_add (rslp->contents.item[i]); - } -} - - /* Accumulating a single comment line. */ static struct string_buffer comment_buffer; @@ -706,7 +613,7 @@ comment_line_end (size_t chars_to_remove) && (buffer[buflen - 1] == ' ' || buffer[buflen - 1] == '\t')) --buflen; buffer[buflen] = '\0'; - x_csharp_comment_add (buffer); + savable_comment_add (buffer); } @@ -1637,7 +1544,7 @@ phase6_get (token_ty *tp) { case UNL: if (last_non_comment_line > last_comment_line) - x_csharp_comment_reset (); + savable_comment_reset (); /* FALLTHROUGH */ case ' ': case '\t': @@ -1725,7 +1632,7 @@ phase6_get (token_ty *tp) accumulate_escaped (&literal, '"'); tp->string = xstrdup (string_buffer_result (&literal)); free_string_buffer (&literal); - tp->comment = add_reference (comment); + tp->comment = add_reference (savable_comment); tp->type = token_type_string_literal; return; } @@ -1787,7 +1694,7 @@ phase6_get (token_ty *tp) } tp->string = xstrdup (string_buffer_result (&literal)); free_string_buffer (&literal); - tp->comment = add_reference (comment); + tp->comment = add_reference (savable_comment); tp->type = token_type_string_literal; return; } @@ -2158,9 +2065,9 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator, if (extract_all) { xgettext_current_source_encoding = po_charset_utf8; - x_csharp_comment_to_xgettext_comment (token.comment); + savable_comment_to_xgettext_comment (token.comment); remember_a_message (mlp, token.string, inner_context, &pos); - x_csharp_comment_reset (); + savable_comment_reset (); xgettext_current_source_encoding = xgettext_global_source_encoding; } else @@ -2173,10 +2080,10 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator, message_ty *mp; xgettext_current_source_encoding = po_charset_utf8; - x_csharp_comment_to_xgettext_comment (token.comment); + savable_comment_to_xgettext_comment (token.comment); mp = remember_a_message (mlp, token.string, inner_context, &pos); - x_csharp_comment_reset (); + savable_comment_reset (); xgettext_current_source_encoding = xgettext_global_source_encoding; if (plural_commas > 0) plural_mp = mp; diff --git a/gettext-tools/src/x-java.c b/gettext-tools/src/x-java.c index 8bb0545e9..821cca3d2 100644 --- a/gettext-tools/src/x-java.c +++ b/gettext-tools/src/x-java.c @@ -572,99 +572,6 @@ free_string_buffer (struct string_buffer *bp) /* ======================== Accumulating comments. ======================== */ -/* In this backend we cannot use the xgettext_comment* functions directly, - because in multiline string expressions like - "string1" + - "string2" - the newline between "string1" and "string2" would cause a call to - xgettext_comment_reset(), thus destroying the accumulated comments - that we need a little later, when we have concatenated the two strings - and pass them to remember_a_message(). - Instead, we do the bookkeeping of the accumulated comments directly, - and save a pointer to the accumulated comments when we read "string1". - In order to avoid excessive copying of strings, we use reference - counting. */ - -typedef struct refcounted_string_list_ty refcounted_string_list_ty; -struct refcounted_string_list_ty -{ - unsigned int refcount; - struct string_list_ty contents; -}; - -static refcounted_string_list_ty *comment; - -static inline refcounted_string_list_ty * -add_reference (refcounted_string_list_ty *rslp) -{ - if (rslp != NULL) - rslp->refcount++; - return rslp; -} - -static inline void -drop_reference (refcounted_string_list_ty *rslp) -{ - if (rslp != NULL) - { - if (rslp->refcount > 1) - rslp->refcount--; - else - { - string_list_destroy (&rslp->contents); - free (rslp); - } - } -} - -static void -x_java_comment_add (const char *str) -{ - if (comment == NULL) - { - comment = (refcounted_string_list_ty *) xmalloc (sizeof (*comment)); - comment->refcount = 1; - string_list_init (&comment->contents); - } - else if (comment->refcount > 1) - { - /* Unshare the list by making copies. */ - struct string_list_ty *oldcontents; - size_t i; - - comment->refcount--; - oldcontents = &comment->contents; - - comment = (refcounted_string_list_ty *) xmalloc (sizeof (*comment)); - comment->refcount = 1; - string_list_init (&comment->contents); - for (i = 0; i < oldcontents->nitems; i++) - string_list_append (&comment->contents, oldcontents->item[i]); - } - string_list_append (&comment->contents, str); -} - -static void -x_java_comment_reset () -{ - drop_reference (comment); - comment = NULL; -} - -static void -x_java_comment_to_xgettext_comment (refcounted_string_list_ty *rslp) -{ - xgettext_comment_reset (); - if (rslp != NULL) - { - size_t i; - - for (i = 0; i < rslp->contents.nitems; i++) - xgettext_comment_add (rslp->contents.item[i]); - } -} - - /* Accumulating a single comment line. */ static struct string_buffer comment_buffer; @@ -701,7 +608,7 @@ comment_line_end (size_t chars_to_remove) && (buffer[buflen - 1] == ' ' || buffer[buflen - 1] == '\t')) --buflen; buffer[buflen] = '\0'; - x_java_comment_add (buffer); + savable_comment_add (buffer); } @@ -963,7 +870,7 @@ phase5_get (token_ty *tp) { case '\n': if (last_non_comment_line > last_comment_line) - x_java_comment_reset (); + savable_comment_reset (); /* FALLTHROUGH */ case ' ': case '\t': @@ -1096,7 +1003,7 @@ phase5_get (token_ty *tp) accumulate_escaped (&literal, '"'); tp->string = xstrdup (string_buffer_result (&literal)); free_string_buffer (&literal); - tp->comment = add_reference (comment); + tp->comment = add_reference (savable_comment); tp->type = token_type_string_literal; return; } @@ -1476,9 +1383,9 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator, if (extract_all) { xgettext_current_source_encoding = po_charset_utf8; - x_java_comment_to_xgettext_comment (token.comment); + savable_comment_to_xgettext_comment (token.comment); remember_a_message (mlp, token.string, inner_context, &pos); - x_java_comment_reset (); + savable_comment_reset (); xgettext_current_source_encoding = xgettext_global_source_encoding; } else @@ -1491,10 +1398,10 @@ extract_parenthesized (message_list_ty *mlp, token_type_ty terminator, message_ty *mp; xgettext_current_source_encoding = po_charset_utf8; - x_java_comment_to_xgettext_comment (token.comment); + savable_comment_to_xgettext_comment (token.comment); mp = remember_a_message (mlp, token.string, inner_context, &pos); - x_java_comment_reset (); + savable_comment_reset (); xgettext_current_source_encoding = xgettext_global_source_encoding; if (plural_commas > 0) plural_mp = mp; diff --git a/gettext-tools/src/x-python.c b/gettext-tools/src/x-python.c index 3e2ced7a4..d2b6a85ac 100644 --- a/gettext-tools/src/x-python.c +++ b/gettext-tools/src/x-python.c @@ -240,7 +240,7 @@ comment_line_end () buffer = xrealloc (buffer, bufmax); } buffer[buflen] = '\0'; - xgettext_comment_add (buffer); + savable_comment_add (buffer); } /* These are for tracking whether comments count as immediately before @@ -322,6 +322,7 @@ struct token_ty { token_type_ty type; char *string; /* for token_type_string, token_type_symbol */ + refcounted_string_list_ty *comment; /* for token_type_string */ int line_number; }; @@ -696,7 +697,7 @@ phase5_get (token_ty *tp) case '\n': if (last_non_comment_line > last_comment_line) - xgettext_comment_reset (); + savable_comment_reset (); /* Ignore newline if and only if it is used for implicit line joining. */ if (open_pbb > 0) @@ -911,6 +912,7 @@ phase5_get (token_ty *tp) assert (q - utf8_string <= 3 * bufpos); tp->string = (char *) utf8_string; } + tp->comment = add_reference (savable_comment); tp->type = token_type_string; return; } @@ -1121,7 +1123,11 @@ extract_parenthesized (message_list_ty *mlp, pos.line_number = token.line_number; if (extract_all) - remember_a_message (mlp, token.string, inner_context, &pos); + { + savable_comment_to_xgettext_comment (token.comment); + remember_a_message (mlp, token.string, inner_context, &pos); + savable_comment_reset (); + } else { if (commas_to_skip == 0) @@ -1129,9 +1135,12 @@ extract_parenthesized (message_list_ty *mlp, if (plural_mp == NULL) { /* Seen an msgid. */ - message_ty *mp = - remember_a_message (mlp, token.string, - inner_context, &pos); + message_ty *mp; + + savable_comment_to_xgettext_comment (token.comment); + mp = remember_a_message (mlp, token.string, + inner_context, &pos); + savable_comment_reset (); if (plural_commas > 0) plural_mp = mp; } @@ -1147,6 +1156,7 @@ extract_parenthesized (message_list_ty *mlp, free (token.string); } } + drop_reference (token.comment); next_context_iter = null_context_list_iterator; state = 0; continue; diff --git a/gettext-tools/src/xgettext.c b/gettext-tools/src/xgettext.c index 5c5a39554..cde60b535 100644 --- a/gettext-tools/src/xgettext.c +++ b/gettext-tools/src/xgettext.c @@ -1482,6 +1482,58 @@ xgettext_comment_reset () } +refcounted_string_list_ty *savable_comment; + +void +savable_comment_add (const char *str) +{ + if (savable_comment == NULL) + { + savable_comment = + (refcounted_string_list_ty *) xmalloc (sizeof (*savable_comment)); + savable_comment->refcount = 1; + string_list_init (&savable_comment->contents); + } + else if (savable_comment->refcount > 1) + { + /* Unshare the list by making copies. */ + struct string_list_ty *oldcontents; + size_t i; + + savable_comment->refcount--; + oldcontents = &savable_comment->contents; + + savable_comment = + (refcounted_string_list_ty *) xmalloc (sizeof (*savable_comment)); + savable_comment->refcount = 1; + string_list_init (&savable_comment->contents); + for (i = 0; i < oldcontents->nitems; i++) + string_list_append (&savable_comment->contents, oldcontents->item[i]); + } + string_list_append (&savable_comment->contents, str); +} + +void +savable_comment_reset () +{ + drop_reference (savable_comment); + savable_comment = NULL; +} + +void +savable_comment_to_xgettext_comment (refcounted_string_list_ty *rslp) +{ + xgettext_comment_reset (); + if (rslp != NULL) + { + size_t i; + + for (i = 0; i < rslp->contents.nitems; i++) + xgettext_comment_add (rslp->contents.item[i]); + } +} + + static FILE * xgettext_open (const char *fn, diff --git a/gettext-tools/src/xgettext.h b/gettext-tools/src/xgettext.h index ba1f91425..86bf1c10f 100644 --- a/gettext-tools/src/xgettext.h +++ b/gettext-tools/src/xgettext.h @@ -21,6 +21,7 @@ #define _XGETTEXT_H #include +#include #if HAVE_ICONV #include @@ -28,6 +29,7 @@ #include "message.h" #include "pos.h" +#include "str-list.h" /* Declare 'line_comment' and 'input_syntax'. */ #include "read-po.h" @@ -146,6 +148,57 @@ extern const char *xgettext_comment (size_t n); extern void xgettext_comment_reset (void); +/* Comment handling for backends which support combining adjacent strings + even across lines. + In these backends we cannot use the xgettext_comment* functions directly, + because in multiline string expressions like + "string1" + + "string2" + the newline between "string1" and "string2" would cause a call to + xgettext_comment_reset(), thus destroying the accumulated comments + that we need a little later, when we have concatenated the two strings + and pass them to remember_a_message(). + Instead, we do the bookkeeping of the accumulated comments directly, + and save a pointer to the accumulated comments when we read "string1". + In order to avoid excessive copying of strings, we use reference + counting. */ + +typedef struct refcounted_string_list_ty refcounted_string_list_ty; +struct refcounted_string_list_ty +{ + unsigned int refcount; + struct string_list_ty contents; +}; + +static inline refcounted_string_list_ty * +add_reference (refcounted_string_list_ty *rslp) +{ + if (rslp != NULL) + rslp->refcount++; + return rslp; +} + +static inline void +drop_reference (refcounted_string_list_ty *rslp) +{ + if (rslp != NULL) + { + if (rslp->refcount > 1) + rslp->refcount--; + else + { + string_list_destroy (&rslp->contents); + free (rslp); + } + } +} + +extern refcounted_string_list_ty *savable_comment; +extern void savable_comment_add (const char *str); +extern void savable_comment_reset (void); +extern void savable_comment_to_xgettext_comment (refcounted_string_list_ty *rslp); + + /* Add a message to the list of extracted messages. string must be malloc()ed string; its ownership is passed to the callee. pos->file_name must be allocated with indefinite extent. */ diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog index f257445b1..478a4f446 100644 --- a/gettext-tools/tests/ChangeLog +++ b/gettext-tools/tests/ChangeLog @@ -1,3 +1,13 @@ +2003-12-29 Bruno Haible + + * xgettext-c-9: Add a test with a multi-part string with newlines and + comments between the parts. + * xgettext-java-5: Likewise. + * xgettext-csharp-5: Likewise. + * xgettext-python-2: Likewise. + * xgettext-objc-2: New file. + * Makefile.am (TESTS): Add it. + 2003-12-26 Bruno Haible Support for C#. diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am index 4859c6f2f..8015ace42 100644 --- a/gettext-tools/tests/Makefile.am +++ b/gettext-tools/tests/Makefile.am @@ -69,7 +69,7 @@ TESTS = gettext-1 gettext-2 \ xgettext-java-5 \ xgettext-librep-1 \ xgettext-lisp-1 \ - xgettext-objc-1 \ + xgettext-objc-1 xgettext-objc-2 \ xgettext-perl-1 xgettext-perl-2 xgettext-perl-3 xgettext-perl-4 \ xgettext-perl-5 \ xgettext-php-1 \ diff --git a/gettext-tools/tests/xgettext-c-9 b/gettext-tools/tests/xgettext-c-9 index b09095409..43e7e5929 100755 --- a/gettext-tools/tests/xgettext-c-9 +++ b/gettext-tools/tests/xgettext-c-9 @@ -17,6 +17,10 @@ print (gettext ("Hey Jude")); Nickname of the Beatles */ print (gettext ("The Fabulous Four")); +/* TRANSLATORS: The strings get concatenated. */ +print (gettext ("there is not enough" +" room on a single line for this entire long, " // confusing, eh? +"verbose string")); EOF tmpfiles="$tmpfiles xg-c-9.po" @@ -42,6 +46,12 @@ msgstr "" #. msgid "The Fabulous Four" msgstr "" + +#. TRANSLATORS: The strings get concatenated. +msgid "" +"there is not enough room on a single line for this entire long, verbose " +"string" +msgstr "" EOF : ${DIFF=diff} diff --git a/gettext-tools/tests/xgettext-csharp-5 b/gettext-tools/tests/xgettext-csharp-5 index a9a525d22..03e4b1527 100755 --- a/gettext-tools/tests/xgettext-csharp-5 +++ b/gettext-tools/tests/xgettext-csharp-5 @@ -17,6 +17,10 @@ Console.WriteLine(GetString("Hey Jude")); Nickname of the Beatles */ Console.WriteLine(GetString("The Fabulous Four")); +/* TRANSLATORS: The strings get concatenated. */ +Console.WriteLine(GetString("there is not enough" + +" room on a single line for this entire long, " // confusing, eh? ++ "verbose string")); EOF tmpfiles="$tmpfiles xg-cs-5.po" @@ -42,6 +46,12 @@ msgstr "" #. msgid "The Fabulous Four" msgstr "" + +#. TRANSLATORS: The strings get concatenated. +msgid "" +"there is not enough room on a single line for this entire long, verbose " +"string" +msgstr "" EOF : ${DIFF=diff} diff --git a/gettext-tools/tests/xgettext-java-5 b/gettext-tools/tests/xgettext-java-5 index 0d77a50c3..6b8307db1 100755 --- a/gettext-tools/tests/xgettext-java-5 +++ b/gettext-tools/tests/xgettext-java-5 @@ -17,6 +17,10 @@ System.out.println(gettext("Hey Jude")); Nickname of the Beatles */ System.out.println(gettext("The Fabulous Four")); +/* TRANSLATORS: The strings get concatenated. */ +System.out.println(gettext("there is not enough" + +" room on a single line for this entire long, " // confusing, eh? ++ "verbose string")); EOF tmpfiles="$tmpfiles xg-j-5.po" @@ -42,6 +46,12 @@ msgstr "" #. msgid "The Fabulous Four" msgstr "" + +#. TRANSLATORS: The strings get concatenated. +msgid "" +"there is not enough room on a single line for this entire long, verbose " +"string" +msgstr "" EOF : ${DIFF=diff} diff --git a/gettext-tools/tests/xgettext-python-2 b/gettext-tools/tests/xgettext-python-2 index 22518b722..88d9b9d5b 100755 --- a/gettext-tools/tests/xgettext-python-2 +++ b/gettext-tools/tests/xgettext-python-2 @@ -16,6 +16,10 @@ print gettext.gettext("Hey Jude") # TRANSLATORS: # Nickname of the Beatles print gettext.gettext("The Fabulous Four") +# TRANSLATORS: The strings get concatenated. +print gettext.gettext("there is not enough" +" room on a single line for this entire long, " # confusing, eh? +"verbose string") EOF tmpfiles="$tmpfiles xg-py-2.po" @@ -40,6 +44,12 @@ msgstr "" #. Nickname of the Beatles msgid "The Fabulous Four" msgstr "" + +#. TRANSLATORS: The strings get concatenated. +msgid "" +"there is not enough room on a single line for this entire long, verbose " +"string" +msgstr "" EOF : ${DIFF=diff}