Skip to content

Commit

Permalink
Merge branch 'main' into forgot-pwd-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
NancyAanchal authored Aug 15, 2024
2 parents 86942bc + bb5942b commit 982ed33
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions nepalingo-web/src/hooks/Langauge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export const Languages = {
Newari: "newari",
Tajpuriya: "tajpuriya",
Maithili: "maithili",
Sanskrit: "sanskrit",
Nepali: "nepali",
} as const;

type LanguageContextProps = {
Expand Down
4 changes: 4 additions & 0 deletions nepalingo-web/src/hooks/useDictionary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down
2 changes: 2 additions & 0 deletions nepalingo-web/src/lib/getGTranslate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
7 changes: 6 additions & 1 deletion nepalingo-web/src/lib/getNextWord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 982ed33

Please sign in to comment.