Added changelog to the translatable documentation

This commit is contained in:
2016-10-09 10:45:47 -05:00
parent b3451e229d
commit 7a2e51ef03
5 changed files with 30 additions and 15 deletions

View File

@@ -5,16 +5,28 @@ from codecs import open as _open
import languageHandler
languageHandler.setLanguage("en")
import strings
import changelog
# the list of supported language codes of TW Blue
languages = ["en", "es", "fr", "de", "it", "gl", "ja", "ru", "ro"]
#"eu", "ar", "ca", "es", "fi", "fr", "gl", "hu", "it", "pl", "pt", "ru", "tr"]
def generate_document(language):
def generate_document(language, document_type="documentation"):
reload(languageHandler)
languageHandler.setLanguage(language)
reload(strings)
markdown_file = markdown.markdown("\n".join(strings.documentation[1:]), extensions=["markdown.extensions.toc"])
if document_type == "documentation":
translation_file = "twblue-documentation"
languageHandler.setLanguage(language, translation_file)
reload(strings)
markdown_file = markdown.markdown("\n".join(strings.documentation[1:]), extensions=["markdown.extensions.toc"])
title = strings.documentation[0]
filename = "manual.html"
elif document_type == "changelog":
translation_file = "twblue-changelog"
languageHandler.setLanguage(language, translation_file)
reload(changelog)
markdown_file = markdown.markdown("\n".join(changelog.documentation[1:]), extensions=["markdown.extensions.toc"])
title = changelog.documentation[0]
filename = "changelog.html"
first_html_block = """<!doctype html>
<html lang="%s">
<head>
@@ -23,12 +35,12 @@ def generate_document(language):
</head>
<body>
<header><h1>%s</h1></header>
""" % (language, strings.documentation[0], strings.documentation[0])
""" % (language, title, title)
first_html_block = first_html_block+ markdown_file
first_html_block = first_html_block + "\n</body>\n</html>"
if not os.path.exists(language):
os.mkdir(language)
mdfile = _open("%s/manual.html" % language, "w", encoding="utf-8")
mdfile = _open("%s/%s" % (language, filename), "w", encoding="utf-8")
mdfile.write(first_html_block)
mdfile.close()
@@ -37,6 +49,7 @@ def create_documentation():
for i in languages:
print("Creating documentation for: %s" % (i,))
generate_document(i)
generate_document(i, "changelog")
print("Done")
create_documentation()