Read in docstrings from lang-specific docstring dictionary. Transfer docstrings, translated to lang, from a dictionary-file to the methods of classes Screen and Turtle and - in revised form - to the corresponding functions.
(lang)
| 3751 | f.close() |
| 3752 | |
| 3753 | def read_docstrings(lang): |
| 3754 | """Read in docstrings from lang-specific docstring dictionary. |
| 3755 | |
| 3756 | Transfer docstrings, translated to lang, from a dictionary-file |
| 3757 | to the methods of classes Screen and Turtle and - in revised form - |
| 3758 | to the corresponding functions. |
| 3759 | """ |
| 3760 | modname = "turtle_docstringdict_%(language)s" % {'language':lang.lower()} |
| 3761 | module = __import__(modname) |
| 3762 | docsdict = module.docsdict |
| 3763 | for key in docsdict: |
| 3764 | try: |
| 3765 | # eval(key).im_func.__doc__ = docsdict[key] |
| 3766 | eval(key).__doc__ = docsdict[key] |
| 3767 | except Exception: |
| 3768 | print("Bad docstring-entry: %s" % key) |
| 3769 | |
| 3770 | _LANGUAGE = _CFG["language"] |
| 3771 |