From b88f5d6266525baae86618f2f3302c1d072c5014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9COMosimege=E2=80=9D?= <“onalerona.mosimege@gmail.com”> Date: Thu, 6 Jun 2024 09:26:19 +0200 Subject: [PATCH] add translations wrapping to templates --- app/templates/400.html | 7 +++--- app/templates/403.html | 7 +++--- app/templates/404.html | 7 +++--- app/templates/500.html | 7 +++--- app/templates/app/home.html | 35 +++++++++++++++-------------- app/templates/app/institutions.html | 17 +++++++++----- app/templates/app/search.html | 31 ++++++++++++------------- app/templates/base.html | 14 ++++++------ app/templates/base_error.html | 3 ++- 9 files changed, 70 insertions(+), 58 deletions(-) diff --git a/app/templates/400.html b/app/templates/400.html index d861cf6c..f0becc31 100644 --- a/app/templates/400.html +++ b/app/templates/400.html @@ -1,11 +1,12 @@ {% extends "base_error.html" %} +{% load i18n %} {% block error_content %}
-
Bad Request (400)
-

The server cannot process the request due to client error.

- Go to home +
{% trans "Bad Request (400)" %}
+

{% trans "The server cannot process the request due to client error." %}"

+ {% trans "Go to home" %}
{% endblock error_content %} diff --git a/app/templates/403.html b/app/templates/403.html index 6da09393..817aebe9 100644 --- a/app/templates/403.html +++ b/app/templates/403.html @@ -1,11 +1,12 @@ {% extends "base_error.html" %} +{% load i18n %} {% block error_content %}
-
Forbidden (403)
-

You do not have permission to access on this server.

- Go to home +
{% trans "Forbidden (403)" %}
+

{% trans "You do not have permission to access on this server." %}

+ {% trans "Go to home" %}
{% endblock error_content %} diff --git a/app/templates/404.html b/app/templates/404.html index a13b12a4..35273803 100644 --- a/app/templates/404.html +++ b/app/templates/404.html @@ -1,11 +1,12 @@ {% extends "base_error.html" %} +{% load i18n %} {% block error_content %}
-
Not Found (404)
-

The requested resource was not found on this server.

- Go to home +
{% trans "Not Found (404)" %}
+

{% trans "The requested resource was not found on this server." %}

+ {% trans "Go to home" %}
{% endblock error_content %} diff --git a/app/templates/500.html b/app/templates/500.html index f314b680..577db847 100644 --- a/app/templates/500.html +++ b/app/templates/500.html @@ -1,11 +1,12 @@ {% extends "base_error.html" %} +{% load i18n %} {% block error_content %}
-
Internal Server Error (500)
-

The server encountered an unexpected condition that prevented it from fulfilling the request.

- Go to home +
{% trans "Internal Server Error (500)" %}
+

{% trans "The server encountered an unexpected condition that prevented it from fulfilling the request." %}

+ {% trans "Go to home" %}
{% endblock error_content %} diff --git a/app/templates/app/home.html b/app/templates/app/home.html index b051858f..51f7d962 100644 --- a/app/templates/app/home.html +++ b/app/templates/app/home.html @@ -1,5 +1,6 @@ {% extends "base.html" %} {% load static %} +{% load i18n %} {% block content %} @@ -7,22 +8,22 @@
-
Welcome
+
{% trans "Welcome" %}

- The South African Centre for Digital Language Resources (SADiLaR) is a national research + {% blocktrans %}The South African Centre for Digital Language Resources (SADiLaR) is a national research infrastructure that aims to ensure a digital future for our official languages. It supports researchers in the fields of digital humanities and social sciences and also assists - institutions in their language implementation plans. - Read more about SADiLaR. + institutions in their language implementation plans.{% endblocktrans %} + {% blocktrans %}Read more about SADiLaR.{% endblocktrans %}

