Mercurial > hg > Blog
changeset 46:ea8a767f5111
fiddle with L10N: generate the proper <html lang=""> element into the article page,
depending on a page's defined locale with fallback to the default locale
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Thu, 02 Oct 2014 04:19:34 +0200 |
parents | 84aa3a9a4001 |
children | 20b38f558fee |
files | pelicanconf.py themes/tuxlite_tbs/templates/article.html themes/tuxlite_tbs/templates/base.html |
diffstat | 3 files changed, 13 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/pelicanconf.py Thu Oct 02 04:13:28 2014 +0200 +++ b/pelicanconf.py Thu Oct 02 04:19:34 2014 +0200 @@ -7,8 +7,9 @@ SITEURL = 'http://xanthippe.duckdns.org/blog' ARCHIVES_URL = 'archives.html' -LOCALE = 'de_DE' +DEFAULT_LANG = u'de' TIMEZONE = 'Europe/Berlin' +DEFAULT_DATE_FORMAT = u'%d.%m.%Y' TYPOGRIFY = True PLUGIN_PATHS = ['../simple_comments'] @@ -29,9 +30,6 @@ THEME = 'themes/tuxlite_tbs' DISPLAY_CATEGORIES_ON_MENU = False -DEFAULT_LANG = u'de_DE' -DEFAULT_DATE_FORMAT = u'%d.%m.%Y' - # Feed generation is usually not desired when developing FEED_ALL_ATOM = None CATEGORY_FEED_ATOM = None
--- a/themes/tuxlite_tbs/templates/article.html Thu Oct 02 04:13:28 2014 +0200 +++ b/themes/tuxlite_tbs/templates/article.html Thu Oct 02 04:19:34 2014 +0200 @@ -1,4 +1,12 @@ {% extends "base.html" %} +{% block htmlspec %} +{% if article.metadata.lang %} +<html lang="{{ article.metadata.lang }}"> +{% else %} +{{ super() }} +{% endif %} +{% endblock %} + {% block content %} <div class='article'> <div class="content-title">
--- a/themes/tuxlite_tbs/templates/base.html Thu Oct 02 04:13:28 2014 +0200 +++ b/themes/tuxlite_tbs/templates/base.html Thu Oct 02 04:19:34 2014 +0200 @@ -1,5 +1,7 @@ <!DOCTYPE html> -<html lang="de-DE"> +{% block htmlspec %} +<html lang="{{ DEFAULT_LANG }}"> +{% endblock %} <head> <meta charset="utf-8"> <title>{% block windowtitle %}{{ SITENAME }}{% endblock %}</title>