From 727c4ca138fa278fdcdc67561a211af8971fb747 Mon Sep 17 00:00:00 2001 From: mike Date: Mon, 14 Dec 2009 07:43:16 +0000 Subject: Another Rogue Commit : Vault : Supporting sharing of translation --- 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) -- cgit v0.9.1