- SADiLaR conducted an audit at South African public higher education institutions that highlighted - areas that require attention. - Read the report. + {% blocktrans %}SADiLaR conducted an audit at South African public higher education institutions that highlighted + areas that require attention.{% endblocktrans %} + {% blocktrans %}Read the report.{% endblocktrans %}

- This platform highlights previous and current work at institutions to encourage collaboration and - disseminate resources. + {% blocktrans %}This platform highlights previous and current work at institutions to encourage collaboration and + disseminate resources.{% endblocktrans %}

@@ -32,17 +33,17 @@
Welcome
-
Search
+
{% trans "Search" %}

- This platforms hosts terminology and other useful language resources. + {% blocktrans %}This platforms hosts terminology and other useful language resources.{% endblocktrans %}

- Search for a term or topic you are interested in. - (Functionality coming soon.) + {% blocktrans %}Search for a term or topic you are interested in. + (Functionality coming soon.){% endblocktrans %}

{# TODO: create the search box right here so that no additional click is required. #} - Search a term + {% trans "Search a term" %}
@@ -52,12 +53,12 @@
Search
-
Institutions
+
{% trans "Institutions" %}

- Browse information by institution. + {% trans "Browse information by institution." %}

- View + {% trans "View" %}
diff --git a/app/templates/app/institutions.html b/app/templates/app/institutions.html index 03aaee39..c0247b5f 100644 --- a/app/templates/app/institutions.html +++ b/app/templates/app/institutions.html @@ -1,5 +1,6 @@ {% extends "base.html" %} {% load static %} +{% load i18n %} {% block content %} @@ -14,15 +15,19 @@
{{ institution.name }}
{{ institution.abbreviation }}

- {% if institution.project_count == 0 %} - no applicable project - {% else %} - {{institution.project_count}} applicable projects - {% endif %} + {% if institution.project_count == 0 %} + {% blocktrans %}no applicable project{% endblocktrans %} + {% else %} + {% blocktrans count project_count=institution.project_count %} + {{ project_count }} applicable project + {% plural %} + {{ project_count }} applicable projects + {% endblocktrans %} + {% endif %}

-

Profile completion:

+

{% trans "Profile completion:" %}

{% if institution.rating <= 20 %} diff --git a/app/templates/app/search.html b/app/templates/app/search.html index 94498f18..55264498 100644 --- a/app/templates/app/search.html +++ b/app/templates/app/search.html @@ -1,5 +1,6 @@ {% extends "base.html" %} {% load static %} +{% load i18n %} {% block content %} @@ -7,19 +8,19 @@
-
Search a term
+
{% trans "Search a term" %}
{% if feature_flag == "search_feature" %} {# test section start#}
- +
- Results: + {% trans "Results:" %} {{ documents|length }}
@@ -27,31 +28,31 @@
Search a term
  • - Title: + {% trans "Title:" %} {{ document.title }}
  • - Institution: + {% trans "Institution:" %} {{ document.institution }}
  • - Headline: + {% trans "Headline:" %} {{ document.search_headline|safe }}
  • - File: + {% trans "File:" %} {{ document.uploaded_file }}
  • - License: + {% trans "License:" %} {{ document.license }}
  • - Mime Type: + {% trans "Mime Type:" %} {{ document.mime_type }}
  • - Rank: + {% trans "Rank:" %} {{ document.rank }}
@@ -61,15 +62,15 @@
Search a term
{# test section end#} {% else %} -

Functionality of this page coming soon

+

{% trans "Functionality of this page coming soon" %}

{% endif %}
diff --git a/app/templates/base.html b/app/templates/base.html index 2272ac41..42acde4f 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -4,9 +4,9 @@ - SADiLaR - - + {% trans "SADiLaR" %} + + @@ -30,23 +30,23 @@
diff --git a/app/templates/base_error.html b/app/templates/base_error.html index 18aaf041..ade2424f 100644 --- a/app/templates/base_error.html +++ b/app/templates/base_error.html @@ -1,11 +1,12 @@ {% extends "base.html" %} +{% load i18n %} {% block content %}
- Error + {% trans "Error" %}
{% block error_content %}