diff --git a/.ci/Jenkinsfile.crowdin b/.ci/Jenkinsfile.crowdin index 4f55c378..0f0530ee 100644 --- a/.ci/Jenkinsfile.crowdin +++ b/.ci/Jenkinsfile.crowdin @@ -50,6 +50,13 @@ timestamps { } sh 'LANG=C.UTF-8 find . -name "*.po" -exec msgfilter -i "{}" -o "{}.replacement" .ci/cleanup-po.pl ";"' sh 'find . -name "*.po" -exec mv "{}.replacement" "{}" ";"' + withCredentials([string(credentialsId: 'fe727e3e-a8e0-4019-817f-6583c3c51ef7', variable: 'CROWDIN_API2_KEY')]) { + def headers = [[maskValue: true, name: 'Authorization', value: "Bearer ${env.CROWDIN_API2_KEY}"], [maskValue: false, name: 'User-Agent', value: 'https://github.com/znc/znc/blob/master/.ci/Jenkinsfile.crowdin']] + def contributors = httpRequest consoleLogResponseBody: true, customHeaders: headers, url: "https://crowdin.com/api/v2/projects/289533/members?limit=500" + writeFile file: 'contributors.tmp', text: contributors.content + } + sh '.ci/crowdin-contributors.py < contributors.tmp' + sh 'rm contributors.tmp' } stage("Push ${upstream_branch}") { sh 'git config user.name "ZNC-Jenkins"' diff --git a/.ci/crowdin-contributors.py b/.ci/crowdin-contributors.py new file mode 100755 index 00000000..68971383 --- /dev/null +++ b/.ci/crowdin-contributors.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +import json +import sys + +array = [] + +data = json.load(sys.stdin) +for user in data['data']: + user = user['data'] + if user['fullName']: + array.append('* {} ({})'.format(user['username'], user['fullName'])) + else: + array.append('* ' + user['username']) + +array.sort(key=lambda x: x.lower()) + +sys.stdout = open('TRANSLATORS.md', 'wt') + +print('These people helped translating ZNC to various languages:') +print() +for u in array: + print(u) +print() +print('Generated from https://crowdin.com/project/znc-bouncer')