]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
po-mode: Fix po-msgid-to-msgstr on plural entries.
authorBruno Haible <bruno@clisp.org>
Sat, 8 May 2010 18:37:56 +0000 (20:37 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 8 May 2010 18:37:56 +0000 (20:37 +0200)
gettext-tools/misc/ChangeLog
gettext-tools/misc/po-mode.el

index 2b200db23d55ed4a92ddf8ff110d47a77c84036d..20b5d88b23f5c1bf553276c7ca7e188dd6d15c22 100644 (file)
@@ -1,3 +1,9 @@
+2010-05-08  Bruno Haible  <bruno@clisp.org>
+
+       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  <nori1@dolphin.c.u-tokyo.ac.jp>
             Bruno Haible  <bruno@clisp.org>
 
index 246ace590d4c7171752c23b195ebbb6a4d7472dd..a699e011d523fb35159f74d22ef8555f0a183efe 100644 (file)
@@ -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."