summaryrefslogtreecommitdiff
path: root/lang/fetch.py
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-04-10 00:45:07 -0300
committerJesusaves <cpntb1@ymail.com>2021-04-10 00:45:07 -0300
commitc6095ad062eaa0f5576cfab1c4fe436b90c2fbfe (patch)
tree742dd839971d2aab1f08fd0291af66e6439646ab /lang/fetch.py
downloadtools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.tar.gz
tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.tar.bz2
tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.tar.xz
tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.zip
Add initial tools
Diffstat (limited to 'lang/fetch.py')
-rwxr-xr-xlang/fetch.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/lang/fetch.py b/lang/fetch.py
new file mode 100755
index 0000000..67c667f
--- /dev/null
+++ b/lang/fetch.py
@@ -0,0 +1,48 @@
+#! /usr/bin/env python2.7
+# -*- coding: utf8 -*-
+#
+# Copyright (C) 2018 TMW-2
+# Author: Jesusalva
+
+from transifex.api import TransifexAPI
+
+project='tmw'
+
+# Load credentials from login.txt and password.txt
+login=open('login.txt', 'r')
+for i in login:
+ username=i.replace('\n', '').replace('\r', '')
+
+login.close()
+
+passw=open('password.txt', 'r')
+for i in passw:
+ password=i.replace('\n', '').replace('\r', '')
+
+passw.close()
+
+t=TransifexAPI(username, password, 'https://www.transifex.com')
+
+if (not t.ping):
+ print("ERROR: Ping failed, this may be due incorrect username/password in login.txt and password.txt. Ensure there is NO newline at the end of file.")
+ exit(1)
+
+if (not t.project_exists(project)):
+ print("ERROR: Invalid project name")
+ exit(1)
+
+# Load languages
+langs=[]
+vcx=open("../../server-data/langs/langs.txt", "r")
+for i in vcx:
+ if i != "en":
+ langs.append(i.replace('\n', ''))
+vcx.close()
+
+# Fetch all translations and record them at in/
+for i in langs:
+ if i not in ['en']:
+ print("Fetching %s..." %(i))
+ t.get_translation(project, 'serverdata', i, 'in/'+str(i)+'.po')
+
+