def finalize(self): if self.nmod > 0: if not self.strip: msg = n_("@info:progress", "Added differences to %(num)d fuzzy message.", "Added differences to %(num)d fuzzy messages.", num=self.nmod) else: msg = n_("@info:progress", "Stripped differences from %(num)d fuzzy message.", "Stripped differences from %(num)d fuzzy messages.", num=self.nmod) report("===== " + msg)
def finalize(self): if self.nresolvedhdr > 0: msg = n_("@info:progress", "Resolved %(num)d aggregate header.", "Resolved %(num)d aggregate headers.", num=self.nresolvedhdr) report("===== " + msg) if self.nresolved > 0: msg = n_("@info:progress", "Resolved %(num)d aggregate message.", "Resolved %(num)d aggregate messages.", num=self.nresolved) report("===== " + msg)
def finalize (self): if self.byrule: ruleIdents = sorted(self.postFailedMessages.keys()) for ruleIdent in ruleIdents: for msg, cat, failedRule in self.postFailedMessages[ruleIdent]: multi_rule_error(msg, cat, [failedRule], self.showmsg, predelim=self._first_error) self._first_error = False if self.xmlFile: # Close last po tag and xml file if self.cached and self.cacheFile: self.cacheFile.write("</po>\n") self.cacheFile.close() self.cacheFile = None else: self.xmlFile.write("</po>\n") self.xmlFile.write("</pos>\n") self.xmlFile.close() if self.nmatch > 0: msg = n_("@info:progress", "Rules detected %(num)d problem.", "Rules detected %(num)d problems.", num=self.nmatch) report("===== " + msg) printStat(self.rules)
def finalize (self): if self.nproblems > 0: if not self.strict: msg = n_("@info:progress TP stands for Translation Project", "Found %(num)d problem in KDE TP translations.", "Found %(num)d problems in KDE TP translations.", num=self.nproblems) else: msg = n_("@info:progress", "Found %(num)d problem in " "KDE TP translations (strict mode).", "Found %(num)d problems in " "KDE TP translations (strict mode).", num=self.nproblems) report("===== " + msg)
def finalize(self): if self.nmod > 0: msg = n_("@info:progress", "Removed some comments from %(num)d fuzzy message.", "Removed some comments from %(num)d fuzzy messages.", num=self.nmod) report("===== " + msg)
def finalize(self): if self.nmod: msg = n_("@info:progress", "Modified %(num)d message by filtering.", "Modified %(num)d messages by filtering.", num=self.nmod) report("===== " + msg)
def finalize(self): if self.nconv > 0: msg = n_("@info:progress", "Converted %(num)d separator-embedded context.", "Converted %(num)d separator-embedded contexts.", num=self.nconv) report("===== " + msg)
def finalize (self): if self.nmatch: msg = n_("@info:progress", "Found %(num)d message satisfying the conditions.", "Found %(num)d messages satisfying the conditions.", num=self.nmatch) report("===== " + msg)
def finalize(self): if self.nmatch > 0: msg = n_("@info:progress", "Removed %(num)d obsolete message.", "Removed %(num)d obsolete messages.", num=self.nmatch) report("===== " + msg)
def finalize(self): if self.nmatch > 0: report( n_("@info", "Non-breaking spaces added in %(num)d message.", "Non-breaking spaces added in %(num)d messages.", num=self.nmatch))
def finalize(self): if self.nbad > 0: msg = n_("@info:progress", "Detected %(num)d bad pattern in translation.", "Detected %(num)d bad patterns in translation.", num=self.nbad) report("===== " + msg)
def finalize(self): if self.ncorr > 0: msg = n_("@info:progress", "Merged %(num)d corrected message.", "Merged %(num)d corrected messages.", num=self.ncorr) report("===== " + msg)
def finalize (self): if self.nunfuzz > 0: msg = n_("@info:progress", "Unfuzzied %(num)d message due to " "closing tags in-place.", "Unfuzzied %(num)d messages due to " "closing tags in-place.", num=self.nunfuzz) report("===== " + msg) if self.nmodinpl > 0: msg = n_("@info:progress", "Modified %(num)d translations by " "closing tags in-place.", "Modified %(num)d translations by " "closing tags in-place.", num=self.nmodinpl) report("===== " + msg)
def _msg_simple_stats(self, title, count, summed): """ msgfmt-style report """ fmt_trn = n_("@item:intext", "%(num)d translated message", "%(num)d translated messages", num=count["trn"][0]) fmt_fuz = n_("@item:intext", "%(num)d fuzzy translation", "%(num)d fuzzy translations", num=count["fuz"][0]) fmt_unt = n_("@item:intext", "%(num)d untranslated message", "%(num)d untranslated messages", num=count["unt"][0]) report( _("@info composition of three previous messages", "%(trn)s, %(fuz)s, %(unt)s", trn=fmt_trn, fuz=fmt_fuz, unt=fmt_unt))
def finalize(self): if self.unknown_words: if not self.words_only: nwords = len(self.unknown_words) msg = n_("@info:progress", "Encountered %(num)d unknown word.", "Encountered %(num)d unknown words.", num=nwords) report("===== " + msg) else: wlist = list(self.unknown_words) wlist.sort(lambda x, y: locale.strcoll(x.lower(), y.lower())) report("\n".join(wlist))
def finalize(self): # Remove composited personal dictionaries. for tmpDictFile in self.tmpDictFiles.values(): if isfile(tmpDictFile): os.unlink(tmpDictFile) if self.unknownWords is not None: slist = list(self.unknownWords) if slist: slist.sort(lambda x, y: locale.strcoll(x.lower(), y.lower())) report("\n".join(slist)) else: if self.nmatch: msg = n_("@info:progress", "Encountered %(num)d unknown word.", "Encountered %(num)d unknown words.", num=self.nmatch) report("===== " + msg) if self.xmlFile: self.xmlFile.write("</po>\n") self.xmlFile.write("</pos>\n") self.xmlFile.close()
def finalize (self): # Check cross-entry validity, select valid. msgs_by_seen_msgstr = {} unique_entries = [] for entry in self.entries: d1, props, d3, d4, msg, cat = entry msgstr = msg.msgstr[0] if msgstr not in msgs_by_seen_msgstr: msgs_by_seen_msgstr[msgstr] = [] else: for d1, d2, oprops in msgs_by_seen_msgstr[msgstr]: if props == oprops: props = None break if props: unique_entries.append(entry) msgs_by_seen_msgstr[msgstr].append((msg, cat, props)) good_entries = [] for ekeys, props, psep, kvsep, msg, cat in unique_entries: eq_msgstr_set = msgs_by_seen_msgstr.get(msg.msgstr[0]) if eq_msgstr_set is not None: if len(eq_msgstr_set) > 1: cmsgcats = msgs_by_seen_msgstr.pop(msg.msgstr[0]) msg0, cat0, d3 = cmsgcats[0] warning_on_msg(_("@info split to link below", "Property map entries removed due " "to translation conflict with..."), msg0, cat0) for msg, cat, d3 in cmsgcats[1:]: warning_on_msg(_("@info continuation from above", "...this message."), msg, cat) else: good_entries.append((ekeys, props, psep, kvsep)) # If output file has not been given, only validation was expected. if not self.p.outfile: return # Serialize entries. good_entries.sort(key=lambda x: x[0]) lines = [] for ekeys, props, psep, kvsep in good_entries: # Do Unicode, locale-unaware sorting, # for equal results over different systems; # they are not to be read by humans anyway. propstr = psep.join([kvsep.join(x) for x in sorted(props)]) ekeystr = psep.join(sorted(ekeys)) estr = kvsep + psep + ekeystr + psep + propstr + psep + psep lines.append(estr) # Write out the property map. lines.append("") fstr = "\n".join(lines) fstr = fstr.encode("UTF-8") fh = open(self.p.outfile, "w") fh.write(fstr) fh.close() msg = n_("@info:progress", "Collected %(num)d entry for the property map.", "Collected %(num)d entries for the property map.", num=len(good_entries)) report("===== " + msg)