mirror of https://github.com/mue/mue.git
fix: sidebar bug, tab name translation
This commit is contained in:
parent
4f29d376ca
commit
2c89894372
|
@ -11,6 +11,5 @@ yarn-error.log
|
|||
.eslintcache
|
||||
stats.json
|
||||
yarn.lock
|
||||
keys.json
|
||||
*.zip
|
||||
|
||||
keys.json
|
|
@ -43,6 +43,7 @@
|
|||
border: none;
|
||||
background: none;
|
||||
min-width: calc(100% - 1.2em);
|
||||
text-align: left;
|
||||
|
||||
&:hover {
|
||||
background: t($modal-sidebarActive);
|
||||
|
|
|
@ -9,6 +9,7 @@ import {
|
|||
} from '@mui/material';
|
||||
|
||||
import EventBus from 'modules/helpers/eventbus';
|
||||
import translations from 'modules/translations';
|
||||
|
||||
export default class Radio extends PureComponent {
|
||||
constructor(props) {
|
||||
|
@ -18,7 +19,7 @@ export default class Radio extends PureComponent {
|
|||
};
|
||||
}
|
||||
|
||||
handleChange = (e) => {
|
||||
handleChange = async (e) => {
|
||||
const { value } = e.target;
|
||||
|
||||
if (value === 'loading') {
|
||||
|
@ -31,10 +32,9 @@ export default class Radio extends PureComponent {
|
|||
localStorage.getItem('tabName') ===
|
||||
variables.language.getMessage(variables.languagecode, 'tabname')
|
||||
) {
|
||||
// todo: fix this it doesn't work and shows as undefined
|
||||
localStorage.setItem(
|
||||
'tabName',
|
||||
import(`../../../../translations/${value.replace('-', '_')}.json`).tabname,
|
||||
translations[value.replace('-', '_')].tabname,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import Tooltip from '../../helpers/tooltip/Tooltip';
|
|||
import Modal from 'react-modal';
|
||||
import ShareModal from '../../helpers/sharemodal/ShareModal';
|
||||
//import Hotkeys from 'react-hot-keys';
|
||||
import { toast } from 'react-toastify';
|
||||
|
||||
const toDataURL = async (url) => {
|
||||
const res = await fetch(url);
|
||||
|
|
|
@ -15,16 +15,7 @@ import Stats from 'modules/helpers/stats';
|
|||
import I18n from '@eartharoid/i18n';
|
||||
|
||||
// this is because of vite
|
||||
import * as de_DE from './translations/de_DE.json';
|
||||
import * as en_GB from './translations/en_GB.json';
|
||||
import * as en_US from './translations/en_US.json';
|
||||
import * as es from './translations/es.json';
|
||||
import * as fr from './translations/fr.json';
|
||||
import * as nl from './translations/nl.json';
|
||||
import * as no from './translations/no.json';
|
||||
import * as ru from './translations/ru.json';
|
||||
import * as zh_CN from './translations/zh_CN.json';
|
||||
import * as id_ID from './translations/id_ID.json';
|
||||
import translations from 'modules/translations';
|
||||
|
||||
const languagecode = localStorage.getItem('language') || 'en_GB';
|
||||
|
||||
|
@ -36,16 +27,16 @@ if (languagecode === 'en') {
|
|||
}
|
||||
|
||||
variables.language = new I18n(variables.languagecode, {
|
||||
de_DE,
|
||||
en_GB,
|
||||
en_US,
|
||||
es,
|
||||
fr,
|
||||
nl,
|
||||
no,
|
||||
ru,
|
||||
zh_CN,
|
||||
id_ID,
|
||||
de_DE: translations.de_DE,
|
||||
en_GB: translations.en_GB,
|
||||
en_US: translations.en_US,
|
||||
es: translations.es,
|
||||
fr: translations.fr,
|
||||
nl: translations.nl,
|
||||
no: translations.no,
|
||||
ru: translations.ru,
|
||||
zh_CN: translations.zh_CN,
|
||||
id_ID: translations.id_ID,
|
||||
});
|
||||
|
||||
// set html language tag
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
import * as de_DE from '../translations/de_DE.json';
|
||||
import * as en_GB from '../translations/en_GB.json';
|
||||
import * as en_US from '../translations/en_US.json';
|
||||
import * as es from '../translations/es.json';
|
||||
import * as fr from '../translations/fr.json';
|
||||
import * as nl from '../translations/nl.json';
|
||||
import * as no from '../translations/no.json';
|
||||
import * as ru from '../translations/ru.json';
|
||||
import * as zh_CN from '../translations/zh_CN.json';
|
||||
import * as id_ID from '../translations/id_ID.json';
|
||||
|
||||
const translations = {
|
||||
de_DE,
|
||||
en_GB,
|
||||
en_US,
|
||||
es,
|
||||
fr,
|
||||
nl,
|
||||
no,
|
||||
ru,
|
||||
zh_CN,
|
||||
id_ID
|
||||
};
|
||||
|
||||
export default translations;
|
Loading…
Reference in New Issue