From 58f2dce18d3b97997d41d04849d303503d54a0f6 Mon Sep 17 00:00:00 2001 From: Matthias Date: Thu, 5 Aug 2021 01:23:11 +0200 Subject: [PATCH] show translation level in ui --- InvenTree/InvenTree/views.py | 10 ++++++++++ InvenTree/templates/InvenTree/settings/user.html | 13 ++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/InvenTree/InvenTree/views.py b/InvenTree/InvenTree/views.py index 9749fd60d0..69deb8fd97 100644 --- a/InvenTree/InvenTree/views.py +++ b/InvenTree/InvenTree/views.py @@ -7,12 +7,15 @@ as JSON objects and passing them to modal forms (using jQuery / bootstrap). # -*- coding: utf-8 -*- from __future__ import unicode_literals +import os +import json from django.utils.translation import gettext_lazy as _ from django.template.loader import render_to_string from django.http import HttpResponse, JsonResponse, HttpResponseRedirect from django.urls import reverse_lazy from django.shortcuts import redirect +from django.conf import settings from django.contrib.auth.mixins import PermissionRequiredMixin @@ -802,6 +805,13 @@ class SettingsView(TemplateView): except: ctx["rates_updated"] = None + # load locale stats + STAT_FILE = os.path.abspath(os.path.join(settings.BASE_DIR, 'InvenTree/locale_stats.json')) + try: + ctx["locale_stats"] = json.load(open(STAT_FILE, 'r')) + except: + ctx["locale_stats"] = {} + return ctx diff --git a/InvenTree/templates/InvenTree/settings/user.html b/InvenTree/templates/InvenTree/settings/user.html index aa3f7f079c..922e9ebc79 100644 --- a/InvenTree/templates/InvenTree/settings/user.html +++ b/InvenTree/templates/InvenTree/settings/user.html @@ -81,8 +81,15 @@ {% get_available_languages as LANGUAGES %} {% get_language_info_list for LANGUAGES as languages %} {% for language in languages %} - {% endfor %} @@ -92,7 +99,7 @@ -
+

{% trans "Help the translation efforts!" %}

{% blocktrans with link="https://crowdin.com/project/inventree" %}Native language translation of the InvenTree web application is community contributed via crowdin. Contributions are welcomed and encouraged.{% endblocktrans %}