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 []
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 []
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
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
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