we don't use Qt translation files

This commit is contained in:
Radegast 2015-01-14 16:57:48 +01:00
parent bc270d7fe0
commit 6f9aeb6990
2 changed files with 15 additions and 73 deletions

View file

@ -1,41 +1,41 @@
[github] [github]
; Github username of bot ; Github username of bot
user = MumbleTransifexBot user = ETLegacyTransifexRobot
; Github password of bot ; Github password of bot
password = password =
; Email used for commits ; Email used for commits
email = mumbletransifexbot@mumble.info email =
[transifex] [transifex]
; Modes: default fetches all string, reviewed only reviewed ones ; Modes: default fetches all string, reviewed only reviewed ones
mode = default mode = default
; Minimum number of percent needed for a translation to be included ; Minimum number of percent needed for a translation to be included
minpercent = 0 minpercent = 1
[workingrepo] [workingrepo]
owner = MumbleTransifexBot owner = ETLegacyTransifexRobot
repo = mumble repo = etlegacy
branch = master branch = master
; Clone URL for working repo ; Clone URL for working repo
url = git@github.com:MumbleTransifexBot/mumble.git url = git@github.com:ETLegacyTransifexRobot/etlegacy.git
; Local path the repo can be found ; Local path the repo can be found
path = /home/mumbletransifexbot/mumble/ path = /home/etlegacy/repositories/transifex-etlegacy
[targetrepo] [targetrepo]
owner = mumble-voip owner = etlegacy
repo = mumble repo = etlegacy
branch = master branch = master
; Clone URL for pull request target repository ; Clone URL for pull request target repository
url = https://github.com/mumble-voip/mumble.git url = https://github.com/etlegacy/etlegacy.git
[pullrequest] [pullrequest]
; Template string for pull request title ; Template string for pull request title
title = Transifex translation update title = Transifex translation update
; Template string for pull request body ; Template string for pull request body
body = New translation updates available from transifex body = New translation updates available from transifex
https://www.transifex.com/organization/mumble/dashboard/mumble https://www.transifex.com/projects/p/etlegacy/
; Template string for commits in PR. Available variables ; Template string for commits in PR. Available variables
; %(mode)s See transifex.mode above ; %(mode)s See transifex.mode above
; %(minpercent)s See transifex.minpercent above ; %(minpercent)s See transifex.minpercent above
@ -45,33 +45,3 @@ commit = Transifex translation update
Mode: %(mode)s Mode: %(mode)s
Minimum percent translated: %(minpercent)s Minimum percent translated: %(minpercent)s
Matched %(langcount)d languages Matched %(langcount)d languages
[misc]
; pri file to store language bookkeeping data in
; Will be re-written and commited to the repository
; if changes occur.
prifile = src/mumble/translations.pri
; Template to generate file from, available variables $(files)s
; for a space separated list of all files.
pritemplate = # Do not change manually
# Autogenerated by mumble transifex bot
TRANSLATIONS = %(files)s
; qtc file to store language bookkeeping data in
; Will be re-written and commited to the repository
; if changes occur.
qrcfile = src/mumble/mumble_translations.qrc
; Template to generate file from, available variables $(files)s
; for a space separated list of all files.
qrctemplate = <!DOCTYPE RCC><RCC version="1.0">
<!--
Do not change manually
Autogenerated by mumble transifex bot
-->
<qresource>
%(files)s
</qresource>
</RCC>
; Space separated translation files not retrieved from transifex
additionaltsfiles = mumble_en.ts

View file

@ -115,13 +115,7 @@ if __name__ == "__main__":
pr_title = cfg.get('pullrequest', 'title') pr_title = cfg.get('pullrequest', 'title')
pr_body = cfg.get('pullrequest', 'body') pr_body = cfg.get('pullrequest', 'body')
pr_commit = cfg.get('pullrequest', 'commit') pr_commit = cfg.get('pullrequest', 'commit')
prifile = cfg.get('misc', 'prifile')
pritemplate = cfg.get('misc', 'pritemplate')
qrcfile = cfg.get('misc', 'qrcfile')
qrctemplate = cfg.get('misc', 'qrctemplate')
additionaltsfiles = cfg.get('misc', 'additionaltsfiles')
if args.setup or not os.path.exists(wr_path): if args.setup or not os.path.exists(wr_path):
info("Setting up git repo") info("Setting up git repo")
debug(git["clone", wr_url, wr_path]()) debug(git["clone", wr_url, wr_path]())
@ -168,32 +162,10 @@ if __name__ == "__main__":
txout = tx["pull", "-f", "-a", "--mode=" + mode, "--minimum-perc=" + minpercent]() txout = tx["pull", "-f", "-a", "--mode=" + mode, "--minimum-perc=" + minpercent]()
debug(txout) debug(txout)
# Add all .ts files tx pull got to repo # Add all .po files tx pull got to repo
paths, files = zip(*re.findall(r"^\s->\s[\w_]+:\s([\w/\_]+/([\w_]+\.ts))$", txout, flags=re.MULTILINE)) paths, files = zip(*re.findall(r"^\s->\s[\w_]+:\s([\w/\_]+/([\w_]+\.ts))$", txout, flags=re.MULTILINE))
debug(git["add"](*paths)) debug(git["add"](*paths))
# Add additional ts files not in control of transifex (e.g. English source translation)
files = list(files)
files.extend(additionaltsfiles.split(" "))
files.sort()
# Write pri file listing ts files for build
prifilepath = os.path.join(wr_path, prifile)
info("Updating translations listing file '%s'", prifilepath)
tsfiles = (" ".join(files))
with open(prifilepath, "w") as f:
f.write(pritemplate % {'files': tsfiles})
debug(git["add"](prifilepath))
# Write qrc file listing qm files built from ts files for build
qrcfilepath = os.path.join(wr_path, qrcfile)
info("Updating translations listing file '%s'", qrcfilepath)
tstoqm = lambda f: " <file>%s</file>" % re.sub(r"(^.*)\.ts$", r"\1.qm", f)
qmfiles = os.linesep.join([tstoqm(f) for f in files])
with open(qrcfilepath, "w") as f:
f.write(qrctemplate % {'files': qmfiles})
debug(git["add"](qrcfilepath))
# Check if the repo changed # Check if the repo changed
debug("Checking for modifications") debug("Checking for modifications")
changed, changedfiles, _ = git["diff", "--cached", "--name-only", "--exit-code"].run(retcode=(0,1)) changed, changedfiles, _ = git["diff", "--cached", "--name-only", "--exit-code"].run(retcode=(0,1))