Modified documentation importer for unicode strings

This commit is contained in:
Manuel Cortez 2019-11-26 09:40:49 -06:00
parent b90eb1fc8f
commit ed52202017

View File

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from codecs import open
""" This script converts the hold documentation (saved in markdown files) in a python file with a list of strings to translate it using gettext.""" """ 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): def prepare_documentation_in_file(fileSource, fileDest):
@ -6,8 +7,8 @@ def prepare_documentation_in_file(fileSource, fileDest):
@fileSource str: A markdown(.md) file. @fileSource str: A markdown(.md) file.
@fileDest str: A file where this will put the new strings""" @fileDest str: A file where this will put the new strings"""
f1 = open(fileSource, "r") f1 = open(fileSource, "r", encoding="utf-8")
f2 = open(fileDest, "w") f2 = open(fileDest, "w", encoding="utf-8")
lns = f1.readlines() lns = f1.readlines()
f2.write("# -*- coding: utf-8 -*-\n") f2.write("# -*- coding: utf-8 -*-\n")
f2.write("documentation = [\n") f2.write("documentation = [\n")
@ -23,5 +24,6 @@ def prepare_documentation_in_file(fileSource, fileDest):
f2.write("]") f2.write("]")
f2.close() f2.close()
prepare_documentation_in_file("manual.md", "strings.py") prepare_documentation_in_file("manual.md", "strings.py")
prepare_documentation_in_file("changelog.md", "changelog.py") prepare_documentation_in_file("changelog.md", "changelog.py")