rebuild script to better support multiple options and simplify

This commit is contained in:
Ben Fry
2022-11-25 08:45:13 -05:00
parent c22d3abe31
commit 84aa7f9201
3 changed files with 13 additions and 35 deletions
+13 -12
View File
@@ -2,25 +2,26 @@
import os, re
BASEDIR = os.path.dirname(os.path.realpath(__file__))
HERE = os.path.dirname(os.path.realpath(__file__))
def supported_languages():
path = "../../build/shared/lib/languages/languages.txt"
with open(os.path.join(BASEDIR, path)) as f:
lines = f.read().splitlines()
outgoing = set()
translations_path = os.path.join(HERE, '../shared/lib/languages')
with os.scandir(translations_path) as it:
for entry in it:
if entry.name.startswith('PDE_') and entry.name.endswith('.properties'):
outgoing.add(entry.name[4:-11])
return outgoing
lines = filter(lambda l: re.match(r'^[a-z]{2}', l), lines)
lines = map(lambda l: re.sub(r'#.*', '', l).strip(), lines)
return lines
def lproj_directory(lang):
path = "work/Processing.app/Contents/Resources/{}.lproj".format(lang)
return os.path.join(BASEDIR, path)
return os.path.join(HERE, path)
if __name__ == "__main__":
for lang in supported_languages():
try:
os.mkdir(lproj_directory(lang))
except OSError:
pass
path = lproj_directory(lang)
if not os.path.exists(path):
os.makedirs(path)
-23
View File
@@ -1,23 +0,0 @@
# List of supported language codes
# http://en.wikipedia.org/wiki/ISO_639-1
# http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
# Add new languages in alphabetical order to (slightly)
# reduce the risk of merge conflicts
ar # Arabic
ca # Catalan
de # German, Deutsch
el # Greek
en # English, English
es # Spanish
fr # French, Français, Langue française
it # Italiano, Italian
ja # Japanese
ko # Korean
nl # Dutch, Nederlands
pt # Portuguese
ru # Russian
tr # Turkish
uk # Ukrainian
zh # Chinese