All Downloads are FREE. Search and download functionalities are using the official Maven repository.

components.settings.LanguageSelector.js Maven / Gradle / Ivy

There is a newer version: 0.80.3
Show newest version
import { 
  Box, Autocomplete,
  TextField }                   from "@mui/material"
import { useTranslation }       from 'react-i18next'
import { normalizeLocale }      from "contexts/utils/localization-utils";
import { enabledLocaleOptions } from "contexts/utils/locale";
import { getRegionAndLanguage } from "utils/language";
import { selectOption }         from "utils/option-utils";
import { useLocale }            from "hooks/locale"
import { useEffect, useState } from "react";

const LanguageSelector = () => {

  const { locale, setLocale } = useLocale()
  const [value, setValue] = useState(locale)
  const { t } = useTranslation()

  useEffect(() => { setLocale(value) },[value])

  return (
     {
        event.preventDefault()
        event.stopPropagation()
        setValue(newOption.value);
      }}
      renderOption={(props, option) => {
        const rl = getRegionAndLanguage(option.value)

        return (
           img': { mr: 2, flexShrink: 0 } }} {...props}>
            
            {option.label}
          
        )
      }
      }
      renderInput={(params) => (
        
      )}
    />
  )
}

export default LanguageSelector




© 2015 - 2024 Weber Informatics LLC | Privacy Policy