Exemplo n.º 1
0
def precommit(committedfile, author, message):
    if os.path.basename(committedfile) == "language.po":

        # Get the files we'll be using
        tikifile = os.path.join(os.path.dirname(committedfile), 'language.php')

        # Update tikifile with new strings
        print "Converting po to tiki: %s to %s" % (committedfile, tikifile)
        po2tiki.convertpo(open(committedfile, "r"), open(tikifile, "w"))

        # We want to commit messages.php
        return [tikifile]
    return []
Exemplo n.º 2
0
Arquivo: sumo.py Projeto: ENuge/pootle
def precommit(committedfile, author, message):
    if os.path.basename(committedfile) == "language.po":

        # Get the files we'll be using
        tikifile = os.path.join(os.path.dirname(committedfile), "language.php")

        # Update tikifile with new strings
        print "Converting po to tiki: %s to %s" % (committedfile, tikifile)
        po2tiki.convertpo(open(committedfile, "r"), open(tikifile, "w"))

        # We want to commit messages.php
        return [tikifile]
    return []
Exemplo n.º 3
0
    def test_convertpo(self):
        inputfile = """
#: translated
msgid "zero_source"
msgstr "zero_target"

#: unused
msgid "one_source"
msgstr "one_target"
        """
        outputfile = wStringIO.StringIO()
        po2tiki.convertpo(inputfile, outputfile)

        output = outputfile.getvalue()

        assert '"one_source" => "one_target",' in output
        assert '"zero_source" => "zero_target",' in output
Exemplo n.º 4
0
    def test_convertpo(self):
        inputfile = b"""
#: translated
msgid "zero_source"
msgstr "zero_target"

#: unused
msgid "one_source"
msgstr "one_target"
        """
        outputfile = BytesIO()
        po2tiki.convertpo(inputfile, outputfile)

        output = outputfile.getvalue().decode("utf-8")

        assert '"one_source" => "one_target",' in output
        assert '"zero_source" => "zero_target",' in output
Exemplo n.º 5
0
    def test_convertpo(self):
        inputfile = """
#: translated
msgid "zero_source"
msgstr "zero_target"

#: unused
msgid "one_source"
msgstr "one_target"
        """
        outputfile = wStringIO.StringIO()
        po2tiki.convertpo(inputfile, outputfile)

        output = outputfile.getvalue()

        assert '"one_source" => "one_target",' in output
        assert '"zero_source" => "zero_target",' in output
Exemplo n.º 6
0
    def test_convertpo(self):
        inputfile = b"""
#: translated
msgid "zero_source"
msgstr "zero_target"

#: unused
msgid "one_source"
msgstr "one_target"
        """
        outputfile = BytesIO()
        po2tiki.convertpo(inputfile, outputfile)

        output = outputfile.getvalue().decode('utf-8')

        assert '"one_source" => "one_target",' in output
        assert '"zero_source" => "zero_target",' in output