mirror of
https://github.com/mue/mue.git
synced 2026-07-09 05:34:20 +02:00
refactor: clean translation system and more widget stuff
This commit is contained in:
@@ -4,8 +4,6 @@ import experimentalInit from '../experimental';
|
||||
import defaultSettings from 'modules/default_settings.json';
|
||||
import languages from 'modules/languages.json';
|
||||
|
||||
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
|
||||
|
||||
export function setDefaultSettings(reset) {
|
||||
localStorage.clear();
|
||||
defaultSettings.forEach((element) => localStorage.setItem(element.name, element.value));
|
||||
@@ -23,7 +21,7 @@ export function setDefaultSettings(reset) {
|
||||
localStorage.setItem('language', 'en_GB');
|
||||
}
|
||||
|
||||
localStorage.setItem('tabName', getMessage('tabname'));
|
||||
localStorage.setItem('tabName', variables.getMessage('tabname'));
|
||||
|
||||
if (reset) {
|
||||
localStorage.setItem('showWelcome', false);
|
||||
@@ -52,7 +50,7 @@ export function loadSettings(hotreload) {
|
||||
document.body.classList.remove('dark');
|
||||
}
|
||||
|
||||
document.title = localStorage.getItem('tabName') || getMessage('tabname');
|
||||
document.title = localStorage.getItem('tabName') || variables.getMessage('tabname');
|
||||
|
||||
if (hotreload === true) {
|
||||
// remove old custom stuff and add new
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import variables from 'modules/variables';
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
const getMessage = (text) => variables.language.getMessage(variables.languagecode, text);
|
||||
|
||||
export function saveFile(data, filename = 'file', type = 'text/json') {
|
||||
if (typeof data === 'object') {
|
||||
data = JSON.stringify(data, undefined, 4);
|
||||
@@ -58,7 +56,7 @@ export function importSettings(e) {
|
||||
localStorage.setItem(key, content[key]);
|
||||
});
|
||||
|
||||
toast(getMessage('toasts.imported'));
|
||||
toast(variables.getMessage('toasts.imported'));
|
||||
variables.stats.postEvent('tab', 'Settings imported');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user