From: Bruno Haible Date: Thu, 20 Apr 2006 15:19:56 +0000 (+0000) Subject: KDE wishes are implemented. X-Git-Tag: v0.15~218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abb5f511e5af23130fcb17bf190fe812777c6543;p=thirdparty%2Fgettext.git KDE wishes are implemented. --- diff --git a/Admin/kde-i18n b/Admin/kde-i18n deleted file mode 100644 index c3306c08b..000000000 --- a/Admin/kde-i18n +++ /dev/null @@ -1,100 +0,0 @@ -> But I agree with you that -> -> i18n("title in dialog","Check Equations") -> -> would be prettier and easier to maintain, but needs some xgettext -> support. -Which we added with a little hack. - -# This is a patch for gettext-0.10.35 to allow translated messages -# to have a context as used in Qt and KDE. -# (C) 2000 Stephan Kulow - ---- src/xgettext.c.orig Sun May 14 18:16:25 2000 -+++ src/xgettext.c Sun May 14 18:27:20 2000 -@@ -835,7 +835,8 @@ - int is_cpp_file; - { - int state; -- -+ char *msgid = 0; -+ - /* Inform scanner whether we have C++ files or not. */ - if (is_cpp_file) - xgettext_lex_cplusplus (); -@@ -861,8 +862,11 @@ - State 3 = seen one of our keywords with string in second parameter - State 4 = was in state 3 and now saw a left paren - State 5 = waiting for comma after being in state 4 -- State 6 = saw comma after being in state 5 */ -+ State 6 = saw comma after being in state 5 -+ State 7 = after comma and State 2 -+ */ - xgettext_lex (&token); -+ - switch (token.type) - { - case xgettext_token_type_keyword1: -@@ -886,18 +890,51 @@ - state = 0; - } - continue; -+ -+ case xgettext_token_type_rp: -+ if (state == 2) { -+ token.string = strdup(msgid); -+ remember_a_message (mlp, &token); -+ free(msgid); -+ msgid = 0; -+ state = 0; -+ } -+ continue; - - case xgettext_token_type_comma: -- state = state == 5 ? 6 : 0; -+ switch (state) { -+ case 5: -+ state = 6; -+ break; -+ case 2: -+ state = 7; -+ break; -+ default: -+ state = 0; -+ break; -+ } - continue; - - case xgettext_token_type_string_literal: - if (extract_all || state == 2 || state == 6) - { -- remember_a_message (mlp, &token); -- state = 0; -+ if (msgid) -+ free(msgid); -+ msgid = strdup(token.string); -+ // state = 0; -+ } -+ else if (state == 7) -+ { -+ if (msgid) { -+ char *newstring = (char*)malloc(strlen(msgid) + strlen(token.string) + 20); -+ sprintf(newstring, "_: %s\n%s", msgid, token.string); -+ free(msgid); -+ free(token.string); -+ token.string = msgid = newstring; -+ state = 2; -+ } - } -- else -+ else - { - free (token.string); - state = (state == 4 || state == 5) ? 5 : 0; - - -Also need the corresponding two-argument gettext function in libgettext.h: -gettext2(role,msg) := - msgid := "_: " + role + "\n" + msg - trans := gettext(msgid) - return (trans == msgid ? msg : trans); diff --git a/Admin/plans b/Admin/plans index 406210152..1d9739edd 100644 --- a/Admin/plans +++ b/Admin/plans @@ -3,9 +3,6 @@ Things we plan to do. Comments welcome. - Documentation: Distinguish more clearly between gettext/xgettext, the Translation Project for GNU packages, and the PO mode. -- KDE wants a kind of gettext2("role","msg") function whose key is the - concatenation of "role" and "msg" but whose default value is only "msg". - - Look at Christian Robottom Reis's manual: http://www.async.com.br/~kiko/gettext.html