From bd91ac69061f0e90e3347115204a6aa861f51351 Mon Sep 17 00:00:00 2001 From: walter_l Date: Wed, 02 Dec 2009 15:26:25 +0000 Subject: Enumerate the strings we iterate over to get a valid plural number (n). git-svn-id: https://translate.svn.sourceforge.net/svnroot/translate/src/trunk/translate@13441 54714841-351b-0410-a198-e36a94b762f5 --- diff --git a/translate-toolkit-1.5.1/translate/tools/pogrep.py b/translate-toolkit-1.5.1/translate/tools/pogrep.py index 9f6136e..9582f30 100644 --- a/translate-toolkit-1.5.1/translate/tools/pogrep.py +++ b/translate-toolkit-1.5.1/translate/tools/pogrep.py @@ -110,15 +110,14 @@ def real_index(string, nfc_index): def find_matches(unit, part, strings, re_search): """Return the GrepFilter objects where re_search matches in strings.""" matches = [] - part_n = 0 - for string in strings: + for n, string in enumerate(strings): if not string: continue normalized = data.normalize(string) for matchobj in re_search.finditer(normalized): start = real_index(string, matchobj.start()) end = real_index(string, matchobj.end()) - matches.append(GrepMatch(unit, part=part, part_n=part_n, start=start, end=end)) + matches.append(GrepMatch(unit, part=part, part_n=n, start=start, end=end)) return matches class GrepFilter: -- cgit v0.9.1