summaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2022-10-23 23:45:19 -0300
committerJesusaves <cpntb1@ymail.com>2022-10-23 23:45:19 -0300
commitc2ccb14ffff0e45398365e19dfd2874307ddb943 (patch)
tree976eaea586fb8f1ee0ab8cae67c69071aed8b952 /web
downloadtools-c2ccb14ffff0e45398365e19dfd2874307ddb943.tar.gz
tools-c2ccb14ffff0e45398365e19dfd2874307ddb943.tar.bz2
tools-c2ccb14ffff0e45398365e19dfd2874307ddb943.tar.xz
tools-c2ccb14ffff0e45398365e19dfd2874307ddb943.zip
Initial commit
Diffstat (limited to 'web')
-rw-r--r--web/all_news.bin1
-rwxr-xr-xweb/backupcopy129
-rwxr-xr-xweb/deploy.sh4
-rw-r--r--web/feed.xml1
-rwxr-xr-xweb/fetch.py62
-rwxr-xr-xweb/gameinfo.sh22
-rw-r--r--web/index.bin1
-rw-r--r--web/langs.txt5
-rwxr-xr-xweb/legacy51
-rw-r--r--web/news.html1
-rwxr-xr-xweb/news_to_html.py91
-rwxr-xr-xweb/newsfeed.py101
-rw-r--r--web/nf_main.xml1
-rwxr-xr-xweb/oldupdatelang.py164
-rw-r--r--web/original.po170
-rw-r--r--web/template.po84
-rwxr-xr-xweb/updatelang.py190
17 files changed, 1078 insertions, 0 deletions
diff --git a/web/all_news.bin b/web/all_news.bin
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/web/all_news.bin
@@ -0,0 +1 @@
+
diff --git a/web/backupcopy b/web/backupcopy
new file mode 100755
index 0000000..81601b0
--- /dev/null
+++ b/web/backupcopy
@@ -0,0 +1,129 @@
+#! /usr/bin/env python2.7
+# -*- coding: utf8 -*-
+#
+# Copyright (C) 2018 TMW-2
+# Author: Jesusalva
+
+import os
+
+defaultLang = "en"
+rootPath = "../../web/"
+
+langs=[]
+files={}
+originals={}
+
+# Populates the basic arrays
+def populate():
+ # Populate langs
+ o=open("langs.txt", "r")
+ for i in o:
+ langs.append(i.replace('\n',''))
+ o.close()
+
+ # Populate files
+ for i in os.listdir(rootPath):
+ if i.endswith(".php.en"):
+ print "Valid file: "+str(i)
+ files[i]={}
+ for x in langs:
+ files[i][x]={}
+
+ print str(files)
+# Write po files
+def writePoFile(nf,lg):
+ a=open("po/"+lg+".po", "a")
+ f=open(rootPath+nf, "r")
+
+ for line in f:
+ a.write("#, no-c-format\n")
+ a.write('msgid "%s"\n' % line.replace('\n', ''))
+ try:
+ if files[nf][lg][line] != line:
+ a.write('msgstr "%s"\n' % files[nf][lg][line].replace('\n',''))
+ else:
+ a.write('msgstr "%s"\n' % "")
+ except KeyError:
+ a.write('msgstr "%s"\n' % "")
+
+ a.write('\n')
+
+ a.close()
+
+# Creates/Loads stuff
+def genreadPoFile():
+ for a in langs:
+ print("Reading translations for "+a)
+ for i in files:
+ readPoFile(i,a)
+
+def generatePoFiles():
+ for a in langs:
+ print("Updating po file for "+a)
+ xrv=open("po/"+a+".po", "w")
+ # Print header
+ xrv.write('\
+# Copyright (C) 2018 TMW2\n\
+#\n\
+\n\
+msgid ""\n\
+msgstr ""\n\
+"Project-Id-Version: TMW2\\n"\n\
+"MIME-Version: 1.0\\n"\n\
+"Content-Type: text/plain; charset=UTF-8\\n"\n\
+"Content-Transfer-Encoding: 8bit\\n"\n\
+\n\
+')
+ xrv.close()
+
+ for i in files:
+ writePoFile(i,a)
+
+def generateLocal():
+ for a in langs:
+ print("generating local file for "+a)
+ for i in files:
+ writeLocal(i,a)
+
+# Reads Po Files
+def readPoFile(nf, lg):
+ try:
+ a=open("po/"+lg+".po", "r")
+ except:
+ a=open("po/"+lg+".po", "w")
+ a.close()
+ a=open("po/"+lg+".po", "r")
+
+ ctx=""
+ for line in a:
+ if "msgid " in line:
+ ctx=line.replace('\n','')
+ if "msgstr " in line and ctx != "":
+ if line != 'msgstr ""\n':
+ files[nf][lg][ctx]=line.replace('\n', '')
+ else:
+ files[nf][lg][ctx]=ctx
+ ctx=""
+ a.close()
+
+def writeLocal(nf, lg):
+ a=open(rootPath+nf[:-2]+lg, 'w')
+ b=open(rootPath+nf, 'r')
+
+ for line in b:
+ try:
+ a.write(files[nf][lg][line])
+ except KeyError:
+ a.write(line)
+
+ b.close()
+ a.close()
+
+# Mainframe: populate arrays
+populate()
+
+# Mainframe: handle PO files
+genreadPoFile()
+generatePoFiles()
+generateLocal()
+
diff --git a/web/deploy.sh b/web/deploy.sh
new file mode 100755
index 0000000..65c3bd2
--- /dev/null
+++ b/web/deploy.sh
@@ -0,0 +1,4 @@
+./news_to_html.py
+./newsfeed.py
+#cp news.html ../../web/
+cp feed.xml ../../web/tmw2.org/
diff --git a/web/feed.xml b/web/feed.xml
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/web/feed.xml
@@ -0,0 +1 @@
+
diff --git a/web/fetch.py b/web/fetch.py
new file mode 100755
index 0000000..c5fbeea
--- /dev/null
+++ b/web/fetch.py
@@ -0,0 +1,62 @@
+#! /usr/bin/env python2.7
+# -*- coding: utf8 -*-
+#
+# Copyright (C) 2018 TMW-2
+# Author: Jesusalva
+
+from transifex.api import TransifexAPI
+#import sys
+
+#if len(sys.argv) == 2:
+# if sys.argv[1] == "AllFilesVerified":
+# pass
+# else:
+# print("Rejected: Incorrect magic word.")
+# exit(1)
+#else:
+# print("Rejected: As this script is VULNERABLE TO CODE INJECTION, you cannot run this command without verifying all files at Transifex first.")
+# exit(1)
+print("\033[1mThis script is VULNERABLE TO CODE INJECTION. Git diff before deploying!\033[0m")
+
+project='moubootaur-legends'
+
+print("Loading user credentials (login.txt/password.txt) from lang/ folder...")
+
+# Load credentials from login.txt and password.txt
+login=open('../lang/login.txt', 'r')
+for i in login:
+ username=i.replace('\n', '').replace('\r', '')
+
+login.close()
+
+passw=open('../lang/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("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:
+ print("Fetching %s..." %(i))
+ t.get_translation(project, 'website', i, 'po/'+str(i)+'.po')
+
+print("All translations were retrieved.")
+print("Please sanitize files removing \"\\n\", or updatelang.py won't parse properly.")
diff --git a/web/gameinfo.sh b/web/gameinfo.sh
new file mode 100755
index 0000000..757ee96
--- /dev/null
+++ b/web/gameinfo.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+echo "Deploying news file..."
+scp -4 -P 22 feed.xml jesusalva@213.202.247.189:/home/jesusalva/http/
+scp -4 -P 22 ../update/news.txt jesusalva@213.202.247.189:/home/jesusalva/http/updates/
+
+echo "Begin - Gameinfo updater. User input required."
+cd ../../gameinfo-api
+
+cd serverdata
+git pull --rebase -X theirs
+cd ..
+
+cd clientdata
+git pull --rebase -X theirs
+cd ..
+
+git commit -a
+git push
+
+echo "Gameinfo updated! Mission complete!"
+
diff --git a/web/index.bin b/web/index.bin
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/web/index.bin
@@ -0,0 +1 @@
+
diff --git a/web/langs.txt b/web/langs.txt
new file mode 100644
index 0000000..c1cd357
--- /dev/null
+++ b/web/langs.txt
@@ -0,0 +1,5 @@
+pt-BR
+fr
+de
+es
+ru
diff --git a/web/legacy b/web/legacy
new file mode 100755
index 0000000..4629a06
--- /dev/null
+++ b/web/legacy
@@ -0,0 +1,51 @@
+#! /usr/bin/env python2.7
+# -*- coding: utf8 -*-
+#
+# Copyright (C) 2018 TMW-2
+# Author: Jesusalva
+
+import os
+import re
+
+defaultLang = "en"
+
+rootPath = "../../web/"
+
+filt = re.compile(".+[.]php", re.IGNORECASE)
+
+allFiles=[]
+langFiles = dict()
+langs = [] # Current languages
+
+# Read languages
+o=open("langs.txt", "r")
+for i in o:
+ langs.append(i.replace('\n',''))
+o.close()
+
+# Read PHP files, and create langFiles[i]["master"]
+for i in os.listdir(rootPath):
+ if i.endswith(".php"):
+ langFiles[i]={}
+ o=open(rootPath+'/'+i, 'r')
+ for line in o:
+ langFiles[i]["master"]=line
+ o.close()
+
+# Sort each language for stuff
+for a in langFiles:
+ for b in langs:
+ langFiles[a][b]=[]
+
+ cnt=0
+ pot=open("po/"+b+".po", "r")
+ for line in pot:
+ if "msgstr" in line:
+ abaco=str(line.replace('msgstr "','')[:-1])
+ if abaco != "":
+ langFiles[a][b].append(abaco)
+ else:
+ langFiles[a][b].append(langFiles[a][master][cnt])
+ cnt+=1
+
+ print str(langFiles[a][b])
diff --git a/web/news.html b/web/news.html
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/web/news.html
@@ -0,0 +1 @@
+
diff --git a/web/news_to_html.py b/web/news_to_html.py
new file mode 100755
index 0000000..4015a62
--- /dev/null
+++ b/web/news_to_html.py
@@ -0,0 +1,91 @@
+#! /usr/bin/env python
+# -*- coding: utf8 -*-
+#
+# Copyright (C) 2018 The Mana World 2
+# Author: Jonatas N. (Jesusalva)
+
+import datetime
+date=str(datetime.date.today())
+
+#date="2019-08-05"
+
+# Update the INDEX
+i1=open("index.bin", "r")
+i2=open("1index.bin", "w")
+for i in i1:
+ i2.write(i)
+i2.close()
+i1.close()
+i1=open("index.bin", "w")
+i2=open("1index.bin", "r")
+i1.write(date+'\n')
+for i in i2:
+ i1.write(i)
+i2.close()
+i1.close()
+i1=open("index.bin", "r")
+
+# Prepare to sort from newest to oldest
+dt=open("all_news.bin", "r")
+dc=open("backup.bin", "w")
+for i in dt:
+ dc.write(i)
+dc.close()
+dt.close()
+dt=open("all_news.bin", "w")
+dc=open("backup.bin", "r")
+
+# Read news and prepare header
+ns=open("../update/news.txt", "r")
+dt.write("\n<h3><a name="+date+">"+date+"</a></h3>\n\n<font color=black>")
+
+# Function to markup it, and strip new lines
+def markup(r):
+ r=r.replace('##0', '</font><font color=black>')
+ r=r.replace('##1', '<font color=red>')
+ r=r.replace('##2', '<font color=green>')
+ r=r.replace('##3', '<font color=blue>')
+ r=r.replace('##4', '<font color=gold>')
+ r=r.replace('##5', '<font color=yellow>')
+ r=r.replace('##6', '<font color=pink>')
+ r=r.replace('##7', '<font color=purple>')
+ r=r.replace('##8', '<font color=gray>')
+ r=r.replace('##9', '<font color=brown>')
+ r=r.replace('##B', '<b>')
+ r=r.replace('##b', '</b>')
+ r=r.replace('[@@', '<a href="')
+ r=r.replace('|', '">')
+ r=r.replace('@@]', '</a>')
+ return r
+def nn(r):
+ return r.replace('\n', '')
+
+# Write the news at all_news.bin, and then reload the backup. Finally, close the file
+for i in ns:
+ dt.write(markup(i)+'<br/>\n')
+dt.write("</font><hr/>")
+for i in dc:
+ dt.write(i)
+
+ns.close()
+dt.close()
+dc.close()
+
+# Write the final HTML page
+wp=open("news.html", "w")
+dt=open("all_news.bin", "r")
+
+wp.write("<!DOCTYPE HTML><html><head><title>Server News</title></head><body>")
+wp.write("<table border=1 align=left><tr><td>Archive</td></tr>")
+for i in i1:
+ wp.write('<tr><td><a href=#'+nn(i)+'>'+nn(i)+'</a></td></tr>')
+wp.write('</table><br/>')
+
+for line in dt:
+ wp.write(nn(line))
+wp.write("</body></html>")
+
+wp.close()
+dt.close()
+i1.close()
+
diff --git a/web/newsfeed.py b/web/newsfeed.py
new file mode 100755
index 0000000..5840ca4
--- /dev/null
+++ b/web/newsfeed.py
@@ -0,0 +1,101 @@
+#! /usr/bin/env python
+# -*- coding: utf8 -*-
+#
+# Copyright (C) 2018 The Mana World 2
+# Author: Jonatas N. (Jesusalva)
+
+import datetime
+date=str(datetime.date.today())
+fulldate=str(datetime.datetime.utcnow().isoformat())
+
+#date="2020-01-31"
+#fulldate="2020-01-31T11:45:20.543750"
+
+# Open file (Dt) and export to "old". (Src) is current news
+dt=open("nf_main.xml", "r")
+old=[]
+for line in dt:
+ old.append(line)
+dt.close()
+dt=open("nf_main.xml", "w")
+src=open("../update/news.txt", "r")
+
+
+# Read news and prepare header
+ns=open("../update/news.txt", "r")
+
+
+# Function to markup it, and strip new lines
+def markup(r):
+ r=r.replace('##0', '')
+ r=r.replace('##1', '')
+ r=r.replace('##2', '')
+ r=r.replace('##3', '')
+ r=r.replace('##4', '')
+ r=r.replace('##5', '')
+ r=r.replace('##6', '')
+ r=r.replace('##7', '')
+ r=r.replace('##8', '')
+ r=r.replace('##9', '')
+ r=r.replace('##B', '<b>')
+ r=r.replace('##b', '</b>')
+ r=r.replace('[@@', '<a href="')
+ r=r.replace('|', '">')
+ r=r.replace('@@]', '</a>')
+ return r
+def nn(r):
+ return r.replace('\n', '')
+
+# Write the news, and close that file
+dt.write(' <entry>\n')
+for i in src:
+ if ('##0 Actual Release: ##1' in i):
+ dt.write('\
+ <title>'+nn(i.replace('##0 Actual Release: ##1',''))+'</title>\n\
+ <link href="https://tmw2.org/news#'+date+'"/>\n\
+ <updated>'+fulldate+'</updated>\n\
+ <id>tag:tmw2.org,'+date+'</id>\n\
+ <content type="html"><![CDATA[')
+ else:
+ dt.write('<p>'+markup(i)+'</p>\n')
+dt.write("]]></content>\n </entry>")
+
+dt.write('\n\n')
+
+for i in old:
+ dt.write(i)
+
+src.close()
+dt.close()
+
+# Open main file as (Dt) and read from (Ns)
+dt=open("feed.xml", "w")
+ns=open("nf_main.xml", "r")
+
+# headers
+dt.write('\
+<?xml version="1.0" encoding="utf-8"?>\n\
+<feed xmlns="http://www.w3.org/2005/Atom">\n\
+ <title>TMW2</title>\n\
+ <link href="https://tmw2.org/feed.xml" rel="self"/>\n\
+ <link href="https://tmw2.org"/>\n\
+')
+dt.write(' <updated>'+fulldate+'</updated>\n')
+dt.write('\
+ <id>https://tmw2.org</id>\n\
+ <author>\n\
+ <name>TMW2 Project</name>\n\
+ <email>admin@tmw2.org</email>\n\
+ </author>\n\
+')
+
+# Write data
+for i in ns:
+ dt.write(i)
+
+# close
+dt.write('\n</feed>')
+
+dt.close()
+ns.close()
+
diff --git a/web/nf_main.xml b/web/nf_main.xml
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/web/nf_main.xml
@@ -0,0 +1 @@
+
diff --git a/web/oldupdatelang.py b/web/oldupdatelang.py
new file mode 100755
index 0000000..e7a367a
--- /dev/null
+++ b/web/oldupdatelang.py
@@ -0,0 +1,164 @@
+#! /usr/bin/env python3
+# -*- coding: utf8 -*-
+#
+# Copyright (C) 2018 TMW-2
+# Author: Jesusalva
+
+import os
+
+defaultLang = "en"
+rootPath = "../../web/"
+
+langs=[]
+files={}
+originals={}
+tm=["","\n"]
+
+def invalidline(line, filx="none"):
+ return (line.startswith("include ") or
+ line.startswith("<?php") or
+ line.startswith("?>") or
+ "<div " in line or
+ "</div>" in line or
+ "iframe" in line or
+ "header" in filx or
+ (line.startswith(" <p>") and line.endswith("<p>\n")) or
+ (line.startswith(" </p>") and line.endswith("</p>\n")) or
+ (line.startswith(" <pre><code>") and line.endswith("<code>\n")) or
+ (line.startswith(" </code></pre>") and line.endswith("</pre>\n")) or
+ line.replace('\n','') == "")
+
+# Populates the basic arrays
+def populate():
+ # Populate langs
+ o=open("langs.txt", "r")
+ for i in o:
+ langs.append(i.replace('\n',''))
+ o.close()
+
+ # Populate files
+ for i in os.listdir(rootPath):
+ if i.endswith(".php.en"):
+ print("Valid file: "+str(i))
+ files[i]={}
+ for x in langs:
+ files[i][x]={}
+
+ #print(str(files))
+
+
+# Creates/Loads stuff
+def genreadPoFile():
+ for a in langs:
+ print("Reading translations for "+a)
+ for i in files:
+ readPoFile(i,a)
+
+def generatePoFiles():
+ global tm
+ context=langs
+ context.append('en')
+ for a in langs:
+ print("Updating po file for "+a)
+ xrv=open("po/"+a+".po", "w")
+ # Prints header
+ xrv.write('\
+# Copyright (C) 2018 TMW2\n\
+#\n\
+\n\
+msgid ""\n\
+msgstr ""\n\
+"Project-Id-Version: TMW2\\n"\n\
+"MIME-Version: 1.0\\n"\n\
+"Content-Type: text/plain; charset=UTF-8\\n"\n\
+"Content-Transfer-Encoding: 8bit\\n"\n\
+\n\
+')
+ xrv.close()
+
+ tm=[""]
+ for i in files:
+ writePoFile(i,a)
+ context.remove('en')
+
+def generateLocal():
+ for a in langs:
+ print("generating local file for "+a)
+ for i in files:
+ writeLocal(i,a)
+
+
+
+# Write po files. TODO: WARNING: Some translations are getting overriden!
+def writePoFile(nf,lg):
+ # Translation Memory, to prevent duplicates
+ global tm
+
+ a=open("po/"+lg+".po", "a")
+ f=open(rootPath+nf, "r")
+
+ for line in f:
+ if line in tm or invalidline(line, nf):
+ continue
+ else:
+ tm.append(line)
+
+ a.write("#, no-c-format\n")
+ a.write('msgid "%s"\n' % line.replace('\n', '').replace('"','\\"'))
+ try:
+ if files[nf][lg][line.replace('\n', '')] != line.replace('\n', '') and files[nf][lg][line.replace('\n', '')] != "":
+ a.write('msgstr "%s"\n' % files[nf][lg][line.replace('\n', '')].replace('\n','').replace('"','\\"'))
+ else:
+ a.write('msgstr "%s"\n' % "")
+ except KeyError:
+ a.write('msgstr "%s"\n' % "")
+
+ a.write('\n')
+
+ a.close()
+
+
+# Reads Po Files
+def readPoFile(nf, lg):
+ try:
+ a=open("po/"+lg+".po", "r")
+ except:
+ a=open("po/"+lg+".po", "w")
+ a.close()
+ a=open("po/"+lg+".po", "r")
+
+ ctx=""
+ for line in a:
+ if "msgid " in line:
+ ctx=line.replace('"\n','').replace('\\"','"').replace('msgid "', "")
+ if "msgstr " in line and ctx != "":
+ if line != 'msgstr ""\n':
+ files[nf][lg][ctx]=line.replace('"\n', '').replace('\\"','"').replace('msgstr "', "")
+ else:
+ files[nf][lg][ctx]=ctx
+ ctx=""
+
+ a.close()
+
+def writeLocal(nf, lg):
+ a=open(rootPath+nf[:-2]+lg, 'w')
+ b=open(rootPath+nf, 'r')
+
+ for line in b:
+ try:
+ a.write(files[nf][lg][line.replace('\n', '')])
+ a.write('\n')
+ except KeyError:
+ a.write(line)
+
+ b.close()
+ a.close()
+
+# Mainframe: populate arrays
+populate()
+
+# Mainframe: handle PO files
+genreadPoFile()
+generatePoFiles()
+generateLocal()
+
diff --git a/web/original.po b/web/original.po
new file mode 100644
index 0000000..f27e280
--- /dev/null
+++ b/web/original.po
@@ -0,0 +1,170 @@
+# Copyright (C) 2018 TMW2
+#
+# Translators:
+# Jesusaves <cpntb1@ymail.com>, 2018
+msgid ""
+msgstr ""
+"Project-Id-Version: TMW2\n"
+"Last-Translator: Jesusaves <cpntb1@ymail.com>, 2018\n"
+"Language-Team: Portuguese (Brazil) (https://www.transifex.com/akaras/teams/959/pt_BR/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: pt_BR\n"
+"Plural-Forms: nplurals=2; plural=(n > 1);\n"
+
+#, no-c-format
+msgid "TMW-2: Monster World | Index Page"
+msgstr "TMW-2: Mundo dos Monstros | Página Inicial"
+
+#, no-c-format
+msgid " <h2>TMW-2: Monster Wars</h2>"
+msgstr "<h2>TMW-2: Guerra dos Monstros</h2>"
+
+#, no-c-format
+msgid ""
+" <p>The Monster World (2) is an open source MMORPG project developed by "
+"the community and for the community. We believe that players should be "
+"rewarded for merit, and not for game time or luck. TMW2 runs in the ManaPlus"
+" client, also opensource, and our game have its code database licensed under"
+" GPL 3 and resources (GFX,SFX,etc) typically under CC-BY-SA, although GPL "
+"content is also present.</p>"
+msgstr ""
+"<p>O Mundo dos Monstros (2) é um MMORPG de código aberto, desenvolvido pela "
+"comunidade e para comunidade. Acreditamos que os jogadores devem ser "
+"recompensados por mérito, e não por tempo de jogo ou sorte. TMW2 roda no "
+"cliente ManaPlus, também de código aberto, e nosso jogo tem seu código na "
+"licença GPL 3 e recursos (GFX, SFX, etc) tipicamente sobre CC-BY-SA, embora "
+"conteúdo GPL também esteja presente.</p>"
+
+#, no-c-format
+msgid ""
+" <p>In this game, the player is given the opportunity to permanently "
+"change the world and its story, affecting all players forever, mainly by "
+"events and quests. The players are free to decide how they want the world to"
+" develop, and their actions change the storyline, besides always being able "
+"to join the Development Team.</p>"
+msgstr ""
+"<p>Nesse jogo, o jogador recebe a oportunidade de permanentemente modificar "
+"o mundo e sua história, afetando todos os jogadores para sempre, "
+"principalmente por eventos e quests. Os jogadores são livres para decidir "
+"como querem que o mundo se desenvolva, e suas ações mudam a história, além "
+"de sempre serem capazes de se unir a Equipe de Desenvolvimento.</p>"
+
+#, no-c-format
+msgid "TMW-2: Monster World | Download Page"
+msgstr "TMW-2: Mundo dos Monstros | Página de Download"
+
+#, no-c-format
+msgid " <h2>Downloading the Game</h2>"
+msgstr " <h2>Baixando o Jogo</h2>"
+
+#, no-c-format
+msgid " <h3>Downloading the Client</h3>"
+msgstr " <h3>Baixando o Cliente</h3>"
+
+#, no-c-format
+msgid " <p>"
+msgstr " <p>"
+
+#, no-c-format
+msgid ""
+" The first step is to download <a href=https://manaplus.org "
+"rel=\"nofollow\">ManaPlus</a>,"
+msgstr ""
+" O primeiro passo é baixar o <a href=https://manaplus.org "
+"rel=\"nofollow\">ManaPlus</a>,"
+
+#, no-c-format
+msgid ""
+" our game client. If you download from a repository, ensure the "
+"version is"
+msgstr ""
+"nosso cliente de jogo. Se você baixar de um repositório, certifique-se que a"
+" versão é"
+
+#, no-c-format
+msgid " 1.7.x or greater. Older versions may present bugs."
+msgstr "1.7.x ou superior. Versões mais antigas podem apresentar erros."
+
+#, no-c-format
+msgid " </p>"
+msgstr " </p>"
+
+#, no-c-format
+msgid " <h3>Adding the Server</h3>"
+msgstr "<h3>Adicionando o Servidor</h3>"
+
+#, no-c-format
+msgid ""
+" Once the game opens, a server list will show. Select “Add”. Insert a"
+" server"
+msgstr ""
+"Quando o jogo abrir, uma lista de servidores será exibida. Clique em "
+"\"Adicionar\". Insira um"
+
+#, no-c-format
+msgid " name and description. The important data is as follow:"
+msgstr "nome de servidor e descrição. Os dados importantes são esses:"
+
+#, no-c-format
+msgid " <pre><code>"
+msgstr " <pre><code>"
+
+#, no-c-format
+msgid " <b>Address:</b> server.tmw2.org"
+msgstr " <b>Endereço:</b> server.tmw2.org"
+
+#, no-c-format
+msgid " <b>Port:</b> 6901"
+msgstr "<b>Porta:</b> 6901"
+
+#, no-c-format
+msgid " <b>Type:</b> Evol2"
+msgstr "<b>Tipo:</b> Evol2"
+
+#, no-c-format
+msgid " </code></pre>"
+msgstr "</code></pre>"
+
+#, no-c-format
+msgid ""
+" You'll need to register before playing the game. Please use a valid "
+"email"
+msgstr ""
+"Você precisará se registrar antes de jogar. Por favor utilize um endereço de"
+" email válido"
+
+#, no-c-format
+msgid ""
+" address as if we need to email your password back to you, we will do"
+" using"
+msgstr "já que se precisarmos lhe enviar a sua senha de volta, o faremos"
+
+#, no-c-format
+msgid " that email."
+msgstr "utilizando esse email."
+
+#, no-c-format
+msgid " <h3>Troubleshooting</h3>"
+msgstr "<h3>Solução de Problemas</h3>"
+
+#, no-c-format
+msgid ""
+" Game official release is 2018-03-02. If we are past this date and "
+"you're"
+msgstr ""
+"O lançamento oficial do jogo é 2018-03-02. Se essa data já passou e você"
+
+#, no-c-format
+msgid ""
+" getting a “servers unavailable” message, or is otherwise unable to "
+"connect,"
+msgstr ""
+"está recebendo uma mensagem de \"servidores indisponíveis\", ou não consegue"
+" se conectar,"
+
+#, no-c-format
+msgid " please contact us so we may fix this issue."
+msgstr ""
+"por favor entre em contato conosco para que possamos corrigir esse problema."
diff --git a/web/template.po b/web/template.po
new file mode 100644
index 0000000..16ce842
--- /dev/null
+++ b/web/template.po
@@ -0,0 +1,84 @@
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: 1.0\n"
+"Report-Msgid-Bugs-To: dev@tmw2.org\n"
+"POT-Creation-Date: 2020-02-28 05:43-0300\n"
+"PO-Revision-Date: 2020-02-28 05:43-0300\n"
+"Last-Translator: TMW2 Team <dev@tmw2.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+msgid "a string for testing"
+msgstr "uma linha para testar"
+
+msgid "$s Online Players"
+msgstr "$s Jogadores Online"
+
+msgid "Home"
+msgstr "Início"
+
+msgid "Community"
+msgstr "Comunidade"
+
+msgid "News"
+msgstr "Notícias"
+
+msgid "Legal Notice"
+msgstr "Nota Legal"
+
+msgid "Wiki & Info"
+msgstr "Wiki & Info"
+
+msgid "Get involved"
+msgstr "Se Involva"
+
+msgid "Making Art"
+msgstr "Pixelart"
+
+msgid "MapMaking"
+msgstr "Fazendo Mapas"
+
+msgid "Programming"
+msgstr "Programação"
+
+msgid "Game Content"
+msgstr "Conteúdo de Jogo"
+
+msgid "Music and SFX"
+msgstr "Música e SFX"
+
+msgid "Item Viewer"
+msgstr "Visualizador de Itens"
+
+msgid "Page not found"
+msgstr "Página não encontrada"
+
+msgid "Get in touch with the community!"
+msgstr "Entre em contato com a comunidade!"
+
+msgid ""
+"We have a great community that expands over many platforms with people from all over the world. If you have a question or you need help with something don't hesitate to ask us.\n"
+"Come visit us, and bring (or make) friends!"
+msgstr ""
+"We have a great community that expands over many platforms with people from all over the world. If you have a question or you need help with something don't hesitate to ask us.\n"
+"Come visit us, and bring (or make) friends!"
+
+msgid "Social Platforms"
+msgstr "Plataformas Sociais"
+
+msgid "Development"
+msgstr "Desenvolvimento"
+
+msgid "Support us"
+msgstr "Apoie-nos"
+
+msgid "You want to contribute in a way not listed above?"
+msgstr "Você quer contribuir de uma maneira não listada acima?"
+
+msgid "No problem!"
+msgstr "Sem problemas!"
+
+msgid "Reach out to us and tell us about it."
+msgstr "Entre em contato conosco e nos fale sobre."
diff --git a/web/updatelang.py b/web/updatelang.py
new file mode 100755
index 0000000..2eba12c
--- /dev/null
+++ b/web/updatelang.py
@@ -0,0 +1,190 @@
+#! /usr/bin/env python3
+# -*- coding: utf8 -*-
+#
+# Copyright (C) 2018~2020 TMW-2
+# Author: Jesusalva
+# Note: This will "force" completion to 100%. Use review system!
+
+import copy, datetime
+import polib, yaml
+
+defaultLang = "en"
+rootPath = "../../site/i18n/"
+
+langs=[]
+files={}
+originals={}
+tm={defaultLang: ["","\n"]}
+
+# Search for array[?]==search in an array of dicts
+# Returns the dictionary, or returns "ERROR"
+def dl_search(array, search):
+ for key in array.keys():
+ if array[key] == search:
+ return key
+ raise Exception("Key not found")
+
+# For headers
+def currentdate():
+ dt=datetime.datetime.now()
+
+ day=dt.timetuple()[2]
+ month=dt.timetuple()[1]
+ year=dt.timetuple()[0]
+
+ hour=dt.timetuple()[3]
+ minute=dt.timetuple()[4]
+ #second=5
+ #weekday=6
+ #yearday=7
+
+ return "%04d-%02d-%02d %02d:%02d-0300" % (year, month, day, hour, minute)
+
+
+def init():
+ global defaultLang, rootPath, langs, files, originals, tm
+ # Populate langs
+ o=open("langs.txt", "r")
+ for i in o:
+ langs.append(i.replace('\n',''))
+ o.close()
+
+ # Create the original file
+ f=open(rootPath+defaultLang+".yml", "r")
+ originals=yaml.load(f, Loader=yaml.FullLoader) # Dictionary
+ f.close()
+
+ # We don't care with metadata
+ del originals["language_meta"]
+
+ # Create each language's template
+ for i in langs:
+ files[str(i)]=copy.copy(originals)
+ tm[str(i)]=["","\n"]
+
+ """
+ # Do the reading for each language
+ for i in langs:
+ f=open(rootpath+i+".yml", "r")
+ files[str(i)]=yaml.load(f, Loader=yaml.FullLoader) # Dictionary
+ f.close()
+ """
+
+# [OK] Returns name from language code
+def lgname(lg):
+ if lg == "en":
+ return "English"
+ elif lg == "pt-BR":
+ return "Português (Brasil)"
+ elif lg == "de":
+ return "Deutsch"
+ elif lg == "fr":
+ return "François"
+ elif lg == "es":
+ return "Español"
+ elif lg == "ru":
+ return "Русский"
+ else:
+ return "Unknown %s" % lg
+
+# [OK] Entry
+def poentry(org, ttl, comments):
+ return polib.POEntry(msgid=org, msgstr=ttl, comment=comments)
+
+# Creates/Loads stuff
+def generatePoFiles():
+ global tm
+ context=copy.copy(langs)
+ context.append('en')
+ for lg in context:
+ print("Updating po file for "+lg)
+ po=polib.POFile()
+ po.metadata = {
+ 'Project-Id-Version': '1.0',
+ 'Report-Msgid-Bugs-To': 'dev@tmw2.org',
+ 'POT-Creation-Date': currentdate(),
+ 'PO-Revision-Date': currentdate(),
+ 'Last-Translator': 'TMW2 Team <dev@tmw2.org>',
+ 'MIME-Version': '1.0',
+ 'Content-Type': 'text/plain; charset=utf-8',
+ 'Content-Transfer-Encoding': '8bit',
+ }
+
+ for key, speech in originals.items():
+ # Translation Memory (no duplicates)
+ if speech in tm[lg]:
+ continue
+ tm[lg].append(speech)
+
+ # Add to po file
+ if lg == "en":
+ po.append(poentry(speech, "", key))
+ else:
+ po.append(poentry(speech, files[lg][key], key))
+
+ po.save("po/%s.po" % lg)
+ context.remove('en')
+
+
+
+
+
+# [OK] Reads Po Files
+def readPoFile(lg):
+ try:
+ po=polib.pofile("po/"+lg+".po")
+ except:
+ a=open("po/"+lg+".po", "w")
+ a.close()
+ print("%s.po does not exist, not reading" % lg)
+ return
+
+ print("%s Progress: %d%%" % (lgname(lg), po.percent_translated()))
+
+ for entry in po:
+ #print("%s = %s" % (entry.msgid, entry.msgstr))
+
+ try:
+ if entry.msgstr != "":
+ dest=dl_search(files[lg], entry.msgid)
+ #print("[+] %s" % dest)
+ files[lg][dest]=entry.msgstr
+ else:
+ dest=dl_search(files[lg], entry.msgid)
+ #print("%s.%s IS EMPTY" % (lg, dest))
+ try:
+ files[lg][dest]=originals[dest]
+ except:
+ print("%s - failed to obtain originals" % entry.msgid)
+ except:
+ print("%s - string was removed" % entry.msgstr)
+
+# [OK] Save the new YML file
+def writeLocal(lg):
+ f=open(rootPath+lg+".yml", 'w')
+ f.write("# THIS FILE WAS GENERATED AUTOMATICALLY\n#EDITING IT WILL HAVE NO EFFECT\n\n")
+ files[lg]["language_meta"]={"code": lg, "name": lgname(lg)}
+ yaml.dump(files[lg], f)
+ f.close()
+
+
+
+
+
+
+
+
+
+
+
+# Mainframe: setup
+init()
+
+# Save translations to their YML files
+for lg in langs:
+ readPoFile(lg)
+ writeLocal(lg)
+
+# Mainframe: handle PO files
+generatePoFiles()
+