diff --git a/.gitignore b/.gitignore index a930df61..495a2234 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,5 @@ src/launcher.bat src/sounds/iOs release-snapshot/ src/com_cache/ -doc/strings.py \ No newline at end of file +doc/strings.py +doc/changelog.py \ No newline at end of file diff --git a/doc/documentation_importer.py b/doc/documentation_importer.py index bd1a2f31..cfe00765 100644 --- a/doc/documentation_importer.py +++ b/doc/documentation_importer.py @@ -2,7 +2,7 @@ """ This script converts the hold documentation (saved in markdown files) in a python file with a list of strings to translate it using gettext.""" def prepare_documentation_in_file(fileSource, fileDest): - """ This takes documentation written in a markdown file and put all the contents in a python file, to create a internationalized documentation. + """ This takes documentation written in a markdown file and put all the contents in a python file, to create a translatable documentation. @fileSource str: A markdown(.md) file. @fileDest str: A file where this will put the new strings""" @@ -18,11 +18,11 @@ def prepare_documentation_in_file(fileSource, fileDest): newvar = "_(u\"\"\"%s\"\"\"),\n" % (i[:-1]) else: newvar = "_(u\"\"\"%s\"\"\"),\n" % (i) -# print i[-1:] f2.write(newvar) f1.close() f2.write("]") f2.close() -prepare_documentation_in_file("manual.md", "strings.py") \ No newline at end of file +prepare_documentation_in_file("manual.md", "strings.py") +prepare_documentation_in_file("changelog.md", "changelog.py") \ No newline at end of file diff --git a/doc/generator.py b/doc/generator.py index 730f0bc4..1fee65aa 100644 --- a/doc/generator.py +++ b/doc/generator.py @@ -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 = """
@@ -23,12 +35,12 @@ def generate_document(language):