Skip to content

Commit

Permalink
fix/cookie-lang-prefs: add error handling and default return
Browse files Browse the repository at this point in the history
Edirom Online failed if no cookie 'edirom-language' was set because pref 'application_language' was called before preferences were set. this commit is a quick fix, which returns default lang 'en' if 'application_language' could not be found.
* also removing cookie-handling for 'edirom_language'
Refs #504
  • Loading branch information
Tobias Bachmann authored and daniel-jettka committed Dec 20, 2024
1 parent 5e62b63 commit f0005f3
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions app/controller/LanguageController.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,16 @@ Ext.define('EdiromOnline.controller.LanguageController', {
},

getLanguage: function() {
if(window.getCookie('edirom-language') !== '')
return window.getCookie('edirom-language');

return getPreference('application_language');
/* since removing the cookie, this throws an error because 'application_language' is called before it is defined.
* see issue #504
* this is a quick fix, language / preferences handling needs some rework
*/
try {
return getPreference('application_language');
}
catch (err) {
console.log('"application_language" not found, using "en" as default.\n');
return 'en'
}
}
});

0 comments on commit f0005f3

Please sign in to comment.