예제 #1
0
 def _get_screenshot_dict(self):
     from . import Screenshot
     localized = dict()
     screenshots = Screenshot.objects.filter(app=self).all()
     for s in screenshots:
         # upper-case region part of language code for compatibility
         language_code = to_universal_language_code(s.language_code)
         if language_code not in localized:
             localized[language_code] = dict()
         if s.type not in localized[language_code]:
             localized[language_code][s.type] = []
         localized[language_code][s.type].append(
             os.path.basename(s.file.name))
     return localized
예제 #2
0
 def _add_translations_to_localized(self, localized):
     for original_language_code in self.get_available_languages():
         # upper-case region part of language code for compatibility
         language_code = to_universal_language_code(original_language_code)
         if language_code not in localized:
             localized[language_code] = dict()
         app = self.get_translation(original_language_code)
         if app.summary:
             localized[language_code]['summary'] = app.summary
         if app.description:
             localized[language_code]['description'] = app.description
         if app.feature_graphic:
             localized[language_code]['featureGraphic'] = os.path.basename(
                 app.feature_graphic.name)
         if app.high_res_icon:
             localized[language_code]['icon'] = os.path.basename(
                 app.high_res_icon.name)
         if app.tv_banner:
             localized[language_code]['tvBanner'] = os.path.basename(
                 app.tv_banner.name)
         if localized[language_code] == {}:
             # remove empty translation
             del localized[language_code]
예제 #3
0
def get_graphic_asset_file_path(app_translation, filename):
    app = app_translation.master
    language_code = to_universal_language_code(app_translation.language_code)
    path = os.path.join(get_repo_path(app.repo), app.package_id, language_code)
    return os.path.join(path, filename)
예제 #4
0
 def get_relative_path(self):
     language_code = to_universal_language_code(self.language_code)
     return os.path.join(self.app.package_id, language_code, self.type)