diff --git a/Dockerfile b/Dockerfile
index 7eb7bbe..6d42235 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-FROM alpine:3.8
+FROM alpine:3.10
MAINTAINER Claudio Maggioni (praticamentetilde)
@@ -41,6 +41,7 @@ COPY . /home/app/code/
RUN chown -R app: /home/app
RUN sh -c "cd /home/app/code && python3 ./manage.py collectstatic --no-input"
+RUN sh -c "cd /home/app/code && python3 ./manage.py compilemessages"
EXPOSE 8000
CMD ["/usr/sbin/uwsgi", "--ini", "/home/app/code/uwsgi.ini", "--plugin", "python3"]
diff --git a/arrowcounter/settings.py b/arrowcounter/settings.py
index c134c24..53ee282 100644
--- a/arrowcounter/settings.py
+++ b/arrowcounter/settings.py
@@ -29,7 +29,7 @@ ALLOWED_HOSTS = os.environ["ALLOWED_HOSTS"].split()
AUTH_USER_MODEL = 'user.CounterUser'
-LOGIN_URL = "auth/login/"
+LOGIN_URL = "/accounts/login"
LOGIN_REDIRECT_URL = "/"
@@ -123,7 +123,13 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/2.1/topics/i18n/
-LANGUAGE_CODE = 'it'
+SITE_ROOT = os.path.dirname(os.path.realpath(__name__))
+LOCALE_PATHS = ( os.path.join(SITE_ROOT, 'locale'), )
+
+LANGUAGES = (
+ ('it', 'Italiano'),
+ ('en', 'English')
+)
TIME_ZONE = 'Europe/Rome'
diff --git a/counter/models.py b/counter/models.py
index 237d44f..cf55144 100644
--- a/counter/models.py
+++ b/counter/models.py
@@ -1,9 +1,10 @@
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
+from django.utils.translation import gettext_lazy as _
class Target(models.Model):
- target = models.PositiveIntegerField('Target to reach')
+ target = models.PositiveIntegerField(_('Target to reach'))
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE,
@@ -15,8 +16,8 @@ class ArrowCount(models.Model):
settings.AUTH_USER_MODEL,
on_delete=models.CASCADE
)
- date = models.DateField('Training date')
- count = models.PositiveIntegerField('Arrow count for the day')
+ date = models.DateField(_('Training date'))
+ count = models.PositiveIntegerField(_('Arrow count for the day'))
def __str__(self):
return self.date.strftime("%x") + ": " + str(self.count)
diff --git a/counter/templates/403.html b/counter/templates/403.html
index edd620c..c57e36c 100644
--- a/counter/templates/403.html
+++ b/counter/templates/403.html
@@ -1,8 +1,15 @@
{% extends "base.html" %}
-{% block title %}Not authorized{% endblock %}
+{% load i18n %}
+
+{% block title %}{% trans "Not authorized" %}{% endblock %}
{% block content %}
-
Not authorized
-
You are not authorized to perform this action. Please return to the home.
+
{% trans "Not authorized" %}
+
+{% url "index" as link %}
+{% blocktrans with link=link %}
+You are not authorized to perform this action. Please return to the home.
+{% endblocktrans %}
+
{% endblock %}
diff --git a/counter/templates/404.html b/counter/templates/404.html
index 635af94..c469d38 100644
--- a/counter/templates/404.html
+++ b/counter/templates/404.html
@@ -1,8 +1,15 @@
{% extends "base.html" %}
-{% block title %}Page not found{% endblock %}
+{% load i18n %}
+
+{% block title %}{% trans "Page not found" %}{% endblock %}
{% block content %}
-