From a54b8780a82db6c7401b558ee28972414907e218 Mon Sep 17 00:00:00 2001 From: Luc Charland Date: Thu, 30 Jul 2015 10:07:18 -0400 Subject: [PATCH 1/5] added first draft of verify_translation --- Scripts/verify_translations.py | 90 ++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100755 Scripts/verify_translations.py diff --git a/Scripts/verify_translations.py b/Scripts/verify_translations.py new file mode 100755 index 000000000..57c4e942a --- /dev/null +++ b/Scripts/verify_translations.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python + +import sys +import os +import re + +DEBUG=True +DEBUG=False + +dir_mappings = {"../UI/Templates":"../UI/Common", + "../UI/Templates/AdministrationUI":"../UI/AdministrationUI", + "../UI/Templates/Appointments":"../UI/Common", + "../UI/Templates/ContactsUI":"../UI/Contacts", + "../UI/Templates/MailerUI":"../UI/MailerUI", + "../UI/Templates/MailPartViewers":"../UI/MailPartViewers", + "../UI/Templates/MainUI":"../UI/MainUI", + "../UI/Templates/PreferencesUI":"../UI/PreferencesUI", + "../UI/Templates/SchedulerUI":"../UI/Scheduler" + } + +def get_translations(path): + try: + transpath = dir_mappings.get(path, path) + #print "Transpath:", transpath + transname = transpath + '/English.lproj/Localizable.strings' + transall = open(transname).read().split('\n') + transgood = [l.strip() for l in transall if len(l.strip()) and l.strip()[0] != '#'] + except: + transgood = () + return transgood + + +def find_missing_translations(rootdir='.', extention='', recomp=None, greylist=()): + for path, dirs, files in os.walk(rootdir): + #print path, files + filelist = [f for f in files if f[(-1 * len(extention)):] == extention] + if filelist: + for filename in filelist: + if filename in greylist: + print "%s is greylisted -- SKIPPING" % filename + continue + pathname = path + '/' + filename + lines = open(pathname).read().split("\n") + regex_results = [recomp.search(l) for l in lines] + values = [r.groups()[0] for r in regex_results if r] + #print pathname, values + if values: + #- Get the current english translations for the path + transgood = get_translations(path) + if not transgood: + print "No translation file found for %s, skipping %s" % (path, pathname) + continue + notfound = list() + if DEBUG:print pathname + #- Only 'good' lines (not empty, not comment) + for value in values: + #print "\t", "[%s]" % value + #- Try to find the value from the vox file in the translation file + found = [line for line in transgood if value in line] + if found: + if DEBUG: print "\t", "[%s] FOUND --" % value, found[0].split("=")[0] + else: + #notfound.append("-->\t[%s] ==== TRANSLATION NOT FOUND ====" % value) + notfound.append("-->\t[%s] ==== Not Found ====" % value) + if notfound: + if not DEBUG:print pathname + print "\n".join(notfound) + + +def main(): + #- Only one option... + if len(sys.argv) > 1: + if sys.argv[1] == '-g': + global DEBUG + DEBUG = True + else: + print 'Usage:', sys.argv[0], '[-g]\n\t\t-g: debug will show matching also' + sys.exit(1) + + greylist = ('UIxFilterEditor.wox') + + #- Get only the label:value from all lines + recomp = re.compile(' Date: Thu, 30 Jul 2015 10:26:43 -0400 Subject: [PATCH 2/5] cleaned up a few comments --- Scripts/verify_translations.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Scripts/verify_translations.py b/Scripts/verify_translations.py index 57c4e942a..fdf24fe48 100755 --- a/Scripts/verify_translations.py +++ b/Scripts/verify_translations.py @@ -4,7 +4,6 @@ import sys import os import re -DEBUG=True DEBUG=False dir_mappings = {"../UI/Templates":"../UI/Common", @@ -21,7 +20,6 @@ dir_mappings = {"../UI/Templates":"../UI/Common", def get_translations(path): try: transpath = dir_mappings.get(path, path) - #print "Transpath:", transpath transname = transpath + '/English.lproj/Localizable.strings' transall = open(transname).read().split('\n') transgood = [l.strip() for l in transall if len(l.strip()) and l.strip()[0] != '#'] @@ -32,7 +30,6 @@ def get_translations(path): def find_missing_translations(rootdir='.', extention='', recomp=None, greylist=()): for path, dirs, files in os.walk(rootdir): - #print path, files filelist = [f for f in files if f[(-1 * len(extention)):] == extention] if filelist: for filename in filelist: @@ -43,7 +40,6 @@ def find_missing_translations(rootdir='.', extention='', recomp=None, greylist=( lines = open(pathname).read().split("\n") regex_results = [recomp.search(l) for l in lines] values = [r.groups()[0] for r in regex_results if r] - #print pathname, values if values: #- Get the current english translations for the path transgood = get_translations(path) @@ -52,15 +48,12 @@ def find_missing_translations(rootdir='.', extention='', recomp=None, greylist=( continue notfound = list() if DEBUG:print pathname - #- Only 'good' lines (not empty, not comment) for value in values: - #print "\t", "[%s]" % value - #- Try to find the value from the vox file in the translation file + #- Try to find the value from the source file in the translation file found = [line for line in transgood if value in line] if found: if DEBUG: print "\t", "[%s] FOUND --" % value, found[0].split("=")[0] else: - #notfound.append("-->\t[%s] ==== TRANSLATION NOT FOUND ====" % value) notfound.append("-->\t[%s] ==== Not Found ====" % value) if notfound: if not DEBUG:print pathname From 90b7ce7ec301120979e64a48aaa0ac0c6f704553 Mon Sep 17 00:00:00 2001 From: Luc Charland Date: Thu, 30 Jul 2015 10:37:36 -0400 Subject: [PATCH 3/5] fixed Appointments path --- Scripts/verify_translations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scripts/verify_translations.py b/Scripts/verify_translations.py index fdf24fe48..f5ca644f1 100755 --- a/Scripts/verify_translations.py +++ b/Scripts/verify_translations.py @@ -8,7 +8,7 @@ DEBUG=False dir_mappings = {"../UI/Templates":"../UI/Common", "../UI/Templates/AdministrationUI":"../UI/AdministrationUI", - "../UI/Templates/Appointments":"../UI/Common", + "../UI/Templates/Appointments":"../SoObjects/Appointments", "../UI/Templates/ContactsUI":"../UI/Contacts", "../UI/Templates/MailerUI":"../UI/MailerUI", "../UI/Templates/MailPartViewers":"../UI/MailPartViewers", From 2f8f8c78f78ee2581bb994f98bc2daddfbe9d508 Mon Sep 17 00:00:00 2001 From: Luc Charland Date: Fri, 31 Jul 2015 13:54:03 -0400 Subject: [PATCH 4/5] Removing colons --- Scripts/verify_translations.py | 24 +++--- .../Arabic.lproj/Localizable.strings | 14 ++-- .../Basque.lproj/Localizable.strings | 12 +-- .../Localizable.strings | 14 ++-- .../Catalan.lproj/Localizable.strings | 14 ++-- .../ChineseTaiwan.lproj/Localizable.strings | 14 ++-- .../Czech.lproj/Localizable.strings | 14 ++-- .../Danish.lproj/Localizable.strings | 14 ++-- .../Dutch.lproj/Localizable.strings | 14 ++-- .../English.lproj/Localizable.strings | 14 ++-- .../Finnish.lproj/Localizable.strings | 14 ++-- .../French.lproj/Localizable.strings | 14 ++-- .../German.lproj/Localizable.strings | 14 ++-- .../Hungarian.lproj/Localizable.strings | 14 ++-- .../Icelandic.lproj/Localizable.strings | 6 +- .../Italian.lproj/Localizable.strings | 6 +- .../NorwegianBokmal.lproj/Localizable.strings | 14 ++-- .../Localizable.strings | 6 +- .../Polish.lproj/Localizable.strings | 14 ++-- .../Russian.lproj/Localizable.strings | 14 ++-- .../Slovak.lproj/Localizable.strings | 14 ++-- .../Slovenian.lproj/Localizable.strings | 14 ++-- .../Localizable.strings | 14 ++-- .../SpanishSpain.lproj/Localizable.strings | 14 ++-- .../Swedish.lproj/Localizable.strings | 6 +- .../Ukrainian.lproj/Localizable.strings | 6 +- .../Welsh.lproj/Localizable.strings | 6 +- UI/Contacts/Arabic.lproj/Localizable.strings | 26 +++---- UI/Contacts/Basque.lproj/Localizable.strings | 26 +++---- .../Localizable.strings | 26 +++---- UI/Contacts/Catalan.lproj/Localizable.strings | 26 +++---- .../ChineseTaiwan.lproj/Localizable.strings | 26 +++---- UI/Contacts/Czech.lproj/Localizable.strings | 26 +++---- UI/Contacts/Danish.lproj/Localizable.strings | 26 +++---- UI/Contacts/Dutch.lproj/Localizable.strings | 26 +++---- UI/Contacts/English.lproj/Localizable.strings | 26 +++---- UI/Contacts/Finnish.lproj/Localizable.strings | 26 +++---- UI/Contacts/French.lproj/Localizable.strings | 26 +++---- UI/Contacts/German.lproj/Localizable.strings | 26 +++---- .../Hungarian.lproj/Localizable.strings | 26 +++---- .../Icelandic.lproj/Localizable.strings | 26 +++---- UI/Contacts/Italian.lproj/Localizable.strings | 26 +++---- .../NorwegianBokmal.lproj/Localizable.strings | 26 +++---- .../Localizable.strings | 26 +++---- UI/Contacts/Polish.lproj/Localizable.strings | 26 +++---- UI/Contacts/Russian.lproj/Localizable.strings | 26 +++---- UI/Contacts/Slovak.lproj/Localizable.strings | 26 +++---- .../Slovenian.lproj/Localizable.strings | 26 +++---- .../Localizable.strings | 26 +++---- .../SpanishSpain.lproj/Localizable.strings | 26 +++---- UI/Contacts/Swedish.lproj/Localizable.strings | 26 +++---- .../Ukrainian.lproj/Localizable.strings | 26 +++---- UI/Contacts/Welsh.lproj/Localizable.strings | 22 +++--- UI/MailerUI/Arabic.lproj/Localizable.strings | 4 +- UI/MailerUI/Basque.lproj/Localizable.strings | 6 +- .../Localizable.strings | 6 +- UI/MailerUI/Catalan.lproj/Localizable.strings | 4 +- .../ChineseTaiwan.lproj/Localizable.strings | 6 +- UI/MailerUI/Czech.lproj/Localizable.strings | 6 +- UI/MailerUI/Danish.lproj/Localizable.strings | 4 +- UI/MailerUI/Dutch.lproj/Localizable.strings | 6 +- UI/MailerUI/English.lproj/Localizable.strings | 6 +- UI/MailerUI/Finnish.lproj/Localizable.strings | 6 +- UI/MailerUI/French.lproj/Localizable.strings | 6 +- UI/MailerUI/German.lproj/Localizable.strings | 6 +- .../Hungarian.lproj/Localizable.strings | 6 +- .../Icelandic.lproj/Localizable.strings | 4 +- UI/MailerUI/Italian.lproj/Localizable.strings | 4 +- .../NorwegianBokmal.lproj/Localizable.strings | 6 +- .../Localizable.strings | 4 +- UI/MailerUI/Polish.lproj/Localizable.strings | 6 +- UI/MailerUI/Russian.lproj/Localizable.strings | 6 +- UI/MailerUI/Slovak.lproj/Localizable.strings | 4 +- .../Slovenian.lproj/Localizable.strings | 6 +- .../Localizable.strings | 6 +- .../SpanishSpain.lproj/Localizable.strings | 6 +- UI/MailerUI/Swedish.lproj/Localizable.strings | 4 +- .../Ukrainian.lproj/Localizable.strings | 4 +- UI/MailerUI/Welsh.lproj/Localizable.strings | 4 +- UI/MainUI/Arabic.lproj/Localizable.strings | 8 +- UI/MainUI/Basque.lproj/Localizable.strings | 8 +- .../Localizable.strings | 8 +- UI/MainUI/Catalan.lproj/Localizable.strings | 8 +- .../ChineseTaiwan.lproj/Localizable.strings | 8 +- UI/MainUI/Czech.lproj/Localizable.strings | 8 +- UI/MainUI/Danish.lproj/Localizable.strings | 8 +- UI/MainUI/Dutch.lproj/Localizable.strings | 8 +- UI/MainUI/English.lproj/Localizable.strings | 8 +- UI/MainUI/Finnish.lproj/Localizable.strings | 8 +- UI/MainUI/French.lproj/Localizable.strings | 8 +- UI/MainUI/German.lproj/Localizable.strings | 8 +- UI/MainUI/Hungarian.lproj/Localizable.strings | 8 +- UI/MainUI/Icelandic.lproj/Localizable.strings | 8 +- UI/MainUI/Italian.lproj/Localizable.strings | 8 +- .../NorwegianBokmal.lproj/Localizable.strings | 8 +- .../Localizable.strings | 8 +- UI/MainUI/Polish.lproj/Localizable.strings | 8 +- UI/MainUI/Russian.lproj/Localizable.strings | 8 +- UI/MainUI/Slovak.lproj/Localizable.strings | 8 +- UI/MainUI/Slovenian.lproj/Localizable.strings | 8 +- .../Localizable.strings | 8 +- .../SpanishSpain.lproj/Localizable.strings | 8 +- UI/MainUI/Swedish.lproj/Localizable.strings | 8 +- UI/MainUI/Ukrainian.lproj/Localizable.strings | 8 +- UI/MainUI/Welsh.lproj/Localizable.strings | 8 +- .../Arabic.lproj/Localizable.strings | 68 ++++++++--------- .../Basque.lproj/Localizable.strings | 74 +++++++++---------- .../Localizable.strings | 74 +++++++++---------- .../Catalan.lproj/Localizable.strings | 72 +++++++++--------- .../ChineseTaiwan.lproj/Localizable.strings | 74 +++++++++---------- .../Czech.lproj/Localizable.strings | 74 +++++++++---------- .../Danish.lproj/Localizable.strings | 70 +++++++++--------- .../Dutch.lproj/Localizable.strings | 74 +++++++++---------- .../English.lproj/Localizable.strings | 74 +++++++++---------- .../Finnish.lproj/Localizable.strings | 74 +++++++++---------- .../French.lproj/Localizable.strings | 74 +++++++++---------- .../German.lproj/Localizable.strings | 74 +++++++++---------- .../Hungarian.lproj/Localizable.strings | 74 +++++++++---------- .../Icelandic.lproj/Localizable.strings | 68 ++++++++--------- .../Italian.lproj/Localizable.strings | 64 ++++++++-------- .../NorwegianBokmal.lproj/Localizable.strings | 74 +++++++++---------- .../Localizable.strings | 74 +++++++++---------- .../Polish.lproj/Localizable.strings | 74 +++++++++---------- .../Russian.lproj/Localizable.strings | 74 +++++++++---------- .../Slovak.lproj/Localizable.strings | 70 +++++++++--------- .../Slovenian.lproj/Localizable.strings | 74 +++++++++---------- .../Localizable.strings | 74 +++++++++---------- .../SpanishSpain.lproj/Localizable.strings | 74 +++++++++---------- .../Swedish.lproj/Localizable.strings | 74 +++++++++---------- .../Ukrainian.lproj/Localizable.strings | 72 +++++++++--------- .../Welsh.lproj/Localizable.strings | 74 +++++++++---------- UI/Scheduler/Arabic.lproj/Localizable.strings | 42 +++++------ UI/Scheduler/Basque.lproj/Localizable.strings | 56 +++++++------- .../Localizable.strings | 50 ++++++------- .../Catalan.lproj/Localizable.strings | 52 ++++++------- .../ChineseTaiwan.lproj/Localizable.strings | 52 ++++++------- UI/Scheduler/Czech.lproj/Localizable.strings | 50 ++++++------- UI/Scheduler/Danish.lproj/Localizable.strings | 42 +++++------ UI/Scheduler/Dutch.lproj/Localizable.strings | 50 ++++++------- .../English.lproj/Localizable.strings | 50 ++++++------- .../Finnish.lproj/Localizable.strings | 50 ++++++------- UI/Scheduler/French.lproj/Localizable.strings | 50 ++++++------- UI/Scheduler/German.lproj/Localizable.strings | 50 ++++++------- .../Hungarian.lproj/Localizable.strings | 52 ++++++------- .../Icelandic.lproj/Localizable.strings | 40 +++++----- .../Italian.lproj/Localizable.strings | 42 +++++------ .../NorwegianBokmal.lproj/Localizable.strings | 50 ++++++------- .../Localizable.strings | 40 +++++----- UI/Scheduler/Polish.lproj/Localizable.strings | 50 ++++++------- .../Russian.lproj/Localizable.strings | 50 ++++++------- UI/Scheduler/Slovak.lproj/Localizable.strings | 50 ++++++------- .../Slovenian.lproj/Localizable.strings | 50 ++++++------- .../Localizable.strings | 52 ++++++------- .../SpanishSpain.lproj/Localizable.strings | 52 ++++++------- .../Swedish.lproj/Localizable.strings | 40 +++++----- .../Ukrainian.lproj/Localizable.strings | 40 +++++----- UI/Scheduler/Welsh.lproj/Localizable.strings | 40 +++++----- .../Appointments/SOGoAptMailReceipt.wox | 6 +- .../ContactsUI/UIxContactEditorTemplate.wox | 2 +- .../UIxContactFolderLinksTemplate.wox | 4 +- UI/Templates/ContactsUI/UIxListEditor.wox | 6 +- UI/Templates/MailerUI/UIxMailMainFrame.wox | 2 +- UI/Templates/MailerUI/UIxMailSearch.wox | 2 +- UI/Templates/MainUI/SOGoRootPage.wox | 8 +- .../PreferencesUI/UIxAccountEditor.wox | 28 +++---- UI/Templates/PreferencesUI/UIxPreferences.wox | 54 +++++++------- .../SchedulerUI/UIxAppointmentEditor.wox | 14 ++-- .../UIxAppointmentEditorTemplate.wox | 4 +- .../UIxAppointmentViewTemplate.wox | 6 +- .../SchedulerUI/UIxCalFilterPanel.wox | 2 +- UI/Templates/SchedulerUI/UIxCalMainView.wox | 6 +- UI/Templates/SchedulerUI/UIxCalViewPrint.wox | 8 +- .../UIxCalendarFolderLinksTemplate.wox | 4 +- .../SchedulerUI/UIxComponentEditor.wox | 50 ++++++------- UI/Templates/SchedulerUI/UIxTaskEditor.wox | 12 +-- .../SchedulerUI/UIxTaskEditorTemplate.wox | 4 +- .../SchedulerUI/UIxTaskViewTemplate.wox | 4 +- UI/WebServerResources/angular-material | 2 +- 178 files changed, 2360 insertions(+), 2354 deletions(-) diff --git a/Scripts/verify_translations.py b/Scripts/verify_translations.py index f5ca644f1..cf06585b7 100755 --- a/Scripts/verify_translations.py +++ b/Scripts/verify_translations.py @@ -21,11 +21,12 @@ def get_translations(path): try: transpath = dir_mappings.get(path, path) transname = transpath + '/English.lproj/Localizable.strings' - transall = open(transname).read().split('\n') - transgood = [l.strip() for l in transall if len(l.strip()) and l.strip()[0] != '#'] + #transall = open(transname).read().split('\n') + #transgood = [l.strip() for l in transall if len(l.strip()) and l.strip()[0] != '#'] + transall = open(transname).read() except: - transgood = () - return transgood + transall = "" + return transall def find_missing_translations(rootdir='.', extention='', recomp=None, greylist=()): @@ -38,8 +39,7 @@ def find_missing_translations(rootdir='.', extention='', recomp=None, greylist=( continue pathname = path + '/' + filename lines = open(pathname).read().split("\n") - regex_results = [recomp.search(l) for l in lines] - values = [r.groups()[0] for r in regex_results if r] + values = [r.groups()[0] for r in [recomp.search(l) for l in lines] if r] if values: #- Get the current english translations for the path transgood = get_translations(path) @@ -50,9 +50,15 @@ def find_missing_translations(rootdir='.', extention='', recomp=None, greylist=( if DEBUG:print pathname for value in values: #- Try to find the value from the source file in the translation file - found = [line for line in transgood if value in line] + #compvalue = re.compile('"(%s)"\s=\s"(.*?)";' % value) + escaped_value = re.escape(value) + found = re.search('(%s|"%s")\s*=\s*"(.*?)";' % (escaped_value, escaped_value), transgood) + #for line in transgood: + # found = compvalue.search(line) + # if found: + # break if found: - if DEBUG: print "\t", "[%s] FOUND --" % value, found[0].split("=")[0] + if DEBUG: print "\t", '[%s] FOUND -- "%s"' % found.groups() else: notfound.append("-->\t[%s] ==== Not Found ====" % value) if notfound: @@ -73,7 +79,7 @@ def main(): greylist = ('UIxFilterEditor.wox') #- Get only the label:value from all lines - recomp = re.compile(' + label:value="The following attendees(s) were notified" const:escapeHTML="NO"/> @@ -54,7 +54,7 @@ th, td { font-family: Lucida Grande, Bitstream VeraSans, Tahoma, sans-serif; fon > + label:value="The following attendees(s) were added" const:escapeHTML="NO"/> @@ -67,7 +67,7 @@ th, td { font-family: Lucida Grande, Bitstream VeraSans, Tahoma, sans-serif; fon > + label:value="The following attendees(s) were removed" const:escapeHTML="NO"/> diff --git a/UI/Templates/ContactsUI/UIxContactEditorTemplate.wox b/UI/Templates/ContactsUI/UIxContactEditorTemplate.wox index ff35ff34c..743e0e3bd 100644 --- a/UI/Templates/ContactsUI/UIxContactEditorTemplate.wox +++ b/UI/Templates/ContactsUI/UIxContactEditorTemplate.wox @@ -312,7 +312,7 @@
- +
@@ -31,7 +31,7 @@
- +
diff --git a/UI/Templates/ContactsUI/UIxListEditor.wox b/UI/Templates/ContactsUI/UIxListEditor.wox index d82e9cc89..7f30d24cd 100644 --- a/UI/Templates/ContactsUI/UIxListEditor.wox +++ b/UI/Templates/ContactsUI/UIxListEditor.wox @@ -20,13 +20,13 @@
- +
- + - +
diff --git a/UI/Templates/MailerUI/UIxMailMainFrame.wox b/UI/Templates/MailerUI/UIxMailMainFrame.wox index 1f9af989b..86c389fc5 100644 --- a/UI/Templates/MailerUI/UIxMailMainFrame.wox +++ b/UI/Templates/MailerUI/UIxMailMainFrame.wox @@ -265,7 +265,7 @@ - + {{warning}}
@@ -81,7 +81,7 @@
@@ -97,7 +97,7 @@
diff --git a/UI/Templates/PreferencesUI/UIxAccountEditor.wox b/UI/Templates/PreferencesUI/UIxAccountEditor.wox index 37766329a..014cdd635 100644 --- a/UI/Templates/PreferencesUI/UIxAccountEditor.wox +++ b/UI/Templates/PreferencesUI/UIxAccountEditor.wox @@ -15,24 +15,24 @@ - + - + - + - + @@ -40,50 +40,50 @@ - + - + - + - + - + - + - +