cleaned up a few comments
This commit is contained in:
parent
82aca2cfe5
commit
22ce38808a
|
@ -4,7 +4,6 @@ import sys
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
DEBUG=True
|
|
||||||
DEBUG=False
|
DEBUG=False
|
||||||
|
|
||||||
dir_mappings = {"../UI/Templates":"../UI/Common",
|
dir_mappings = {"../UI/Templates":"../UI/Common",
|
||||||
|
@ -21,7 +20,6 @@ dir_mappings = {"../UI/Templates":"../UI/Common",
|
||||||
def get_translations(path):
|
def get_translations(path):
|
||||||
try:
|
try:
|
||||||
transpath = dir_mappings.get(path, path)
|
transpath = dir_mappings.get(path, path)
|
||||||
#print "Transpath:", transpath
|
|
||||||
transname = transpath + '/English.lproj/Localizable.strings'
|
transname = transpath + '/English.lproj/Localizable.strings'
|
||||||
transall = open(transname).read().split('\n')
|
transall = open(transname).read().split('\n')
|
||||||
transgood = [l.strip() for l in transall if len(l.strip()) and l.strip()[0] != '#']
|
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=()):
|
def find_missing_translations(rootdir='.', extention='', recomp=None, greylist=()):
|
||||||
for path, dirs, files in os.walk(rootdir):
|
for path, dirs, files in os.walk(rootdir):
|
||||||
#print path, files
|
|
||||||
filelist = [f for f in files if f[(-1 * len(extention)):] == extention]
|
filelist = [f for f in files if f[(-1 * len(extention)):] == extention]
|
||||||
if filelist:
|
if filelist:
|
||||||
for filename in filelist:
|
for filename in filelist:
|
||||||
|
@ -43,7 +40,6 @@ def find_missing_translations(rootdir='.', extention='', recomp=None, greylist=(
|
||||||
lines = open(pathname).read().split("\n")
|
lines = open(pathname).read().split("\n")
|
||||||
regex_results = [recomp.search(l) for l in lines]
|
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 regex_results if r]
|
||||||
#print pathname, values
|
|
||||||
if values:
|
if values:
|
||||||
#- Get the current english translations for the path
|
#- Get the current english translations for the path
|
||||||
transgood = get_translations(path)
|
transgood = get_translations(path)
|
||||||
|
@ -52,15 +48,12 @@ def find_missing_translations(rootdir='.', extention='', recomp=None, greylist=(
|
||||||
continue
|
continue
|
||||||
notfound = list()
|
notfound = list()
|
||||||
if DEBUG:print pathname
|
if DEBUG:print pathname
|
||||||
#- Only 'good' lines (not empty, not comment)
|
|
||||||
for value in values:
|
for value in values:
|
||||||
#print "\t", "[%s]" % value
|
#- Try to find the value from the source file in the translation file
|
||||||
#- Try to find the value from the vox file in the translation file
|
|
||||||
found = [line for line in transgood if value in line]
|
found = [line for line in transgood if value in line]
|
||||||
if found:
|
if found:
|
||||||
if DEBUG: print "\t", "[%s] FOUND --" % value, found[0].split("=")[0]
|
if DEBUG: print "\t", "[%s] FOUND --" % value, found[0].split("=")[0]
|
||||||
else:
|
else:
|
||||||
#notfound.append("-->\t[%s] ==== TRANSLATION NOT FOUND ====" % value)
|
|
||||||
notfound.append("-->\t[%s] ==== Not Found ====" % value)
|
notfound.append("-->\t[%s] ==== Not Found ====" % value)
|
||||||
if notfound:
|
if notfound:
|
||||||
if not DEBUG:print pathname
|
if not DEBUG:print pathname
|
||||||
|
|
Loading…
Reference in a new issue