[geany/geany-plugins] a3a416: pohelper: Fix stats when file contains plural forms

Colomban Wendling git-noreply at xxxxx
Mon Feb 16 22:59:19 UTC 2015


Branch:      refs/heads/master
Author:      Colomban Wendling <ban at herbesfolles.org>
Committer:   Colomban Wendling <ban at herbesfolles.org>
Date:        Tue, 22 Apr 2014 16:16:27 UTC
Commit:      a3a416200c4158e3e2bb4e150d267845c625c413
             https://github.com/geany/geany-plugins/commit/a3a416200c4158e3e2bb4e150d267845c625c413

Log Message:
-----------
pohelper: Fix stats when file contains plural forms


Modified Paths:
--------------
    pohelper/src/gph-plugin.c

Modified: pohelper/src/gph-plugin.c
16 lines changed, 10 insertions(+), 6 deletions(-)
===================================================================
@@ -1344,13 +1344,17 @@ on_kb_show_stats (guint key_id)
   GeanyDocument *doc = document_get_current ();
   
   if (doc_is_po (doc)) {
-    const gint  len           = sci_get_length (doc->editor->sci);
-    gint        pos           = 0;
-    guint       all           = 0;
-    guint       untranslated  = 0;
-    guint       fuzzy         = 0;
+    ScintillaObject  *sci           = doc->editor->sci;
+    const gint        len           = sci_get_length (sci);
+    gint              pos           = 0;
+    guint             all           = 0;
+    guint             untranslated  = 0;
+    guint             fuzzy         = 0;
     
-    while ((pos = find_message (doc, pos, len)) >= 0) {
+    /* don't use find_message() because we want only match one block, not each
+     * msgstr as there might be plural forms */
+    while ((pos = find_style (sci, SCE_PO_MSGID, pos, len)) >= 0 &&
+           (pos = find_style (sci, SCE_PO_MSGSTR, pos, len)) >= 0) {
       GString *msgid = get_msgid_text_at (doc, pos);
       GString *msgstr = get_msgstr_text_at (doc, pos);
       



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Plugins-Commits mailing list