From bc17c13b24628288624a58c2177d708b7b13570d Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Thu, 4 Feb 2016 10:37:44 +0100 Subject: [PATCH] [IMP] better translation menu With the name of the language instead of the language key --- conf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/conf.py b/conf.py index a1be11b7c..9792c7cf5 100644 --- a/conf.py +++ b/conf.py @@ -278,6 +278,7 @@ github_project = 'documentation-user' # Where are stored the localisations files locale_dirs = ['locale/'] +LANGUAGES = {'nl': 'Dutch', 'es': 'Spanish', 'zn_CH': 'Chinese'} def setup(app): app.add_stylesheet('accounting.css') @@ -340,9 +341,9 @@ def localize(app, pagename, templatename, context, doctree): return current_lang = app.config.language or 'en' - context['language'] = current_lang.upper() + context['language'] = LANGUAGES.get(current_lang, current_lang.upper()) context['languages'] = [ - (la.upper(), _build_url(app.config.canonical_root, (la != 'en' and la or ''), pagename)) + (LANGUAGES.get(la, la.upper()), _build_url(app.config.canonical_root, (la != 'en' and la or ''), pagename)) for la in app.config.languages.split(',') if la != current_lang ]