i18n: Robustify db-seed-i18n.py parsing
authorDan Scott <dan@coffeecode.net>
Mon, 9 Apr 2012 13:37:57 +0000 (09:37 -0400)
committerThomas Berezansky <tsbere@mvlc.org>
Mon, 9 Apr 2012 19:24:45 +0000 (15:24 -0400)
Faced with the perplexing use of a space before a comma in
oils_i18n_gettext() keys, db-seed-i18n.py's regex failed. The solution
for a sloppy regex? More powerful regex!

Signed-off-by: Dan Scott <dan@coffeecode.net>
Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>

build/i18n/scripts/db-seed-i18n.py

index 7f34194..990afcc 100755 (executable)
@@ -55,8 +55,8 @@ class SQL(basel10n.BaseL10N):
 
         num = 0
         findi18n = re.compile(r'.*?oils_i18n_gettext\((.*?)\'\)')
-        intkey = re.compile(r'\s*(?P<id>\d+),\s*\'(?P<string>.+?)\',\s*\'(?P<class>.+?)\',\s*\'(?P<property>.+?)$')
-        textkey = re.compile(r'\s*\'(?P<id>.*?)\',\s*\'(?P<string>.+?)\',\s*\'(?P<class>.+?)\',\s*\'(?P<property>.+?)$')
+        intkey = re.compile(r'\s*(?P<id>\d+)\s*,\s*\'(?P<string>.+?)\',\s*\'(?P<class>.+?)\',\s*\'(?P<property>.+?)$')
+        textkey = re.compile(r'\s*\'(?P<id>.*?)\'\s*,\s*\'(?P<string>.+?)\',\s*\'(?P<class>.+?)\',\s*\'(?P<property>.+?)$')
         serts = dict()
 
         # Iterate through the source SQL grabbing table names and l10n strings