')
+
+for line in dt:
+ wp.write(nn(line))
+wp.write("")
+
+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', '')
+ r=r.replace('##b', '')
+ r=r.replace('[@@', '')
+ r=r.replace('@@]', '')
+ return r
+def nn(r):
+ return r.replace('\n', '')
+
+# Write the news, and close that file
+dt.write(' \n')
+for i in src:
+ if ('##0 Actual Release: ##1' in i):
+ dt.write('\
+ '+nn(i.replace('##0 Actual Release: ##1',''))+'\n\
+ \n\
+ '+fulldate+'\n\
+ tag:tmw2.org,'+date+'\n\
+ '+markup(i)+'
\n')
+dt.write("]]>\n ")
+
+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('\
+\n\
+\n\
+ TMW2\n\
+ \n\
+ \n\
+')
+dt.write(' '+fulldate+'\n')
+dt.write('\
+ https://tmw2.org\n\
+ \n\
+ TMW2 Project\n\
+ admin@tmw2.org\n\
+ \n\
+')
+
+# Write data
+for i in ns:
+ dt.write(i)
+
+# close
+dt.write('\n')
+
+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("") or
+ "
" in line or
+ "iframe" in line or
+ "header" in filx or
+ (line.startswith("
") and line.endswith("
\n")) or
+ (line.startswith("
") and line.endswith("\n")) or
+ (line.startswith("
") and line.endswith("\n")) or
+ (line.startswith("
") and line.endswith("\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 , 2018
+msgid ""
+msgstr ""
+"Project-Id-Version: TMW2\n"
+"Last-Translator: Jesusaves , 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 "
TMW-2: Monster Wars
"
+msgstr "
TMW-2: Guerra dos Monstros
"
+
+#, no-c-format
+msgid ""
+"
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.
"
+msgstr ""
+"
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.
"
+
+#, no-c-format
+msgid ""
+"
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.
"
+msgstr ""
+"
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.
"
+
+#, no-c-format
+msgid "TMW-2: Monster World | Download Page"
+msgstr "TMW-2: Mundo dos Monstros | Página de Download"
+
+#, no-c-format
+msgid "
Downloading the Game
"
+msgstr "
Baixando o Jogo
"
+
+#, no-c-format
+msgid "
Downloading the Client
"
+msgstr "
Baixando o Cliente
"
+
+#, no-c-format
+msgid "
"
+msgstr "
"
+
+#, no-c-format
+msgid ""
+" The first step is to download ManaPlus,"
+msgstr ""
+" O primeiro passo é baixar o ManaPlus,"
+
+#, 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 "
"
+msgstr " "
+
+#, no-c-format
+msgid "
Adding the Server
"
+msgstr "
Adicionando o Servidor
"
+
+#, 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 "
"
+
+#, 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 "
Troubleshooting
"
+msgstr "
Solução de Problemas
"
+
+#, 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 \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 ',
+ '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()
+
--
cgit v1.2.3-70-g09d2