Skip to content

Commit

Permalink
Merge branch 'dynamic-language-mapping' of https://github.com/AI4Bhar…
Browse files Browse the repository at this point in the history
…at/ai4b-website into dynamic-language-mapping
  • Loading branch information
srihari07-web committed Sep 13, 2024
2 parents 67b1e89 + c9655f4 commit ab6451d
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions frontend/components/TryOut/NMT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export default function NMT({ services }: { services: any }) {
);

const [service, setService] = useState(languageOptions[0].serviceId);
const [sourceLanguage, setSourceLanguage] = useState(languageOptions[0].language);
const [sourceLanguage, setSourceLanguage] = useState(
languageOptions[0].language
);
const [targetLanguage, setTargetLanguage] = useState(
services[Object.keys(services)[0]]["languageFilters"]["targetLanguages"][0]
);
Expand Down Expand Up @@ -92,9 +94,13 @@ export default function NMT({ services }: { services: any }) {
<VStack>
<VStack>
<VStack>
<FormLabel textColor={"gray.500"}>Select Source Language:</FormLabel>
<FormLabel textColor={"gray.500"}>
Select Source Language:
</FormLabel>
<Select
value={(LANGUAGE_CODE_NAMES as LanguageCodeNames)[sourceLanguage]}
value={
(LANGUAGE_CODE_NAMES as LanguageCodeNames)[sourceLanguage]
}
onChange={handleLanguageChange}
>
{languageOptions.map((option, index) => (
Expand All @@ -105,12 +111,15 @@ export default function NMT({ services }: { services: any }) {
</Select>
</VStack>
<VStack>
<FormLabel textColor={"gray.500"}>Select Target Language:</FormLabel>
<FormLabel textColor={"gray.500"}>
Select Target Language:
</FormLabel>
<Select
value={targetLanguage}
onChange={(event) => setTargetLanguage(event.target.value)}
>
{services[Object.keys(services)[0]].languageFilters.targetLanguages.length === 0 ? (
{services[Object.keys(services)[0]].languageFilters
.targetLanguages.length === 0 ? (
<></>
) : (
services[service].languageFilters.targetLanguages.map(
Expand All @@ -124,7 +133,9 @@ export default function NMT({ services }: { services: any }) {
</Select>
</VStack>
<VStack>
<FormLabel textColor={"gray.500"}>Enable Transliteration:</FormLabel>
<FormLabel textColor={"gray.500"}>
Enable Transliteration:
</FormLabel>
<Switch
isChecked={transliteration}
onChange={() => setTransliteration(!transliteration)}
Expand Down

0 comments on commit ab6451d

Please sign in to comment.