mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-30 14:12:00 +03:00
fix(i18n): default language select (#450)
* fix: default language * feat: mobile support multiple languages
This commit is contained in:
parent
b3b933f708
commit
47bbf187a5
@ -140,7 +140,7 @@ export const AFFiNEHeader = () => {
|
||||
}}
|
||||
/>
|
||||
<Select
|
||||
defaultValue={i18n.language}
|
||||
defaultValue={i18n.resolvedLanguage}
|
||||
sx={{ display: matchesIPAD ? 'none' : 'intial' }}
|
||||
onChange={changeLanguage}
|
||||
size="md"
|
||||
|
@ -17,6 +17,7 @@ import {
|
||||
} from '@mui/material';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { LOCALES } from '../i18n';
|
||||
import AFFiNETextLogo from './affine-text-logo.png';
|
||||
|
||||
export const MobileHeader = () => {
|
||||
@ -163,18 +164,21 @@ export const MobileHeader = () => {
|
||||
timeout="auto"
|
||||
unmountOnExit
|
||||
>
|
||||
<ListItemButton
|
||||
onClick={() => i18n.changeLanguage('en')}
|
||||
>
|
||||
<ListItemText primary="English" />
|
||||
<Checkbox checked={i18n.language === 'en'} />
|
||||
</ListItemButton>
|
||||
<ListItemButton
|
||||
onClick={() => i18n.changeLanguage('zh')}
|
||||
>
|
||||
<ListItemText primary="简体中文" />
|
||||
<Checkbox checked={i18n.language === 'zh'} />
|
||||
</ListItemButton>
|
||||
{LOCALES.map(lang => (
|
||||
<ListItemButton
|
||||
key={lang.tag}
|
||||
onClick={() =>
|
||||
i18n.changeLanguage(lang.tag)
|
||||
}
|
||||
>
|
||||
<ListItemText primary={lang.originalName} />
|
||||
<Checkbox
|
||||
checked={
|
||||
i18n.resolvedLanguage === lang.tag
|
||||
}
|
||||
/>
|
||||
</ListItemButton>
|
||||
))}
|
||||
</Collapse>
|
||||
</List>
|
||||
</StyledDrawerContainer>
|
||||
|
@ -48,7 +48,7 @@ export const SettingsList = () => {
|
||||
{item.key === 'Language' ? (
|
||||
<div style={{ marginLeft: '12em' }}>
|
||||
<Select
|
||||
defaultValue={i18n.language}
|
||||
defaultValue={i18n.resolvedLanguage}
|
||||
onChange={changeLanguage}
|
||||
>
|
||||
{LOCALES.map(option => (
|
||||
|
Loading…
Reference in New Issue
Block a user