Skip to content

Commit

Permalink
fix(word generation): use correct fullstop and digits for bangla (sha…
Browse files Browse the repository at this point in the history
…hnewaz-labib) (#5355)

* fix: add "।" instead of "." if bangla word

* fix: convert to bangla numerals
  • Loading branch information
shahnewaz-labib committed May 6, 2024
1 parent ca15ca6 commit 8705b1c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions frontend/src/ts/test/words-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export async function punctuateWord(
word += ".";
} else if (
currentLanguage === "nepali" ||
currentLanguage === "bangla" ||
currentLanguage === "hindi"
) {
word += "।";
Expand Down Expand Up @@ -867,6 +868,8 @@ export async function getNextWord(
randomWord = Misc.convertNumberToArabic(randomWord);
} else if (Config.language.startsWith("nepali")) {
randomWord = Misc.convertNumberToNepali(randomWord);
} else if (Config.language.startsWith("bangla")) {
randomWord = Misc.convertNumberToBangla(randomWord);
} else if (Config.language.startsWith("hindi")) {
randomWord = Misc.convertNumberToHindi(randomWord);
}
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/ts/utils/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ export function convertNumberToArabic(numString: string): string {
return ret;
}

export function convertNumberToBangla(numString: string): string {
const banglaIndic = "০১২৩৪৫৬৭৮৯";
let ret = "";
for (const char of numString) {
ret += banglaIndic[parseInt(char)];
}
return ret;
}

export function convertNumberToNepali(numString: string): string {
const nepaliIndic = "०१२३४५६७८९";
let ret = "";
Expand Down

0 comments on commit 8705b1c

Please sign in to comment.