mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2025-07-18 06:06:06 -04:00
The new documentation system has been finished. Doc needs to be updated
This commit is contained in:
23
doc/documentation_importer.py
Normal file
23
doc/documentation_importer.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
""" 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.
|
||||
@fileSource str: A markdown(.md) file.
|
||||
@fileDest str: A file where this will put the new strings"""
|
||||
|
||||
f1 = open(fileSource, "r")
|
||||
f2 = open(fileDest, "w")
|
||||
lns = f1.readlines()
|
||||
f2.write("# -*- coding: utf-8 -*-\n")
|
||||
f2.write("documentation = []\n")
|
||||
for i in lns:
|
||||
if len(i) > 2:
|
||||
newvar = "documentation.append(_(u\"\"\"%s\"\"\"))\n" % (i[:-2])
|
||||
else:
|
||||
newvar = "documentation.append(_(u\"\"\"%s\"\"\"))\n" % (i)
|
||||
f2.write(newvar)
|
||||
f1.close()
|
||||
f2.close()
|
||||
|
||||
|
Reference in New Issue
Block a user