Commit d7827927 authored by chris's avatar chris

Enable translations

parent 38385596
......@@ -38,7 +38,7 @@
{% if object.title != 'Welcome' %}
<div id="footer">
<div class="pagewrap" style="padding: 10px; text-align: center;"><a href="{{ settings.site_address }}">{{ settings.site_name }}</a> website uses <a href="http://www.tobald.eu.org/projects/flyers/">Flyers</a></div></div>
<div class="pagewrap" style="padding: 10px; text-align: center;"><a href="{{ settings.site_address }}">{{ settings.site_name }}</a> website uses <a href="http://www.tobald.eu.org/projects/flyers/">Flyers</a>.</div></div>
</div>
{% endif %}
</div>
......@@ -54,22 +54,19 @@
</div>
</div>
{% if SITE_MULTILINGUAL %}
{% if site_multilingual %}
<div id="languageselect">
<form action="/i18n/setlang/" method="post" name="langForm" class="langForm">
<form action="{% url 'set_language' %}" method="post" name="langForm" class="langForm">
{% csrf_token %}
<input name="next" type="hidden" value="/{{ page.slug }}/" />
<select name="language" onChange="langForm.submit();" >
{% for lang in LANGUAGES %}
{% ifequal lang.0 LANGUAGE_CODE %}
<option value="#" />{{ lang.1 }}</option>
{% endifequal %}
{% endfor %}
{% for lang in LANGUAGES %}
{% ifnotequal lang.0 LANGUAGE_CODE %}
<option value="{{ lang.0 }}" />{{ lang.1 }}</option>
{% endifnotequal %}
{% endfor %}
<input name="next" type="hidden" value="{{ redirect_to }}" />
<select name="language" onChange="langForm.submit();">
{% get_language_info_list for LANGUAGES as languages %}
{% for language in languages %}
<option value="{{ language.code }}"{% if language.code == LANGUAGE_CODE %} selected="selected"{% endif %}>
{{ language.name_local }}
</option>
{% endfor %}
</select>
</form>
</div>
......
......@@ -4,7 +4,7 @@
{% block title %} - {{ object.title }}{% endblock %}
{% block content %}
{% if object.text or object.page_set.all|length > 0 %}
{% if object.title != 'Welcome' %}
<div class="pagewrap">
<div class="page">
<div class="pagelinks">
......@@ -16,7 +16,9 @@
{% if object.file_set.all %} <a href="#file">Files</a>{% endif %}
</div>
<div class="pagetitle">{{ object.title }}</div>
{% if object.text %}
<div class="pagetext">{{ object.text|safe|urlize|linebreaks }}</div>
{% endif %}
</div>
......
from django.conf import settings
from .models import Settings
def settings(request):
def general(request):
try:
settings = Settings.objects.get(pk=1)
s = Settings.objects.get(pk=1)
except:
settings = None
return {'settings': settings}
s = None
return {'settings': s,
'site_multilingual': settings.SITE_MULTILINGUAL}
......@@ -48,6 +48,7 @@ MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
......@@ -93,7 +94,7 @@ CKEDITOR_UPLOAD_PATH = os.path.join(BASE_DIR, 'media', 'uploads')
from django.conf import global_settings
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
'flyers.content.context_processors.menu',
'flyers.general.context_processors.settings',
'flyers.general.context_processors.general',
)
......@@ -114,4 +115,3 @@ try:
from local_settings import *
except ImportError, e:
pass
......@@ -23,6 +23,7 @@ urlpatterns = patterns('',
#url(r'^ckeditor/', include('ckeditor.urls')),
url(r'^ckeditor/', include('flyers.urls_ckeditor')),
#url(r'^$', TemplateView.as_view(template_name='homepage.html')),
(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^$', HomepageDetail.as_view()),
url(r'^(?P<slug>.+)/$', DetailView.as_view(model=Page)),
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment