2017-12-31 03:08:54 +05:30
|
|
|
import React from 'react';
|
2019-12-08 00:32:00 +05:30
|
|
|
import { localeFlags } from 'app/components/i18n';
|
2017-12-31 03:08:54 +05:30
|
|
|
import { FormattedMessage as Message } from 'react-intl';
|
2019-12-07 16:58:52 +05:30
|
|
|
|
2017-12-31 03:08:54 +05:30
|
|
|
import messages from './languageSwitcher.intl.json';
|
|
|
|
import styles from './languageSwitcher.scss';
|
2019-12-07 16:58:52 +05:30
|
|
|
import { LocaleData } from './LanguageSwitcher';
|
2017-12-31 03:08:54 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
export default function LocaleItem({ locale }: { locale: LocaleData }) {
|
|
|
|
const { code, name, englishName, progress, isReleased } = locale;
|
2017-12-31 03:08:54 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
let progressLabel;
|
2017-12-31 03:08:54 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
if (progress !== 100) {
|
|
|
|
progressLabel = (
|
|
|
|
<Message
|
|
|
|
{...messages.translationProgress}
|
|
|
|
values={{
|
|
|
|
progress,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
} else if (!isReleased) {
|
|
|
|
progressLabel = <Message {...messages.mayBeInaccurate} />;
|
|
|
|
}
|
2017-12-31 03:08:54 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
return (
|
|
|
|
<div className={styles.languageFlex}>
|
|
|
|
<div
|
|
|
|
className={styles.languageIco}
|
|
|
|
style={{
|
|
|
|
backgroundImage: `url('${localeFlags.getIconUrl(code)}')`,
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
<div className={styles.languageCaptions}>
|
|
|
|
<div className={styles.languageName}>{name}</div>
|
|
|
|
<div className={styles.languageSubName}>
|
|
|
|
{englishName} {progressLabel ? '| ' : ''} {progressLabel}
|
2017-12-31 03:08:54 +05:30
|
|
|
</div>
|
2019-11-27 14:33:32 +05:30
|
|
|
</div>
|
|
|
|
<span className={styles.languageCircle} />
|
|
|
|
</div>
|
|
|
|
);
|
2017-12-31 03:08:54 +05:30
|
|
|
}
|