From 282bc4579034a92d2d3504656c3f93fe25fccad0 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Wed, 3 Aug 2016 21:03:40 +0200 Subject: [PATCH] Fixed missing translations of config options (Fixes #2193, fixes #2245) --- bower.json | 2 +- openslides/core/config_variables.py | 1 + openslides/core/static/js/core/site.js | 13 +++++++++---- .../core/static/templates/config-form-field.html | 10 +++++++--- openslides/core/static/templates/config.html | 2 +- openslides/core/static/templates/home.html | 4 ++-- 6 files changed, 21 insertions(+), 11 deletions(-) diff --git a/bower.json b/bower.json index aee827166..135e91949 100644 --- a/bower.json +++ b/bower.json @@ -11,7 +11,7 @@ "angular-csv-import": "~0.0.29", "angular-formly": "~7.3.9", "angular-formly-templates-bootstrap": "~6.2.0", - "angular-gettext": "~2.2.0", + "angular-gettext": "~2.3.4", "angular-loading-bar": "~0.8.0", "angular-messages": "~1.4.10", "angular-pdf": "~1.3.0", diff --git a/openslides/core/config_variables.py b/openslides/core/config_variables.py index 019a682a2..3e5a3e170 100644 --- a/openslides/core/config_variables.py +++ b/openslides/core/config_variables.py @@ -151,6 +151,7 @@ def get_config_variables(): yield ConfigVariable( name='projector_default_countdown', default_value=60, + input_type='integer', label='Default countdown', weight=185, group='Projector') diff --git a/openslides/core/static/js/core/site.js b/openslides/core/static/js/core/site.js index 37f9ec6d0..07bf1811e 100644 --- a/openslides/core/static/js/core/site.js +++ b/openslides/core/static/js/core/site.js @@ -389,7 +389,8 @@ angular.module('OpenSlidesApp.core.site', [ .directive('osFormField', [ '$parse', 'Config', - function($parse, Config) { + 'gettextCatalog', + function($parse, Config, gettextCatalog) { function getHtmlType(type) { return { string: 'text', @@ -410,15 +411,19 @@ angular.module('OpenSlidesApp.core.site', [ var config = Config.get(field.key); $scope.type = getHtmlType(field.input_type); if ($scope.type == 'choice') { - $scope.choices = field.choices; + $scope.choices = []; + angular.forEach(field.choices, function(choice) { + choice.display_name = gettextCatalog.getString(choice.display_name); + $scope.choices.push(choice); + }); } $scope.label = field.label; $scope.key = 'field-' + field.key; - $scope.value = config.value; + $scope.value = gettextCatalog.getString(config.value); $scope.help_text = field.help_text; $scope.default_value = field.default_value; $scope.reset = function () { - $scope.value = $scope.default_value; + $scope.value = gettextCatalog.getString($scope.default_value); $scope.save(field.key, $scope.value); }; } diff --git a/openslides/core/static/templates/config-form-field.html b/openslides/core/static/templates/config-form-field.html index 64cd7f555..ab6f2c8c5 100644 --- a/openslides/core/static/templates/config-form-field.html +++ b/openslides/core/static/templates/config-form-field.html @@ -1,10 +1,11 @@
- +
@@ -28,17 +31,18 @@ -
-

{{ help_text }}

+

{{ help_text | translate }}

diff --git a/openslides/core/static/templates/config.html b/openslides/core/static/templates/config.html index acf806bf2..a1a31a644 100644 --- a/openslides/core/static/templates/config.html +++ b/openslides/core/static/templates/config.html @@ -21,7 +21,7 @@
-

{{ subgroup.name }}

+

{{ subgroup.name | translate }}

diff --git a/openslides/core/static/templates/home.html b/openslides/core/static/templates/home.html index 6eb729be6..46e7040e3 100644 --- a/openslides/core/static/templates/home.html +++ b/openslides/core/static/templates/home.html @@ -1,9 +1,9 @@
-

{{ config('general_event_welcome_title') }}

+

{{ config('general_event_welcome_title') | translate }}

+ ng-bind-html="config('general_event_welcome_text') | translate">