From: Bruno Haible Date: Sat, 8 May 2010 18:37:56 +0000 (+0200) Subject: po-mode: Fix po-msgid-to-msgstr on plural entries. X-Git-Tag: v0.18~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=019f3bcd8c39c8e04cffeb5f221a6c63de525220;p=thirdparty%2Fgettext.git po-mode: Fix po-msgid-to-msgstr on plural entries. --- diff --git a/gettext-tools/misc/ChangeLog b/gettext-tools/misc/ChangeLog index 2b200db23..20b5d88b2 100644 --- a/gettext-tools/misc/ChangeLog +++ b/gettext-tools/misc/ChangeLog @@ -1,3 +1,9 @@ +2010-05-08 Bruno Haible + + po-mode: Fix po-msgid-to-msgstr on plural entries. + * po-mode.el (po-get-msgid_plural): New function. + (po-msgid-to-msgstr): Use it. + 2010-05-08 Noritada Kobayashi Bruno Haible diff --git a/gettext-tools/misc/po-mode.el b/gettext-tools/misc/po-mode.el index 246ace590..a699e011d 100644 --- a/gettext-tools/misc/po-mode.el +++ b/gettext-tools/misc/po-mode.el @@ -1684,7 +1684,9 @@ If WRAP is not nil, the search may wrap around the buffer." (if (or (eq po-entry-type 'untranslated) (eq po-entry-type 'obsolete) (y-or-n-p (_"Really lose previous translation? "))) - (po-set-msgstr-form (po-get-msgid))) + ;; In an entry with plural forms, use the msgid_plural string, + ;; as it is more general than the msgid string. + (po-set-msgstr-form (or (po-get-msgid_plural) (po-get-msgid)))) (message "")) ;; Obsolete entries. @@ -1905,6 +1907,16 @@ If FORM is itself a string, then this string is used for insertion." po-start-of-msgstr-block)))) string)) +(defun po-get-msgid_plural () + "Extract and return the unquoted msgid_plural string. +Return nil if it is not present." + (if po-start-of-msgid_plural + (let ((string (po-extract-unquoted (current-buffer) + po-start-of-msgid_plural + po-start-of-msgstr-block))) + string) + nil)) + (defun po-get-msgstr-flavor () "Helper function to detect msgstr and msgstr[] variants. Returns one of \"msgstr\" or \"msgstr[i]\" for some i."