Skip to content

Commit

Permalink
feat(app): sync source and template language with ui
Browse files Browse the repository at this point in the history
  • Loading branch information
rhahao committed Aug 16, 2023
1 parent 522760e commit 885d0a5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/features/languageSwitcher/AppLanguage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import TranslateIcon from '@mui/icons-material/Translate';
import Typography from '@mui/material/Typography';
import { appLangState } from '../../states/main';
import { LANGUAGE_LIST } from '../../locales/langList.js';
import { Setting } from '../../classes/Setting';

const AppLanguage = () => {
const { t, i18n } = useTranslation('ui');
Expand All @@ -39,6 +40,7 @@ const AppLanguage = () => {
setUserChange(true);
const app_lang = e.target.parentElement.dataset.code;
setAppLangLocal(app_lang);
await Setting.update({ source_lang: app_lang });
handleClose();
window.location.reload();
};
Expand Down Expand Up @@ -85,8 +87,8 @@ const AppLanguage = () => {
<>
<Tooltip title={largeView ? '' : t('changeLanguage')}>
<IconButton
color='inherit'
edge='start'
color="inherit"
edge="start"
sx={{
borderRadius: '8px',
'.MuiTouchRipple-ripple .MuiTouchRipple-child': {
Expand All @@ -101,7 +103,7 @@ const AppLanguage = () => {
</IconButton>
</Tooltip>
<Menu
id='menu-language'
id="menu-language"
disableScrollLock={true}
anchorEl={anchorEl}
open={isMenuOpen}
Expand All @@ -119,10 +121,10 @@ const AppLanguage = () => {
</MenuItem>
))}
<MenuItem sx={{ padding: 0, borderTop: '1px outset', marginTop: '10px' }} onClick={handleLocalizeOpen}>
<Link href='https://github.com/sws2apps/cpe-sws/blob/main/TRANSLATION.md' target='_blank' rel='noopener'>
<Link href="https://github.com/sws2apps/cpe-sws/blob/main/TRANSLATION.md" target="_blank" rel="noopener">
<Box sx={{ padding: '10px 16px', display: 'flex', alignItems: 'center' }}>
<ListItemIcon>
<LanguageIcon fontSize='medium' />
<LanguageIcon fontSize="medium" />
</ListItemIcon>
<ListItemText>
<Typography sx={{ fontSize: '14px' }}>{t('languageMissing')}</Typography>
Expand Down

0 comments on commit 885d0a5

Please sign in to comment.