Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #329 from mozilla/st3fan/Bug1136220ImportLocales
Bug 1136220 - Import localizations from the shared SVN repository
- Loading branch information
Showing
6 changed files
with
1,886 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env python | ||
|
||
# | ||
# xliff-export.py xcodeproj-path l10n-path | ||
# | ||
# Export all locales that are present in the l10n directory. We use xcodebuild | ||
# to export and write to l10n-directory/$locale/firefox-ios.xliff so that it | ||
# can be easily imported into svn. (which is a manual step) | ||
# | ||
# Example: | ||
# | ||
# cd firefox-ios | ||
# ./xliff-export.py Client.xcodeproj ../firefox-ios-l10n | ||
# | ||
|
||
import glob | ||
import os | ||
import shutil | ||
import subprocess | ||
import sys | ||
|
||
LOCALES_TO_SKIP = ['pl'] | ||
|
||
def available_locales(l10n_path): | ||
for xliff_path in glob.glob(l10n_path + "/*/firefox-ios.xliff"): | ||
parts = xliff_path.split(os.sep) | ||
yield parts[-2] | ||
|
||
if __name__ == "__main__": | ||
project_path = sys.argv[1] | ||
l10n_path = sys.argv[2] | ||
|
||
for locale in available_locales(l10n_path): | ||
if locale in LOCALES_TO_SKIP: | ||
continue | ||
command = [ | ||
"xcodebuild", | ||
"-exportLocalizations", | ||
"-localizationPath", "/tmp/xliff", | ||
"-project", project_path, | ||
"-exportLanguage", locale | ||
] | ||
|
||
print "Exporting '%s' to '/tmp/xliff/%s.xliff'" % (locale, locale) | ||
subprocess.call(command) | ||
|
||
src_path = "/tmp/xliff/%s.xliff" % locale | ||
dst_path = "%s/%s/firefox-ios.xliff" % (l10n_path, locale) | ||
print "Copying '%s' to '%s'" % (src_path, dst_path) | ||
shutil.copy(src_path, dst_path) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
scripts/xliff-cleanup.py ../firefox-ios-l10n/*/*.xliff | ||
|
||
rm -rf imported-locales | ||
mkdir imported-locales | ||
|
||
scripts/xliff-to-strings.py ../firefox-ios-l10n imported-locales | ||
|
||
scripts/strings-import.py Client.xcodeproj imported-locales | ||
|
Oops, something went wrong.