diff options
author | Petr Mladek <pmladek@suse.cz> | 2011-04-06 19:25:25 +0200 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2011-04-06 19:25:25 +0200 |
commit | 71a49a1bc65a0a03360f7ac06bae6e84a3c60ace (patch) | |
tree | f336fb2e7b5ddf5caea5f80145797c7b06535062 | |
parent | 7753f8807bafb4f0d1091c19bd54da5e9ee52a3a (diff) | |
parent | 7d99f8084d62dce7740b4833e1741951346b5fcd (diff) |
Merge remote-tracking branch 'origin/libreoffice-3-4'
-rw-r--r-- | translate_toolkit/makefile.mk | 1 | ||||
-rw-r--r-- | translate_toolkit/translate-toolkit-1.8.1-skipsource.patch | 99 |
2 files changed, 100 insertions, 0 deletions
diff --git a/translate_toolkit/makefile.mk b/translate_toolkit/makefile.mk index 9d0fbf6..334f663 100644 --- a/translate_toolkit/makefile.mk +++ b/translate_toolkit/makefile.mk @@ -69,6 +69,7 @@ PY_CMD=$(AUGMENT_LIBRARY_PATH) $(WRAPCMD) $(SOLARBINDIR)/python TARFILE_NAME=translate-toolkit-1.8.1 TARFILE_MD5=b4cae0700aa1c2aef7eb7f345365e6f1 +PATCH_FILES=translate-toolkit-1.8.1-skipsource.patch BUILD_ACTION=$(PY_CMD) setup.py build BUILD_DIR= diff --git a/translate_toolkit/translate-toolkit-1.8.1-skipsource.patch b/translate_toolkit/translate-toolkit-1.8.1-skipsource.patch new file mode 100644 index 0000000..c4cd7a0 --- /dev/null +++ b/translate_toolkit/translate-toolkit-1.8.1-skipsource.patch @@ -0,0 +1,99 @@ +Index: convert/po2oo.py +=================================================================== +--- misc/translate-toolkit-1.8.1/translate/convert/po2oo.py (revision 17314) ++++ misc/build/translate-toolkit-1.8.1/translate/convert/po2oo.py (working copy) +@@ -188,7 +188,7 @@ + filter = oocheckfilter(options, [checks.OpenOfficeChecker, checks.StandardUnitChecker], checks.openofficeconfig) + + +-def convertoo(inputfile, outputfile, templatefile, sourcelanguage=None, targetlanguage=None, timestamp=None, includefuzzy=False, multifilestyle="single", filteraction=None): ++def convertoo(inputfile, outputfile, templatefile, sourcelanguage=None, targetlanguage=None, timestamp=None, includefuzzy=False, multifilestyle="single", skip_source=False, filteraction=None): + inputstore = factory.getobject(inputfile) + inputstore.filename = getattr(inputfile, 'name', '') + if not targetlanguage: +@@ -205,7 +205,7 @@ + convertor = reoo(templatefile, languages=languages, timestamp=timestamp, includefuzzy=includefuzzy, long_keys=multifilestyle != "single", filteraction=filteraction) + outputstore = convertor.convertstore(inputstore) + # TODO: check if we need to manually delete missing items +- outputfile.write(str(outputstore)) ++ outputfile.write(outputstore.__str__(skip_source, targetlanguage)) + return True + + +@@ -223,6 +223,7 @@ + help="don't change the timestamps of the strings") + parser.add_option("", "--nonrecursiveoutput", dest="allowrecursiveoutput", default=True, action="store_false", help="don't treat the output oo as a recursive store") + parser.add_option("", "--nonrecursivetemplate", dest="allowrecursivetemplate", default=True, action="store_false", help="don't treat the template oo as a recursive store") ++ parser.add_option("", "--skipsource", dest="skip_source", default=False, action="store_true", help="don't output the source language, but fallback to it where needed") + parser.add_option("", "--filteraction", dest="filteraction", default="none", metavar="ACTION", + help="action on pofilter failure: none (default), warn, exclude-serious, exclude-all") + parser.add_fuzzy_option() +@@ -230,6 +231,7 @@ + parser.passthrough.append("sourcelanguage") + parser.passthrough.append("targetlanguage") + parser.passthrough.append("timestamp") ++ parser.passthrough.append("skip_source") + parser.passthrough.append("filteraction") + parser.run(argv) + +Index: convert/test_po2oo.py +=================================================================== +--- misc/translate-toolkit-1.8.1/translate/convert/test_po2oo.py (revision 17280) ++++ misc/build/translate-toolkit-1.8.1/translate/convert/test_po2oo.py (working copy) +@@ -170,6 +170,7 @@ + options = self.help_check(options, "--nonrecursiveoutput") + options = self.help_check(options, "--nonrecursivetemplate") + options = self.help_check(options, "--filteraction") ++ options = self.help_check(options, "--skipsource") + options = self.help_check(options, "--fuzzy") + options = self.help_check(options, "--nofuzzy") + options = self.help_check(options, "-t TEMPLATE, --template=TEMPLATE") +Index: storage/oo.py +=================================================================== +--- misc/translate-toolkit-1.8.1/translate/storage/oo.py (revision 17301) ++++ misc/build/translate-toolkit-1.8.1/translate/storage/oo.py (working copy) +@@ -246,9 +246,18 @@ + """convert to a string. double check that unicode is handled""" + return encode_if_needed_utf8(self.getoutput()) + +- def getoutput(self): ++ def getoutput(self, skip_source=False, fallback_lang=None): + """return the lines in tab-delimited form""" +- return "\r\n".join([str(line) for line in self.lines]) ++ if skip_source: ++ lines = self.lines[1:] ++ if not lines: ++ # Untranslated, so let's do fall-back: (bug 1883) ++ new_line = ooline(self.lines[0].getparts()) ++ new_line.languageid = fallback_lang ++ lines = [new_line] ++ else: ++ lines = self.lines ++ return "\r\n".join([str(line) for line in lines]) + + + class oofile: +@@ -295,11 +304,11 @@ + thisline = ooline(parts) + self.addline(thisline) + +- def __str__(self): ++ def __str__(self, skip_source=False, fallback_lang=None): + """convert to a string. double check that unicode is handled""" +- return encode_if_needed_utf8(self.getoutput()) ++ return encode_if_needed_utf8(self.getoutput(skip_source, fallback_lang)) + +- def getoutput(self): ++ def getoutput(self, skip_source=False, fallback_lang=None): + """converts all the lines back to tab-delimited form""" + lines = [] + for oe in self.units: +@@ -307,7 +316,7 @@ + warnings.warn("contains %d lines (should be 2 at most): languages %r" % (len(oe.lines), oe.languages)) + oekeys = [line.getkey() for line in oe.lines] + warnings.warn("contains %d lines (should be 2 at most): keys %r" % (len(oe.lines), oekeys)) +- oeline = str(oe) + "\r\n" ++ oeline = oe.getoutput(skip_source, fallback_lang) + "\r\n" + lines.append(oeline) + return "".join(lines) + |