コード例 #1
0
ファイル: sumo.py プロジェクト: ENuge/pootle
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"))
コード例 #2
0
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"))
コード例 #3
0
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"))
コード例 #4
0
ファイル: sumo.py プロジェクト: ENuge/pootle
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"))
コード例 #5
0
ファイル: sumo.py プロジェクト: synasius/pootle
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"))
コード例 #6
0
ファイル: sumo.py プロジェクト: AmesianX/pootle
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"))
コード例 #7
0
ファイル: test_tiki2po.py プロジェクト: Veterini/translate
    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
コード例 #8
0
    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
コード例 #9
0
    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
コード例 #10
0
    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
コード例 #11
0
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"))
コード例 #12
0
ファイル: sumo.py プロジェクト: ENuge/pootle
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"))