diff --git a/nepalingo-web/src/hooks/Langauge.tsx b/nepalingo-web/src/hooks/Langauge.tsx index 6addbb5..c5c9de2 100644 --- a/nepalingo-web/src/hooks/Langauge.tsx +++ b/nepalingo-web/src/hooks/Langauge.tsx @@ -10,6 +10,8 @@ export const Languages = { Newari: "newari", Tajpuriya: "tajpuriya", Maithili: "maithili", + Sanskrit: "sanskrit", + Nepali: "nepali", } as const; type LanguageContextProps = { diff --git a/nepalingo-web/src/hooks/useDictionary.tsx b/nepalingo-web/src/hooks/useDictionary.tsx index 68d73b1..80fca79 100644 --- a/nepalingo-web/src/hooks/useDictionary.tsx +++ b/nepalingo-web/src/hooks/useDictionary.tsx @@ -45,6 +45,10 @@ async function getFetcherByLanguage( return await getTajpuriyaWord(word); case "Maithili": return await getGTranslate("maithili", word); + case "Sanskrit": + return await getGTranslate("sanskrit", word); + case "Nepali": + return await getGTranslate("nepali", word); default: throw new Error(`Language ${language} not supported`); diff --git a/nepalingo-web/src/lib/getGTranslate.tsx b/nepalingo-web/src/lib/getGTranslate.tsx index b9d4cb9..a6e6329 100644 --- a/nepalingo-web/src/lib/getGTranslate.tsx +++ b/nepalingo-web/src/lib/getGTranslate.tsx @@ -2,6 +2,8 @@ const GOOGLE_TRANSLATE_API_KEY = import.meta.env.VITE_GOOGLE_TRANSLATE_API_KEY; const languageCodes: { [key: string]: string } = { maithili: "mai", + sanskrit: "sa", + nepali: "ne", }; export const getGTranslate = async ( diff --git a/nepalingo-web/src/lib/getNextWord.ts b/nepalingo-web/src/lib/getNextWord.ts index 98b0740..b5ce530 100644 --- a/nepalingo-web/src/lib/getNextWord.ts +++ b/nepalingo-web/src/lib/getNextWord.ts @@ -58,7 +58,12 @@ export function* wordGenerator(words: string[]) { export async function getNextWord(language: string) { let words: string[] = []; - if (language === "Newari" || language === "Maithili") { + if ( + language === "Newari" || + language === "Maithili" || + language === "Sanskrit" || + language === "Nepali" + ) { words = newariWords; } else if (language === "Tajpuriya") { words = await getTajpuriyaWords();