def lang_sel(request,langid,idx): """ Selects a file to be translated """ if langid not in [l[0] for l in settings.LANGUAGES]: raise Http404 else: do_django = 'django' in request.GET do_rosetta = 'rosetta' in request.GET file_ = find_pos(langid,include_djangos=do_django,include_rosetta=do_rosetta)[int(idx)] request.session['rosetta_i18n_lang_code'] = langid request.session['rosetta_i18n_lang_name'] = unicode([l[1] for l in settings.LANGUAGES if l[0] == langid][0]) request.session['rosetta_i18n_fn'] = file_ po = pofile(file_) for i in range(len(po)): po[i].id = i request.session['rosetta_i18n_pofile'] = po try: os.utime(file_,None) request.session['rosetta_i18n_write'] = True except OSError: request.session['rosetta_i18n_write'] = False return HttpResponseRedirect(reverse('rosetta-home'))
def lang_sel(request, langid, idx): """ Selects a file to be translated """ storage = get_storage(request) if langid not in [l[0] for l in settings.LANGUAGES]: raise Http404 else: rosetta_i18n_catalog_filter = storage.get('rosetta_i18n_catalog_filter', 'project') third_party_apps = rosetta_i18n_catalog_filter in ('all', 'third-party') django_apps = rosetta_i18n_catalog_filter in ('all', 'django') project_apps = rosetta_i18n_catalog_filter in ('all', 'project') file_ = sorted(find_pos(langid, project_apps=project_apps, django_apps=django_apps, third_party_apps=third_party_apps), key=get_app_name)[int(idx)] storage.set('rosetta_i18n_lang_code', langid) storage.set('rosetta_i18n_lang_name', six.text_type([l[1] for l in settings.LANGUAGES if l[0] == langid][0])) storage.set('rosetta_i18n_fn', file_) po = pofile(file_) for entry in po: entry.md5hash = hashlib.new('md5', (six.text_type(entry.msgid) + six.text_type(entry.msgstr) + six.text_type(entry.msgctxt or "")).encode('utf8') ).hexdigest() storage.set('rosetta_i18n_pofile', po) try: os.utime(file_, None) storage.set('rosetta_i18n_write', True) except OSError: storage.set('rosetta_i18n_write', False) return HttpResponseRedirect(reverse('rosetta-home'))
def get_context_data(self, **kwargs): context = super(TranslationFileListView, self).get_context_data(**kwargs) third_party_apps = self.po_filter in ('all', 'third-party') django_apps = self.po_filter in ('all', 'django') project_apps = self.po_filter in ('all', 'project') languages = [] has_pos = False for language in rosetta_settings.ROSETTA_LANGUAGES: if not can_translate_language(self.request.user, language[0]): continue po_paths = find_pos( language[0], project_apps=project_apps, django_apps=django_apps, third_party_apps=third_party_apps, ) po_files = [(get_app_name(l), os.path.realpath(l), pofile(l)) for l in po_paths] po_files.sort(key=lambda app: app[0]) languages.append((language[0], _(language[1]), po_files)) has_pos = has_pos or bool(po_paths) context['version'] = get_rosetta_version() context['languages1'] = languages context['has_pos'] = has_pos context['po_filter'] = self.po_filter return context
def lang_sel(request, langid, idx): """ Selects a file to be translated """ if langid not in [l[0] for l in settings.LANGUAGES]: raise Http404 else: rosetta_i18n_catalog_filter = request.session.get('rosetta_i18n_catalog_filter', 'project') third_party_apps = rosetta_i18n_catalog_filter in ('all', 'third-party') django_apps = rosetta_i18n_catalog_filter in ('all', 'django') project_apps = rosetta_i18n_catalog_filter in ('all', 'project') file_ = find_pos(langid, project_apps=project_apps, django_apps=django_apps, third_party_apps=third_party_apps)[int(idx)] request.session['rosetta_i18n_lang_code'] = langid request.session['rosetta_i18n_lang_name'] = unicode([l[1] for l in settings.LANGUAGES if l[0] == langid][0]) request.session['rosetta_i18n_fn'] = file_ po = pofile(file_) for entry in po: entry.md5hash = hashlib.md5(entry.msgid.encode("utf8") + entry.msgstr.encode("utf8")).hexdigest() request.session['rosetta_i18n_pofile'] = po try: os.utime(file_, None) request.session['rosetta_i18n_write'] = True except OSError: request.session['rosetta_i18n_write'] = False return HttpResponseRedirect(reverse('rosetta-home'))
def lang_sel(request,langid,idx): """ Selects a file to be translated """ if langid not in [l[0] for l in settings.LANGUAGES]: raise Http404 else: do_django = 'django' in request.GET do_rosetta = 'rosetta' in request.GET file_ = find_pos(langid,include_djangos=do_django,include_rosetta=do_rosetta)[int(idx)] request.session['rosetta_i18n_lang_code'] = langid request.session['rosetta_i18n_lang_name'] = unicode([l[1] for l in settings.LANGUAGES if l[0] == langid][0]) request.session['rosetta_i18n_fn'] = file_ po = pofile(file_) for entry in po: entry.md5hash = hashlib.md5(entry.msgid.encode("utf8")+entry.msgstr.encode("utf8")).hexdigest() request.session['rosetta_i18n_pofile'] = po try: os.utime(file_,None) request.session['rosetta_i18n_write'] = True except OSError: request.session['rosetta_i18n_write'] = False return HttpResponseRedirect(reverse('rosetta-home'))
def get_context_data(self, **kwargs): context = super(TranslationFileListView, self).get_context_data(**kwargs) third_party_apps = self.po_filter in ('all', 'third-party') django_apps = self.po_filter in ('all', 'django') project_apps = self.po_filter in ('all', 'project') languages = [] has_pos = False for language in settings.LANGUAGES: if not can_translate_language(self.request.user, language[0]): continue po_paths = find_pos(language[0], project_apps=project_apps, django_apps=django_apps, third_party_apps=third_party_apps, ) po_files = [(get_app_name(l), os.path.realpath(l), pofile(l)) for l in po_paths] po_files.sort(key=lambda app: app[0]) languages.append((language[0], _(language[1]), po_files)) has_pos = has_pos or bool(po_paths) try: ADMIN_MEDIA_PREFIX = settings.ADMIN_MEDIA_PREFIX except AttributeError: ADMIN_MEDIA_PREFIX = settings.STATIC_URL + 'admin/' context['version'] = get_rosetta_version(True) context['ADMIN_MEDIA_PREFIX'] = ADMIN_MEDIA_PREFIX context['languages'] = languages context['has_pos'] = has_pos context['po_filter'] = self.po_filter return context
def list_languages(request): """ Lists the languages for the current project, the gettext catalog files that can be translated and their translation progress """ languages = [] if 'filter' in request.GET: if request.GET.get('filter') in ('project', 'third-party', 'django', 'all'): filter_ = request.GET.get('filter') request.session['rosetta_i18n_catalog_filter'] = filter_ return HttpResponseRedirect(reverse('rosetta-pick-file')) rosetta_i18n_catalog_filter = request.session.get('rosetta_i18n_catalog_filter', 'project') third_party_apps = rosetta_i18n_catalog_filter in ('all', 'third-party') django_apps = rosetta_i18n_catalog_filter in ('all', 'django') project_apps = rosetta_i18n_catalog_filter in ('all', 'project') has_pos = False for language in settings.LANGUAGES: pos = find_pos(language[0], project_apps=project_apps, django_apps=django_apps, third_party_apps=third_party_apps) has_pos = has_pos or len(pos) languages.append( (language[0], _(language[1]), [(get_app_name(l), os.path.realpath(l), pofile(l)) for l in pos], ) ) ADMIN_MEDIA_PREFIX = settings.ADMIN_MEDIA_PREFIX version = rosetta.get_version(True) return render_to_response('rosetta/languages.html', locals(), context_instance=RequestContext(request))
def list_languages(request): """ Lists the languages for the current project, the gettext catalog files that can be translated and their translation progress """ languages = [] if 'filter' in request.GET: if request.GET.get('filter') in ('project', 'third-party', 'django', 'all'): filter_ = request.GET.get('filter') request.session['rosetta_i18n_catalog_filter'] = filter_ return HttpResponseRedirect(reverse('rosetta-pick-file')) rosetta_i18n_catalog_filter = request.session.get('rosetta_i18n_catalog_filter', 'project') third_party_apps = rosetta_i18n_catalog_filter in ('all', 'third-party') django_apps = rosetta_i18n_catalog_filter in ('all', 'django') project_apps = rosetta_i18n_catalog_filter in ('all', 'project') has_pos = False for language in settings.LANGUAGES: pos = find_pos(language[0], project_apps=project_apps,django_apps=django_apps,third_party_apps=third_party_apps) has_pos = has_pos or len(pos) languages.append( (language[0], _(language[1]), [(get_app_name(l), os.path.realpath(l), pofile(l)) for l in pos], ) ) ADMIN_MEDIA_PREFIX = settings.ADMIN_MEDIA_PREFIX version = rosetta.get_version(True) return render_to_response('rosetta/languages.html', locals(), context_instance=RequestContext(request))
def lang_sel(request,langid,idx): """ Selects a file to be translated """ if langid not in [l[0] for l in settings.LANGUAGES]: raise Http404 else: rosetta_i18n_catalog_filter = request.session.get('rosetta_i18n_catalog_filter', 'project') third_party_apps = rosetta_i18n_catalog_filter in ('all', 'third-party') django_apps = rosetta_i18n_catalog_filter in ('all', 'django') project_apps = rosetta_i18n_catalog_filter in ('all', 'project') file_ = find_pos(langid, project_apps=project_apps,django_apps=django_apps,third_party_apps=third_party_apps)[int(idx)] request.session['rosetta_i18n_lang_code'] = langid request.session['rosetta_i18n_lang_name'] = unicode([l[1] for l in settings.LANGUAGES if l[0] == langid][0]) request.session['rosetta_i18n_fn'] = file_ po = pofile(file_) for entry in po: entry.md5hash = hashlib.md5(entry.msgid.encode("utf8")+entry.msgstr.encode("utf8")).hexdigest() request.session['rosetta_i18n_pofile'] = po try: os.utime(file_,None) request.session['rosetta_i18n_write'] = True except OSError: request.session['rosetta_i18n_write'] = False return HttpResponseRedirect(reverse('rosetta-home'))
def lang_sel(request, langid, idx): """ Selects a file to be translated """ storage = get_storage(request) if langid not in [l[0] for l in settings.LANGUAGES]: raise Http404 else: rosetta_i18n_catalog_filter = storage.get('rosetta_i18n_catalog_filter', 'project') third_party_apps = rosetta_i18n_catalog_filter in ('all', 'third-party') django_apps = rosetta_i18n_catalog_filter in ('all', 'django') project_apps = rosetta_i18n_catalog_filter in ('all', 'project') file_ = find_pos(langid, project_apps=project_apps, django_apps=django_apps, third_party_apps=third_party_apps)[int(idx)] storage.set('rosetta_i18n_lang_code', langid) storage.set('rosetta_i18n_lang_name', unicode([l[1] for l in settings.LANGUAGES if l[0] == langid][0])) storage.set('rosetta_i18n_fn', file_) po = pofile(file_) for entry in po: entry.md5hash = hashlib.md5( entry.msgid.encode("utf8") + entry.msgstr.encode("utf8") + (entry.msgctxt and entry.msgctxt.encode("utf8") or "") ).hexdigest() storage.set('rosetta_i18n_pofile', po) try: os.utime(file_, None) storage.set('rosetta_i18n_write', True) except OSError: storage.set('rosetta_i18n_write', False) return HttpResponseRedirect(reverse('rosetta-home'))
def po_file_path(self): """Based on the url kwargs, infer and return the path to the .po file to be shown/updated. Throw a 404 if a file isn't found. """ # This was formerly referred to as 'rosetta_i18n_fn' idx = self.kwargs['idx'] idx = int(idx) # idx matched url re expression; calling int() is safe third_party_apps = self.po_filter in ('all', 'third-party') django_apps = self.po_filter in ('all', 'django') project_apps = self.po_filter in ('all', 'project') po_paths = find_pos( self.language_id, project_apps=project_apps, django_apps=django_apps, third_party_apps=third_party_apps, ) po_paths.sort(key=get_app_name) try: path = po_paths[idx] except IndexError: raise Http404 return path
def get_locale_catalog(locale): """ Fetch the complete message catalog for a certain locale. Messages or spread across different po files. To check if a message is translated or not you'll need this catalog, iterating over the po files is way to slow. This method consolidates all the messages a places them in a dictionary. @param locale: locale of the translation, e.g.: nl_NL, nl_BE, fr_BE, @type locale: str @return: POFile with an additional dictionary to quickly lookup a message """ if not locale: raise ValueError('Invalid locale: %s' % locale) request = getattr(THREAD_LOCAL_STORAGE, REQUEST, None) if not request: raise SystemError( 'Could not fetch the request object from THREAD_LOCALE_STORAGE') cache_key_locale = get_cache_key(locale) if hasattr(request, cache_key_locale): return getattr(request, cache_key_locale) storage = get_storage(request) if storage.has(cache_key_locale): catalog = storage.get(cache_key_locale) setattr(request, cache_key_locale, catalog) return catalog files = find_pos(locale, third_party_apps=THIRD_PARTY_APPS) if len(files) == 0: raise ValueError('Could not find any po files for locale: %s' % locale) # This catalog is needed to check whether a message is translated or not, we don't wont the interfere # with rosetta's logic ... #catalog = copy.deepcopy(pofile(files[0])) logger.info('Creating cached catalog for: %s' % locale) catalog = pofile(files[0]) # Join the other po files to the original for i in range(1, len(files)): #deep = copy.deepcopy(pofile(files[i])) deep = pofile(files[i]) for entry in deep: entry.pfile = files[i] catalog.append(entry) catalog.dict = dict((e.msgid, e) for e in catalog) # Store the catalog on the request setattr(request, cache_key_locale, catalog) # Store the catalog in the cache storage.set(cache_key_locale, catalog) #get_catalogs()[locale] = catalog #print "Catalog: ", repr(catalog) #print "Dict: ", repr(catalog.dict) return catalog
def get_locale_catalog(locale): """ Fetch the complete message catalog for a certain locale. Messages or spread across different po files. To check if a message is translated or not you'll need this catalog, iterating over the po files is way to slow. This method consolidates all the messages a places them in a dictionary. @param locale: locale of the translation, e.g.: nl_NL, nl_BE, fr_BE, @type locale: str @return: POFile with an additional dictionary to quickly lookup a message """ if not locale: raise ValueError('Invalid locale: %s' % locale) request = getattr(THREAD_LOCAL_STORAGE, REQUEST, None) if not request: raise SystemError('Could not fetch the request object from THREAD_LOCALE_STORAGE') cache_key_locale = get_cache_key(locale) if hasattr(request, cache_key_locale): return getattr(request, cache_key_locale) storage = get_storage(request) if storage.has(cache_key_locale): catalog = storage.get(cache_key_locale) setattr(request, cache_key_locale, catalog) return catalog files = find_pos(locale, third_party_apps=THIRD_PARTY_APPS) if len(files) == 0: raise ValueError('Could not find any po files for locale: %s' % locale) # This catalog is needed to check whether a message is translated or not, we don't wont the interfere # with rosetta's logic ... #catalog = copy.deepcopy(pofile(files[0])) logger.info('Creating cached catalog for: %s' % locale) catalog = pofile(files[0]) # Join the other po files to the original for i in range(1, len(files)): #deep = copy.deepcopy(pofile(files[i])) deep = pofile(files[i]) for entry in deep: entry.pfile = files[i] catalog.append(entry) catalog.dict = dict((e.msgid, e) for e in catalog) # Store the catalog on the request setattr(request, cache_key_locale, catalog) # Store the catalog in the cache storage.set(cache_key_locale, catalog) #get_catalogs()[locale] = catalog #print "Catalog: ", repr(catalog) #print "Dict: ", repr(catalog.dict) return catalog
def convert(self, language, *args, **kwargs): """ Run converter. Args: language: (unicode) language code. """ for f in find_pos(language): PoToXls(src=f, **kwargs).convert()
def convert(self, language, *args, **kwargs): """ Run converter. Args: language: (unicode) language code. """ for f in find_pos(language): XlsToPo(self.input(f), **kwargs).convert()
def list_languages(request, do_session_warn=False): """ Lists the languages for the current project, the gettext catalog files that can be translated and their translation progress """ storage = get_storage(request) languages = [] if 'filter' in request.GET: if request.GET.get('filter') in ('project', 'third-party', 'django', 'all'): filter_ = request.GET.get('filter') storage.set('rosetta_i18n_catalog_filter', filter_) return HttpResponseRedirect(reverse('rosetta-pick-file')) rosetta_i18n_catalog_filter = storage.get('rosetta_i18n_catalog_filter', 'project') third_party_apps = rosetta_i18n_catalog_filter in ('all', 'third-party') django_apps = rosetta_i18n_catalog_filter in ('all', 'django') project_apps = rosetta_i18n_catalog_filter in ('all', 'project') has_pos = False for language in settings.LANGUAGES: if not can_translate_language(request.user, language[0]): continue pos = find_pos(language[0], project_apps=project_apps, django_apps=django_apps, third_party_apps=third_party_apps) has_pos = has_pos or len(pos) languages.append(( language[0], _(language[1]), sorted([(get_app_name(l), os.path.realpath(l), pofile(l)) for l in pos], key=lambda app: app[0]), )) try: ADMIN_MEDIA_PREFIX = settings.ADMIN_MEDIA_PREFIX except AttributeError: ADMIN_MEDIA_PREFIX = settings.STATIC_URL + 'admin/' do_session_warn = do_session_warn and 'SessionRosettaStorage' in rosetta_settings.STORAGE_CLASS and 'signed_cookies' in settings.SESSION_ENGINE return render_to_response( 'rosetta/languages.html', dict(version=rosetta.get_version(True), ADMIN_MEDIA_PREFIX=ADMIN_MEDIA_PREFIX, do_session_warn=do_session_warn, languages=languages, has_pos=has_pos, rosetta_i18n_catalog_filter=rosetta_i18n_catalog_filter), context_instance=RequestContext(request))
def list_languages(): languages = [] has_pos = False for language in settings.LANGUAGES: pos = find_pos(language[0]) has_pos = has_pos or len(pos) languages.append( (language[0], language[1], [(get_app_name(l), os.path.realpath(l), pofile(l)) for l in pos], ) ) return languages
def list_languages(request, do_session_warn=False): """ Lists the languages for the current project, the gettext catalog files that can be translated and their translation progress """ storage = get_storage(request) languages = [] if 'filter' in request.GET: if request.GET.get('filter') in ('project', 'third-party', 'django', 'all'): filter_ = request.GET.get('filter') storage.set('rosetta_i18n_catalog_filter', filter_) return HttpResponseRedirect(reverse('rosetta-pick-file')) rosetta_i18n_catalog_filter = storage.get('rosetta_i18n_catalog_filter', 'project') third_party_apps = rosetta_i18n_catalog_filter in ('all', 'third-party') django_apps = rosetta_i18n_catalog_filter in ('all', 'django') project_apps = rosetta_i18n_catalog_filter in ('all', 'project') has_pos = False for language in settings.LANGUAGES: if not can_translate_language(request.user, language[0]): continue pos = find_pos(language[0], project_apps=project_apps, django_apps=django_apps, third_party_apps=third_party_apps) has_pos = has_pos or len(pos) languages.append( ( language[0], _(language[1]), sorted([(get_app_name(l), os.path.realpath(l), pofile(l)) for l in pos], key=lambda app: app[0]), ) ) try: ADMIN_MEDIA_PREFIX = settings.ADMIN_MEDIA_PREFIX except AttributeError: ADMIN_MEDIA_PREFIX = settings.STATIC_URL + 'admin/' do_session_warn = do_session_warn and 'SessionRosettaStorage' in rosetta_settings.STORAGE_CLASS and 'signed_cookies' in settings.SESSION_ENGINE return render_to_response('rosetta/languages.html', dict( version=rosetta.get_version(True), ADMIN_MEDIA_PREFIX=ADMIN_MEDIA_PREFIX, do_session_warn=do_session_warn, languages=languages, has_pos=has_pos, rosetta_i18n_catalog_filter=rosetta_i18n_catalog_filter ), context_instance=RequestContext(request))
def list_languages(request): """ Lists the languages for the current project, the gettext catalog files that can be translated and their translation progress """ languages = [] do_django = "django" in request.GET do_rosetta = "rosetta" in request.GET has_pos = False for language in settings.LANGUAGES: pos = find_pos(language[0], include_djangos=do_django, include_rosetta=do_rosetta) has_pos = has_pos or len(pos) languages.append((language[0], _(language[1]), [(os.path.realpath(l), pofile(l)) for l in pos])) ADMIN_MEDIA_PREFIX = settings.ADMIN_MEDIA_PREFIX version = rosetta.get_version(True) return render_to_response("rosetta/languages.html", locals())
def list_languages(request): """ Lists the languages for the current project, the gettext catalog files that can be translated and their translation progress """ languages = [] do_django = 'django' in request.GET do_rosetta = 'rosetta' in request.GET has_pos = False for language in settings.LANGUAGES: pos = find_pos(language[0],include_djangos=do_django,include_rosetta=do_rosetta) has_pos = has_pos or len(pos) languages.append( (language[0], _(language[1]), [(get_app_name(l), os.path.realpath(l), pofile(l)) for l in pos], ) ) ADMIN_MEDIA_PREFIX = settings.ADMIN_MEDIA_PREFIX version = rosetta.get_version(True) return render_to_response('rosetta/languages.html', locals(), context_instance=RequestContext(request))
def translations(self): trans_links = [] for lang in settings.LANGUAGES: # we look for the number rosetta uses to identity an app # which can be different for each language lang_code = lang[0] app_idx = None for i, path in enumerate(find_pos(lang_code)): project_path = cyclope.settings.CYCLOPE_PROJECT_PATH common_prefix = os.path.commonprefix([path, project_path]) if common_prefix == project_path: # we found the position for our app app_idx = i break if app_idx is not None: signature = "%s/%s/%s/" % (self._meta.app_label, self._meta.module_name, self.slug) trans_links.append( u'<a href="/rosetta/select/%s/%s/?query=%s">%s</a> ' % (lang[0], app_idx, signature, _(lang[1]))) trans_links = ''.join(trans_links) return trans_links
def convert( # noqa: CCR001 self, locale: str, *args: List[Any], **kwargs: Dict[str, Any] ) -> None: """ Run converter. :param locale: locale to process :type locale: str :param args: additional args :type args: List[Any] :param kwargs: additional args :type kwargs: Dict[str, Any] """ quiet = kwargs.get("quiet", False) for po in find_pos(lang=locale): try: PoToXls(src=po, **kwargs).convert() except ConversionError as error: if not quiet: self.stderr.write(str(error)) self.logger.error(error) sys.exit(-1)
def _parse(self, language, *args, **kwargs): for f in find_pos(language): PoToXls(f, **kwargs).parse()
def save_message(msgid, msgtxt, locale): """ Saves a translated message (msgtxt) to all the po files that have the msgid @param msgid: msgid as it appears in the po files @param msgtxt: message text @param locale: locale of the translation, e.g.: nl_NL, nl_BE, fr_BE, @param request: http request @return: list with all the changed po files """ # Validate the translated message, it must have the same amount of variable definitions if not validate_variables(msgid, msgtxt): raise ValueError('Invalid translation, unmatched variables') # file_ = find_pos(langid, project_apps=project_apps, django_apps=django_apps, #stor = storage.get_storage(request) files = [] catalog = get_locale_catalog(locale) pofiles = find_pos(locale, third_party_apps=THIRD_PARTY_APPS) #print "Post 1 = ", str(source), ", ", str(target_locale), ", ", str(target_msg) #print "Post 1.1 = ", str(settings.SOURCE_LANGUAGE_CODE), ", ", str(request.LANGUAGE_CODE) #print "Post = ", repr(stor), ", ", repr(pos) translated = catalog.dict.get(msgid, None) # Update the message in the catalog if translated: translated.msgstr = msgtxt make_entry_valid(translated) catalog.dict[msgid] = translated request = getattr(THREAD_LOCAL_STORAGE, REQUEST, None) cache_key_locale = get_cache_key(locale) storage = get_storage(request) storage.set(cache_key_locale, catalog) # Save the translation in all the po files that have msgid logger.info('Saving msgid %s ' % msgid) saved = False for path in pofiles: pfile = pofile(path) po_entry = pfile.find(msgid) if po_entry: po_entry.msgstr = msgtxt make_entry_valid(po_entry) # Save the pofile pfile.save() files.append(path) # Save the mofile popath, ext = os.path.splitext(path) pfile.save_as_mofile(popath + ".mo") saved = True logger.info('Saved to %s' % path) #po_filepath, ext = os.path.splitext(p) #save_as_mo_filepath = po_filepath + '.mo' #file.save_as_mofile(save_as_mo_filepath) #print "Msg = ", repr(po_entry), ", ", str(po_entry) if not saved: logger.error('Did not save to any file') return files