mirror of
https://github.com/mue/mue.git
synced 2026-07-08 21:24:57 +02:00
feat(translations): new translation system
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import variables from 'modules/variables';
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
export function saveFile(data, filename = 'file') {
|
||||
@@ -28,12 +29,14 @@ export function exportSettings() {
|
||||
}
|
||||
|
||||
export function importSettings(e) {
|
||||
const getMessage = (languagecode, text) => variables.language.getMessage(languagecode, text);
|
||||
const languagecode = variables.languagecode;
|
||||
const content = JSON.parse(e.target.result);
|
||||
|
||||
Object.keys(content).forEach((key) => {
|
||||
localStorage.setItem(key, content[key]);
|
||||
});
|
||||
|
||||
toast(window.language.toasts.imported);
|
||||
toast(getMessage(languagecode, 'toats.imported'));
|
||||
window.stats.postEvent('tab', 'Settings imported');
|
||||
}
|
||||
|
||||
6
src/modules/variables.js
Normal file
6
src/modules/variables.js
Normal file
@@ -0,0 +1,6 @@
|
||||
const variables = {
|
||||
language: {},
|
||||
languagecode: ''
|
||||
};
|
||||
|
||||
export default variables;
|
||||
Reference in New Issue
Block a user