[IMP] better translation menu

With the name of the language instead of the language key
This commit is contained in:
Martin Trigaux 2016-02-04 10:37:44 +01:00
parent 33bfa17b1e
commit bc17c13b24

View File

@ -278,6 +278,7 @@ github_project = 'documentation-user'
# Where are stored the localisations files # Where are stored the localisations files
locale_dirs = ['locale/'] locale_dirs = ['locale/']
LANGUAGES = {'nl': 'Dutch', 'es': 'Spanish', 'zn_CH': 'Chinese'}
def setup(app): def setup(app):
app.add_stylesheet('accounting.css') app.add_stylesheet('accounting.css')
@ -340,9 +341,9 @@ def localize(app, pagename, templatename, context, doctree):
return return
current_lang = app.config.language or 'en' current_lang = app.config.language or 'en'
context['language'] = current_lang.upper() context['language'] = LANGUAGES.get(current_lang, current_lang.upper())
context['languages'] = [ 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(',') for la in app.config.languages.split(',')
if la != current_lang if la != current_lang
] ]