def postupdate(updatedfile): # Get the files we'll be using pofile = os.path.join(os.path.dirname(updatedfile), "language.po") # Recreate .po with any new strings in tikifile print "Converting tiki to po: %s to %s" % (pofile, updatedfile) tiki2po.converttiki(open(updatedfile, "r"), open(pofile, "w"))
def postupdate(updatedfile): # Get the files we'll be using pofile = os.path.join(os.path.dirname(updatedfile), 'language.po') # Recreate .po with any new strings in tikifile print "Converting tiki to po: %s to %s" % (pofile, updatedfile) tiki2po.converttiki(open(updatedfile, "r"), open(pofile, "w"))
def postcommit(committedfile, success): if os.path.basename(committedfile) == "language.po": # Get the files we'll be using tikifile = os.path.join(os.path.dirname(committedfile), 'language.php') # Recreate .po with any new strings in tikifile print "Converting tiki to po: %s to %s" % (tikifile, committedfile) tiki2po.converttiki(open(tikifile, "r"), open(committedfile, "w"))
def postcommit(committedfile, success): if os.path.basename(committedfile) == "language.po": # Get the files we'll be using tikifile = os.path.join(os.path.dirname(committedfile), "language.php") # Recreate .po with any new strings in tikifile print "Converting tiki to po: %s to %s" % (tikifile, committedfile) tiki2po.converttiki(open(tikifile, "r"), open(committedfile, "w"))
def postupdate(updatedfile): if os.path.basename(updatedfile) == "language.po": # Get the files we'll be using tikifile = os.path.join(os.path.dirname(updatedfile), 'language.php') # Recreate .po with any new strings in tikifile logging.info(u"Converting tiki to po: %s > %s", tikifile, updatedfile) tiki2po.converttiki(open(tikifile, "r"), open(updatedfile, "w"))
def test_converttiki_defaults(self): inputfile = b""" "zero_source" => "zero_target", // ### Start of unused words "one_source" => "one_target", // ### end of unused words """ outputfile = BytesIO() tiki2po.converttiki(inputfile, outputfile) output = outputfile.getvalue().decode('utf-8') assert '#: translated' in output assert 'msgid "zero_source"' in output assert "one_source" not in output
def test_converttiki_includeunused(self): inputfile = """ "zero_source" => "zero_target", // ### Start of unused words "one_source" => "one_target", // ### end of unused words """ outputfile = wStringIO.StringIO() tiki2po.converttiki(inputfile, outputfile, includeunused=True) output = outputfile.getvalue() assert '#: translated' in output assert 'msgid "zero_source"' in output assert '#: unused' in output assert 'msgid "one_source"' in output
def initialize(projectdir, languagecode): """The first paramater is the path to the project directory. It's up to this script to know any internal structure of the directory""" # Temporary code - projectdirs come from pootle with sumo/ab_CD form; we need just the former part # extract project root from projectdir projectroot = os.path.join(settings.PODIRECTORY, os.path.split(projectdir)[0]) # Temporary code. Language codes come from pootle with underscores right now; they need to be dashes. languagecode = languagecode.replace("_", "-") # Find the files we're working with tikifile = os.path.join(projectroot, languagecode, 'language.php') pofile = os.path.join(projectroot, languagecode, 'language.po') # Build our combined file print "Initializing %s to %s" % (tikifile, pofile) tiki2po.converttiki(open(tikifile, "r"), open(pofile, "w"))
def initialize(projectdir, languagecode): """The first paramater is the path to the project directory. It's up to this script to know any internal structure of the directory""" # Temporary code - projectdirs come from pootle with sumo/ab_CD form; we need just the former part # extract project root from projectdir projectroot = os.path.join(settings.PODIRECTORY, os.path.split(projectdir)[0]) # Temporary code. Language codes come from pootle with underscores right now; they need to be dashes. languagecode = languagecode.replace("_", "-") # Find the files we're working with tikifile = os.path.join(projectroot, languagecode, "language.php") pofile = os.path.join(projectroot, languagecode, "language.po") # Build our combined file print "Initializing %s to %s" % (tikifile, pofile) tiki2po.converttiki(open(tikifile, "r"), open(pofile, "w"))