I have a dictionary in my python code which contains language codes and names: {'eng': English,'ger': German,....}. I have created variable in my sphinx conf.py file equivalent to this dictionary and I want to use that variable and show it in my sphinx documentation with table which has 2 columns: code, name. I am using csv-table to show data.
I have tried to join keys and values in one string and show without tables but there was a problem with new lines.
Some code below:
In constants.py
LANGS = {
'eng': 'en',
'ger': 'de',
'fra': 'fr',
'spa': 'es',
'ita': 'it',
'por': 'pt',
'gre': 'el',
....
}
In conf.py
for k, v in LANGS.iteritems():
ll = pycountry.languages.get(alpha_2=v)
if ll is not None:
languages[k] = ll.name
rst_epilog = """.. |languages| replace:: {languages} """.format(languages=languages)