Improved language handling
This commit is contained in:
parent
c7f0fea8ae
commit
1d8d8d019d
5 changed files with 14 additions and 9 deletions
|
@ -1 +1 @@
|
|||
{{ contact.trans_title_styled|safe }}
|
||||
{% if html %}{{ contact.trans_title_styled|safe }}{% else %}{{ contact.trans_title }}{% endif %}
|
||||
|
|
|
@ -44,5 +44,6 @@ def contact_links(site_root):
|
|||
|
||||
# Styled contact name (header)
|
||||
@register.inclusion_tag('tags/contact_name.html')
|
||||
def contact_name(site_root):
|
||||
return { 'contact': get_contacts(site_root)['contact'] }
|
||||
def contact_name(site_root, html=True):
|
||||
contactname = get_contacts(site_root)['contact']
|
||||
return { 'contact': contactname, 'html': html }
|
||||
|
|
|
@ -8,8 +8,11 @@ class TranslatedField(object):
|
|||
|
||||
def __get__(self, instance, owner):
|
||||
if translation.get_language() == 'fr':
|
||||
return getattr(instance, self.fr_field)
|
||||
val = getattr(instance, self.fr_field)
|
||||
elif translation.get_language() == 'en':
|
||||
return getattr(instance, self.en_field)
|
||||
val = getattr(instance, self.en_field)
|
||||
else:
|
||||
return getattr(instance, self.de_field)
|
||||
if not val:
|
||||
return getattr(instance, self.de_field)
|
||||
return val
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
{% load compress static wagtailuserbar %}
|
||||
{% load compress static wagtailuserbar navigation information %}
|
||||
{% get_site_root as site_root %}
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>{% block title %}{% if self.seo_title %}{{ self.seo_title }}{% else %}{{ self.title }}{% endif %}{% endblock %}{% block title_suffix %}{% endblock %}</title>
|
||||
<title>{% block title %}{% if self.seo_title %}{{ self.seo_title }}{% else %}{% if page.trans_title %}{{ page.trans_title }} - {% endif %}{% contact_name site_root=site_root html=False %}{% endif %}{% endblock %}{% block title_suffix %}{% endblock %}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="{% block description %}{% endblock %}">
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
</footer>
|
||||
|
||||
<div class="copyright">
|
||||
© 2018 Public Health Schweiz
|
||||
• <a href="/privacy/">Privacy Terms</a>
|
||||
© 2018 {% contact_name site_root=site_root %}
|
||||
• <a href="/privacy/">Privacy</a>
|
||||
• <a href="/impressum/">Impressum</a>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue