Skip to content

Instantly share code, notes, and snippets.

@amitkot
Created July 7, 2014 06:57
Show Gist options
  • Save amitkot/3316ef8b0691c73efb74 to your computer and use it in GitHub Desktop.
Save amitkot/3316ef8b0691c73efb74 to your computer and use it in GitHub Desktop.
""" Creating localization directories in an Andorid project
The script creates the required directories and copies the default strings.xml
file to each of them.
Those xml files can later be editted.
"""
from path import path
VALUES = "values"
languages = ["ar", "fr", "de", "gr", "he", "it", "jp", "kr", "pt", "ru",
"es", "sv", "tr", "cn", ]
val_file = path("values/strings.xml")
for lang in languages:
lang_dir = path(VALUES + '-' + lang)
try:
lang_dir.mkdir()
print "created ", lang_dir
except:
pass
try:
path.copy(val_file, lang_dir)
print "copied ", val_file, "to", lang_dir
except Exception, e:
raise e
print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment