Merge pull request #2261 from emanuelschuetze/config-translations

Fixed missing translations of config options (Fixes #2193)
This commit is contained in:
Emanuel Schütze 2016-08-09 20:18:49 +02:00 committed by GitHub
commit 320de66783
6 changed files with 21 additions and 11 deletions

View File

@ -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",

View File

@ -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')

View File

@ -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);
};
}

View File

@ -1,10 +1,11 @@
<div class="form-group">
<label>{{ label }}</label>
<label>{{ label | translate }}</label>
<div class="input-group">
<!-- text/number input, checkbox -->
<input ng-if="type == 'text' || type == 'number' || type == 'checkbox'"
ng-model="$parent.value"
ng-model-options="{debounce: 1000}"
ng-change="save(configOption.key, $parent.value)"
ng-class="{ 'form-control': type != 'checkbox' }"
id="{{ key }}"
@ -15,12 +16,14 @@
colorpicker
class="form-control"
ng-model="$parent.value"
ng-model-options="{debounce: 1000}"
ng-change="save(configOption.key, $parent.value)"
type="text">
<!-- textarea -->
<textarea ng-if="type == 'textarea'"
ng-model="$parent.value"
ng-model-options="{debounce: 1000}"
ng-change="save(configOption.key, $parent.value)"
id="{{ key }}" class="form-control">
</textarea>
@ -28,17 +31,18 @@
<!-- select -->
<select ng-if="type == 'choice'"
ng-model="$parent.value"
ng-model-options="{debounce: 500}"
ng-change="save(configOption.key, $parent.value)"
id="{{ key }}"
class="form-control" ng-options="option.value as option.display_name for option in choices">
</select>
<span class="input-group-btn">
<button ng-click="reset()" class="btn btn-default" title="{{ default_value }}">
<button ng-click="reset()" class="btn btn-default" title="{{ default_value | translate }}">
<i class="fa fa-undo"></i>
<translate>Reset</translate>
</button>
</span>
</div>
<p ng-if="help_text" class="help-block">{{ help_text }}</p>
<p ng-if="help_text" class="help-block">{{ help_text | translate }}</p>
</div>

View File

@ -21,7 +21,7 @@
<div id="group{{ $index }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-group{{ $index }}">
<div class="panel-body">
<div ng-repeat="subgroup in group.subgroups">
<h3>{{ subgroup.name }}</h3>
<h3>{{ subgroup.name | translate }}</h3>
<div ng-repeat="configOption in subgroup.items">
<os-form-field field="configOption"></os-form-field>
</div>

View File

@ -1,9 +1,9 @@
<div os-perms="core.can_see_frontpage" class="header">
<div class="title">
<h1>{{ config('general_event_welcome_title') }}</h1>
<h1>{{ config('general_event_welcome_title') | translate }}</h1>
</div>
</div>
<div os-perms="core.can_see_frontpage" class="details"
ng-bind-html="config('general_event_welcome_text')">
ng-bind-html="config('general_event_welcome_text') | translate">
</div>