Exemplo n.º 1
0
def main(argv=None):
    from translate.convert import convert
    from translate.misc import stdiotell
    import sys
    sys.stdout = stdiotell.StdIOWrapper(sys.stdout)
    formats = {
        ("po", "htm"): ("htm", converthtml),
        ("po", "html"): ("html", converthtml),
        ("po", "xhtml"): ("xhtml", converthtml),
        ("po"): ("html", converthtml)
    }
    parser = convert.ConvertOptionParser(formats,
                                         usetemplates=True,
                                         description=__doc__)
    if textwrap is not None:
        parser.add_option("-w",
                          "--wrap",
                          dest="wrap",
                          default=None,
                          type="int",
                          help="set number of columns to wrap html at",
                          metavar="WRAP")
        parser.passthrough.append("wrap")
    if tidy is not None:
        parser.add_option("",
                          "--notidy",
                          dest="usetidy",
                          default=True,
                          help="disables the use of HTML tidy",
                          action="store_false")
        parser.passthrough.append("usetidy")
    parser.add_fuzzy_option()
    parser.run(argv)
Exemplo n.º 2
0
def main(argv=None):
    from translate.misc import stdiotell
    import sys
    sys.stdout = stdiotell.StdIOWrapper(sys.stdout)
    formats = {
        ("po", "txt"): ("txt", converttxt),
        ("po"): ("txt", converttxt),
        ("xlf", "txt"): ("txt", converttxt),
        ("xlf"): ("txt", converttxt)
    }
    parser = convert.ConvertOptionParser(formats,
                                         usetemplates=True,
                                         description=__doc__)
    parser.add_option(
        "",
        "--encoding",
        dest="encoding",
        default='utf-8',
        type="string",
        help="The encoding of the template file (default: UTF-8)")
    parser.passthrough.append("encoding")
    parser.add_option("-w",
                      "--wrap",
                      dest="wrap",
                      default=None,
                      type="int",
                      help="set number of columns to wrap text at",
                      metavar="WRAP")
    parser.passthrough.append("wrap")
    parser.add_threshold_option()
    parser.add_fuzzy_option()
    parser.run(argv)
Exemplo n.º 3
0
def main(argv=None):
    from translate.convert import convert
    from translate.misc import stdiotell
    import sys
    sys.stdout = stdiotell.StdIOWrapper(sys.stdout)
    formats = {
        "html": ("po", converthtml),
        "htm": ("po", converthtml),
        "xhtml": ("po", converthtml),
        None: ("po", converthtml),
    }
    parser = convert.ConvertOptionParser(formats,
                                         usepots=True,
                                         description=__doc__)
    parser.add_option("-u",
                      "--untagged",
                      dest="includeuntagged",
                      default=False,
                      action="store_true",
                      help="include untagged sections")
    parser.passthrough.append("includeuntagged")
    parser.add_option(
        "--keepcomments",
        dest="keepcomments",
        default=False,
        action="store_true",
        help="preserve html comments as translation notes in the output")
    parser.passthrough.append("keepcomments")
    parser.add_duplicates_option()
    parser.passthrough.append("pot")
    parser.run(argv)
Exemplo n.º 4
0
def main(argv=None):
    from translate.convert import convert
    from translate.misc import stdiotell
    import sys
    sys.stdout = stdiotell.StdIOWrapper(sys.stdout)
    formats = {"txt": ("po", converttxt), "*": ("po", converttxt)}
    parser = convert.ConvertOptionParser(formats,
                                         usepots=True,
                                         description=__doc__)
    parser.add_option("",
                      "--encoding",
                      dest="encoding",
                      default='utf-8',
                      type="string",
                      help="The encoding of the input file (default: UTF-8)")
    parser.passthrough.append("encoding")
    parser.add_option(
        "",
        "--flavour",
        dest="flavour",
        default="plain",
        type="choice",
        choices=["plain", "dokuwiki", "mediawiki"],
        help="The flavour of text file: plain (default), dokuwiki, mediawiki",
        metavar="FLAVOUR")
    parser.passthrough.append("flavour")
    parser.add_duplicates_option()
    parser.run(argv)
Exemplo n.º 5
0
def main(argv=None):
    from translate.convert import convert
    from translate.misc import stdiotell
    import sys
    sys.stdout = stdiotell.StdIOWrapper(sys.stdout)
    formats = {"*": ("po", convertpo)}
    parser = convert.ConvertOptionParser(formats, description=__doc__)
    parser.run(argv)
Exemplo n.º 6
0
def main(argv=None):
    from translate.convert import convert
    from translate.misc import stdiotell
    import sys
    sys.stdout = stdiotell.StdIOWrapper(sys.stdout)
    parser = convert.ConvertOptionParser(formats, usetemplates=True,
                                           description=__doc__)
    parser.add_fuzzy_option()
    parser.run(argv)
Exemplo n.º 7
0
def main(argv=None):
    from translate.misc import stdiotell
    import sys
    sys.stdout = stdiotell.StdIOWrapper(sys.stdout)
    formats = {("po", "py"): ("py", convertpy), ("po"): ("py", convertpy)}
    parser = convert.ConvertOptionParser(formats, usetemplates=False, description=__doc__)
    parser.add_threshold_option()
    parser.add_fuzzy_option()
    parser.run(argv)
Exemplo n.º 8
0
def main(argv=None):
    """Will convert from .po to tiki style .php"""
    from translate.convert import convert
    from translate.misc import stdiotell
    sys.stdout = stdiotell.StdIOWrapper(sys.stdout)

    formats = {"po":("tiki",convertpo)}

    parser = convert.ConvertOptionParser(formats, description=__doc__)
    parser.run(argv)
Exemplo n.º 9
0
def main(argv=None):
    from translate.convert import convert
    from translate.misc import stdiotell
    import sys
    sys.stdout = stdiotell.StdIOWrapper(sys.stdout)
    parser = convert.ConvertOptionParser(formats, usetemplates=True,
                                           description=__doc__)
    parser.add_option("", "--mark-active", dest="mark_active", default=False,
            action="store_true", help="mark the file as active")
    parser.add_fuzzy_option()
    parser.passthrough.append("mark_active")
    parser.run(argv)
Exemplo n.º 10
0
def main(argv=None):
    """Converts tiki .php files to .po."""
    from translate.convert import convert
    from translate.misc import stdiotell
    sys.stdout = stdiotell.StdIOWrapper(sys.stdout)

    formats = {"php":("po",converttiki)}

    parser = convert.ConvertOptionParser(formats, description=__doc__)
    parser.add_option("", "--include-unused", dest="includeunused", action="store_true", default=False, help="Include strings in the unused section")
    parser.passthrough.append("includeunused")
    parser.run(argv)
Exemplo n.º 11
0
def main(argv=None):
    from translate.convert import convert
    from translate.misc import stdiotell
    import sys
    sys.stdout = stdiotell.StdIOWrapper(sys.stdout)
    parser = convert.ConvertOptionParser(formats,
                                         usepots=True,
                                         description=__doc__)
    parser.add_option("",
                      "--encoding",
                      dest="encoding",
                      default='utf-8',
                      help="The encoding of the input file (default: UTF-8)")
    parser.passthrough.append("encoding")
    parser.add_duplicates_option()
    parser.run(argv)