Compare commits
1 Commits
f0f715b342
...
4b38bcc252
Author | SHA1 | Date |
---|---|---|
shekhar-cis | 4b38bcc252 |
|
@ -32,6 +32,8 @@ transifexUsername = ""
|
|||
transifexPassword = ""
|
||||
transifex_webhook_url = 'https://buildbot.bitmessage.org/change_hook/transifex'
|
||||
transifex_dict = {}
|
||||
secret = ""
|
||||
master = ""
|
||||
|
||||
from transifex.api import transifex_api
|
||||
|
||||
|
@ -41,13 +43,13 @@ proj = org.fetch('projects').get(slug='my_project')
|
|||
lang = transifex_api.Language.get(code='<lang>')
|
||||
resource = proj.fetch('resources').get(slug='my_resource')
|
||||
url = transifex_api.ResourceTranslationsAsyncDownload.download(
|
||||
resource=resource, language=lang,content_encoding = 'text',
|
||||
resource=resource, language=lang,content_encoding = 'text',
|
||||
file_type = 'default', pseudo = False
|
||||
)
|
||||
|
||||
class TransifexHandler(BaseHookHandler):
|
||||
|
||||
def __init__(self, secret, master, transifex_dict):
|
||||
def __init__(self, transifex_dict, secret, master,):
|
||||
self.secret = secret
|
||||
self.master = master
|
||||
self.transifex_dict = transifex_dict
|
||||
|
@ -88,7 +90,6 @@ class TransifexHandler(BaseHookHandler):
|
|||
|
||||
def downloadTranslatedLanguage(ts, lang):
|
||||
headers = {"Authorization": "Basic " + b64encode(transifexUsername + ":" + transifexPassword)}
|
||||
resname = "pybitmessage_" + lang + ".po"
|
||||
fname = "bitmessage_" + lang.lower() + ".po"
|
||||
with open("src/translations/" + fname, "wt") as handle:
|
||||
response = requests.get("https://www.transifex.com/api/2/project/pybitmessage/resource/pybitmessage/translation/" + lang + "/",
|
||||
|
@ -118,11 +119,6 @@ class TransifexHandler(BaseHookHandler):
|
|||
self.updateLocalTranslationDestination(ts, lang.lower(), branch)
|
||||
self.downloadTranslatedLanguage(ts, lang.lower())
|
||||
|
||||
if not match:
|
||||
log.msg("Ignoring refname '{}': Not a branch or tag".format(refname))
|
||||
return changes
|
||||
|
||||
branch = match.group(2)
|
||||
|
||||
repository = payload['repository']
|
||||
repo_url = repository['ssh_url']
|
||||
|
|
Loading…
Reference in New Issue