save language selection to session storage

and adding @FinnStutzenstein remarks

adding changelog entry
This commit is contained in:
Jochen Saalfeld 2018-01-20 18:02:07 +01:00
parent 940f0bbd1b
commit 612924c087
No known key found for this signature in database
GPG Key ID: 8ACD4E8264B67DF4
4 changed files with 15 additions and 8 deletions

View File

@ -27,3 +27,4 @@ Authors of OpenSlides in chronological order of first contribution:
Meinert Leinigen <openslides@leinigen.cc>
Andreas Engler <engel.a@web.de> (Russian translation)
Raimund Renkert <raimund@renkert.org>
Jochen Saalfeld <jochen.saalfeld@intevation.de>

View File

@ -103,6 +103,7 @@ Core:
- Added caching for the index views [#3419, #3424].
- Added projector prioritization [#3425].
- Use native twisted mode for daphne [#3487].
- Save language selection to session storage [#3543]
Mediafiles:
- Fixed reloading of PDF on page change [#3274].

View File

@ -190,15 +190,16 @@ angular.module('OpenSlidesApp.core', [
// gets all in OpenSlides available languages
.factory('Languages', [
'$sessionStorage',
'$ngBootbox',
'gettext',
'gettextCatalog',
'OpenSlidesPlugins',
'$ngBootbox',
function (gettext, gettextCatalog, OpenSlidesPlugins, $ngBootbox) {
function ($sessionStorage, $ngBootbox, gettext, gettextCatalog, OpenSlidesPlugins) {
return {
// get all available languages
getLanguages: function () {
var current = gettextCatalog.getCurrentLanguage();
var current = $sessionStorage.language;
// Define here new languages...
var languages = [
{ code: 'en', name: 'English' },
@ -236,7 +237,7 @@ angular.module('OpenSlidesApp.core', [
language.selected = false;
if (language.code == lang) {
language.selected = true;
gettextCatalog.setCurrentLanguage(lang);
$sessionStorage.language = lang;
// Plugins
if (lang != 'en') {
gettextCatalog.loadRemote("static/i18n/" + lang + ".json").then(function (success) {
@ -311,12 +312,16 @@ angular.module('OpenSlidesApp.core', [
// set browser language as default language for OpenSlides
.run([
'$sessionStorage',
'gettextCatalog',
'Languages',
function(gettextCatalog, Languages) {
function($sessionStorage, gettextCatalog, Languages) {
// set detected browser language as default language (fallback: 'en')
if ($sessionStorage.language) {
Languages.setCurrentLanguage($sessionStorage.language);
} else {
Languages.setCurrentLanguage(Languages.getBrowserLanguage());
}
// Set this to true for debug. Helps to find untranslated strings by
// adding "[MISSING]:".
gettextCatalog.debug = false;

View File

@ -39,7 +39,7 @@ angular.module('OpenSlidesApp.motions.motionservices', ['OpenSlidesApp.motions',
obj.enable = function () {
obj.active = true;
obj.isEditable = true;
ckeditorOptions.language = gettextCatalog.getCurrentLanguage();
ckeditorOptions.language = localStorage.getItem('language');
obj.editor = CKEDITOR.inline(selector, ckeditorOptions);
obj.editor.on('change', function () {
$timeout(function() {