2022-03-01 05:54:32 +01:00
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
|
import DropDown from 'components/common/DropDown';
|
2022-12-27 01:57:59 +01:00
|
|
|
import { Button } from 'react-basics';
|
2022-03-01 05:54:32 +01:00
|
|
|
import useLocale from 'hooks/useLocale';
|
|
|
|
import { DEFAULT_LOCALE } from 'lib/constants';
|
|
|
|
import styles from './TimezoneSetting.module.css';
|
2022-11-08 07:35:51 +01:00
|
|
|
import { languages } from 'lib/lang';
|
2022-03-01 05:54:32 +01:00
|
|
|
|
|
|
|
export default function LanguageSetting() {
|
|
|
|
const { locale, saveLocale } = useLocale();
|
|
|
|
const options = Object.keys(languages).map(key => ({ ...languages[key], value: key }));
|
|
|
|
|
|
|
|
function handleReset() {
|
|
|
|
saveLocale(DEFAULT_LOCALE);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<DropDown
|
|
|
|
menuClassName={styles.menu}
|
|
|
|
value={locale}
|
|
|
|
options={options}
|
|
|
|
onChange={saveLocale}
|
|
|
|
/>
|
2022-12-27 01:57:59 +01:00
|
|
|
<Button className={styles.button} size="sm" onClick={handleReset}>
|
2022-03-01 05:54:32 +01:00
|
|
|
<FormattedMessage id="label.reset" defaultMessage="Reset" />
|
|
|
|
</Button>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|