Created
February 14, 2017 17:40
-
-
Save notz/0fac9383687f8215b2b3edec1206caa0 to your computer and use it in GitHub Desktop.
Merges iOS fallback strings for not translated strings (jenkins build step)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python3.5 | |
# -*- coding: utf-8 -*- | |
from nslocalized import StringTable | |
import glob | |
import re | |
def merge(source, destination): | |
try: | |
st = StringTable.read(source) | |
try: | |
st.read(destination) | |
except: | |
print("unable to load destination file: ", destination) | |
st.write(destination) | |
except: | |
print("unable to load source file: ", source) | |
for filename in glob.iglob('**/*.strings', recursive=True): | |
if not re.match('.*\/en\.lproj\/.*', filename): | |
merge(re.sub(r"\/\w+\.lproj\/", "/en.lproj/", filename), filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment