Skip to content
Snippets Groups Projects
Commit 1dc17247 authored by Nadja Geisler's avatar Nadja Geisler :sunny:
Browse files

Merge branch 'feature-i18n' into 'master'

Introduce i18n support to frontend

See merge request kif/akplanning!2
parents 2dd4b91b 61e1fd7e
No related branches found
No related tags found
1 merge request!2Introduce i18n support to frontend
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-20 08:43+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: settings.py:124
msgid "German"
msgstr "Deutsch"
#: settings.py:125
msgid "English"
msgstr "Englisch"
......@@ -11,6 +11,8 @@ https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
from django.utils.translation import gettext_lazy as _
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
......@@ -108,7 +110,7 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'en-US'
TIME_ZONE = 'UTC'
......@@ -118,6 +120,11 @@ USE_L10N = True
USE_TZ = True
LANGUAGES = [
('de', _('German')),
('en', _('English')),
]
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
......
......@@ -19,4 +19,5 @@ from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('AKSubmission.urls', namespace='submit')),
path('i18n/', include('django.conf.urls.i18n')),
]
......@@ -52,6 +52,8 @@ Python requirements are listed in ``requirements.txt``. They can be installed wi
1. activate virtualenv ``source env/bin/activate``
1. install python requirements ``pip install -r requirements.txt``
1. setup necessary database tables etc. ``python manage.py migrate``
1. prepare static files (can be omitted for dev setups) ``python manage.py collectstatic``
1. compile translations ``python manage.py compilemessages``
1. create a priviledged user, credentials are entered interactively on CLI ``python manage.py createsuperuser``
1. deactivate virtualenv ``deactivate``
......
......@@ -18,6 +18,10 @@ pip install -r requirements.txt
# Setup database
python manage.py migrate
# Prepare static files and translations
python manage.py collectstatic --noinput
python manage.py compilemessages
# Create superuser
# Credentials are entered interactively on CLI
python manage.py createsuperuser
......
......@@ -24,4 +24,6 @@ if [ "$1" = "--prod" ]; then
fi
./manage.py migrate
./manage.py collectstatic --noinput
./manage.py compilemessages
touch AKPlanning/wsgi.py
{% load static %}
{% load i18n %}
{% load bootstrap4 %}
{% load fontawesome %}
......@@ -15,8 +16,39 @@
</head>
<body>
{% block language-switcher %}
<!-- language switcher -->
<div class="container" style="margin-top:20px">
<form action="{% url 'set_language' %}"
method="post"
class="form-inline"
name="language-form"
style="flex-direction: column;">
{% csrf_token %}
<div class="container" style="margin-top:20px;margin-bottom: 30px;">
<input name="next" type="hidden" value="{{ request.path }}" />
{% get_current_language as LANGUAGE_CODE %}
{% get_available_languages as LANGUAGES %}
{% get_language_info_list for LANGUAGES as languages %}
<div style="align-self: end;">
{% for language in languages %}
&nbsp;&nbsp;
<button type="submit"
class="btn {% if language.code == LANGUAGE_CODE %}btn-info{% else %}btn-outline-info{% endif %}"
name="language"
value="{{ language.code }}"
style="align-self: end;">
{{ language.code | upper }}
</button>
{% endfor %}
</div>
</form>
</div>
{% endblock %}
<div class="container" style="margin-top:15px;margin-bottom: 30px;">
<ol class="breadcrumb">
{% block breadcrumbs %}
{% endblock %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment