Use English as fallback language

This commit is contained in:
Deluan
2020-05-02 11:21:08 -04:00
committed by Deluan Quintão
parent 41cf99541d
commit 2f7443e4bd
3 changed files with 43 additions and 23 deletions
+4 -15
View File
@@ -5,7 +5,6 @@ import {
SelectInput,
SimpleForm,
Title,
useGetList,
useLocale,
useSetLocale,
useTranslate,
@@ -15,6 +14,7 @@ import HelpOutlineIcon from '@material-ui/icons/HelpOutline'
import { changeTheme } from './actions'
import themes from '../themes'
import { docsUrl } from '../utils/docsUrl'
import { useGetLanguageChoices } from '../i18nProvider'
const useStyles = makeStyles({
root: { marginTop: '1em' },
@@ -35,23 +35,12 @@ const HelpMsg = ({ caption }) => (
)
const SelectLanguage = (props) => {
const { ids, data, loaded } = useGetList(
'translation',
{ page: 1, perPage: -1 },
{ field: '', order: '' },
{}
)
const translate = useTranslate()
const setLocale = useSetLocale()
const locale = useLocale()
const { choices } = useGetLanguageChoices()
const langChoices = [{ id: 'en', name: 'English' }]
if (loaded) {
ids.forEach((id) => langChoices.push({ id: id, name: data[id].name }))
}
langChoices.sort((a, b) => a.name.localeCompare(b.name))
langChoices.push({
choices.push({
id: helpKey,
name: <HelpMsg caption={'Help to translate'} />,
})
@@ -62,7 +51,7 @@ const SelectLanguage = (props) => {
source="language"
label={translate('menu.personal.options.language')}
defaultValue={locale}
choices={langChoices}
choices={choices}
translateChoice={false}
onChange={(event) => {
if (event.target.value === helpKey) {