diff options
author | mike <michael.jmontcalm@gmail.com> | 2009-12-14 07:43:16 (GMT) |
---|---|---|
committer | mike <michael.jmontcalm@gmail.com> | 2009-12-14 07:43:16 (GMT) |
commit | 727c4ca138fa278fdcdc67561a211af8971fb747 (patch) | |
tree | 3dd3298eec1a7cae7ca42852b2ee153c3a2baf61 | |
parent | 1b539adbe010a63d113a2fac6a2b96ff2621a6c0 (diff) |
Another Rogue Commit : Vault : Supporting sharing of translation
-rw-r--r-- | tutorius/vault.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tutorius/vault.py b/tutorius/vault.py index ff4ef0b..15c7e17 100644 --- a/tutorius/vault.py +++ b/tutorius/vault.py @@ -438,15 +438,28 @@ class Vault(object): for root, dirs, files in os.walk(os.path.join(bundle_path, RESOURCES_FOLDER)): for name in files: archive_list.append(os.path.join(bundle_path, RESOURCES_FOLDER, name)) + + logger.debug("Vault :: Looking for translation .mo files...") + + for root, dirs, files in os.walk(os.path.join(bundle_path, LOCALIZATION_FOLDER)): + logger.debug("Vault :: Inspecting files %s at root %s", str(files), root) + for name in files: + if name == "tutorial_text.mo": + fname_splitted = root.rsplit('/') + archive_list.append(os.path.join(bundle_path, LOCALIZATION_FOLDER, fname_splitted[-2], fname_splitted[-1], name)) zfilename = str(guid) + ".zip" zout = zipfile.ZipFile(os.path.join(bundle_path, zfilename), "w") for fname in archive_list: + logger.debug("Vault :: zipping file %s"%fname) fname_splitted = fname.rsplit('/') if fname_splitted[-2] == RESOURCES_FOLDER: ressource_path_and_file = os.path.join(fname_splitted[-2], fname_splitted[-1]) zout.write(fname, ressource_path_and_file) + elif len(fname_splitted) >= 4 and fname_splitted[-4] == LOCALIZATION_FOLDER: + translation_path_and_file = os.path.join(*fname_splitted[-4:]) + zout.write(fname, translation_path_and_file) else: file_only_name = fname_splitted[-1] zout.write(fname, file_only_name) |