summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-04-25 19:43:29 (GMT)
committerTobias Markmann <tm@ayena.de>2016-04-25 19:43:29 (GMT)
commit857791adda753a0f94da8317bbc019378b1f09bd (patch)
tree96aa2e4d863d50888a16527f9fbb38712e97d8ee /BuildTools/CheckTranslations.py
parentb58ad7f4b01623a8807b8c268208bd9c8496f4e2 (diff)
downloadswift-857791adda753a0f94da8317bbc019378b1f09bd.zip
swift-857791adda753a0f94da8317bbc019378b1f09bd.tar.bz2
Convert hard tabs to four spaces in all our SConscript/*.py files
Test-Information: Test that it still builds and unit test pass on OS X 10.11.4. Change-Id: I2eb4a0b707991aee553db36a8cd1ae28b813acab
Diffstat (limited to 'BuildTools/CheckTranslations.py')
-rwxr-xr-xBuildTools/CheckTranslations.py70
1 files changed, 35 insertions, 35 deletions
diff --git a/BuildTools/CheckTranslations.py b/BuildTools/CheckTranslations.py
index a9b6afd..615f81f 100755
--- a/BuildTools/CheckTranslations.py
+++ b/BuildTools/CheckTranslations.py
@@ -3,48 +3,48 @@
import os, sys, re, xml.dom.minidom
def getText(nodelist):
- text = ""
- for node in nodelist:
- if node.nodeType == node.TEXT_NODE:
- text += node.data
- return text
+ text = ""
+ for node in nodelist:
+ if node.nodeType == node.TEXT_NODE:
+ text += node.data
+ return text
desktop_generic_names = set()
desktop_comments = set()
f = open("Swift/resources/swift.desktop", "r")
for l in f.readlines() :
- m = re.match("GenericName\[(\w+)\].*", l)
- if m :
- desktop_generic_names.add(m.group(1))
- m = re.match("Comment\[(\w+)\].*", l)
- if m :
- desktop_comments.add(m.group(1))
+ m = re.match("GenericName\[(\w+)\].*", l)
+ if m :
+ desktop_generic_names.add(m.group(1))
+ m = re.match("Comment\[(\w+)\].*", l)
+ if m :
+ desktop_comments.add(m.group(1))
f.close()
for filename in os.listdir("Swift/Translations") :
- m = re.match("swift_(.*)\.ts", filename)
- if m :
- language = m.group(1)
- finished = True
- f = open("Swift/Translations/" + filename, "r")
- document = xml.dom.minidom.parse(f)
- f.close()
+ m = re.match("swift_(.*)\.ts", filename)
+ if m :
+ language = m.group(1)
+ finished = True
+ f = open("Swift/Translations/" + filename, "r")
+ document = xml.dom.minidom.parse(f)
+ f.close()
- for message in document.getElementsByTagName("message") :
- source = message.getElementsByTagName("source")[0]
- sourceText = getText(source.childNodes)
- sourcePlaceholders = set(re.findall("%\d+%?", sourceText))
- translation = message.getElementsByTagName("translation")[0]
- if "type" in translation.attributes.keys() and translation.attributes["type"]. value == "unfinished" :
- finished = False
- translationText = getText(translation.childNodes)
- translationPlaceholders = set(re.findall("%\d+%?", translationText))
- if translationPlaceholders != sourcePlaceholders :
- print "[Error] " + filename + ": Placeholder mismatch in translation '" + sourceText + "'"
- if not finished :
- print "[Warning] " + filename + ": Unfinished"
- if language not in desktop_generic_names and language != "en" :
- print "[Warning] GenericName field missing in desktop entry for " + language
- if language not in desktop_comments and language != "en" :
- print "[Warning] Comment field missing in desktop entry for " + language
+ for message in document.getElementsByTagName("message") :
+ source = message.getElementsByTagName("source")[0]
+ sourceText = getText(source.childNodes)
+ sourcePlaceholders = set(re.findall("%\d+%?", sourceText))
+ translation = message.getElementsByTagName("translation")[0]
+ if "type" in translation.attributes.keys() and translation.attributes["type"]. value == "unfinished" :
+ finished = False
+ translationText = getText(translation.childNodes)
+ translationPlaceholders = set(re.findall("%\d+%?", translationText))
+ if translationPlaceholders != sourcePlaceholders :
+ print "[Error] " + filename + ": Placeholder mismatch in translation '" + sourceText + "'"
+ if not finished :
+ print "[Warning] " + filename + ": Unfinished"
+ if language not in desktop_generic_names and language != "en" :
+ print "[Warning] GenericName field missing in desktop entry for " + language
+ if language not in desktop_comments and language != "en" :
+ print "[Warning] Comment field missing in desktop entry for " + language