Merge pull request #3543 from jsaalfeld/master

save language selection to session storage
This commit is contained in:
Emanuel Schütze 2018-01-20 21:19:48 +01:00 committed by GitHub
commit ced36d0c0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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')
Languages.setCurrentLanguage(Languages.getBrowserLanguage());
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() {