fix(word generation): display proper period and numbers for hindi (#5366)

This commit is contained in:
Md. Shahnewaz Siddique 2024-05-06 18:21:10 +06:00 committed by GitHub
parent 7fd31dcc72
commit e88601d344
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View file

@ -77,7 +77,10 @@ export async function punctuateWord(
if (rand <= 0.8) {
if (currentLanguage === "kurdish") {
word += ".";
} else if (currentLanguage === "nepali") {
} else if (
currentLanguage === "nepali" ||
currentLanguage === "hindi"
) {
word += "।";
} else if (
currentLanguage === "japanese" ||
@ -864,6 +867,8 @@ export async function getNextWord(
randomWord = Misc.convertNumberToArabic(randomWord);
} else if (Config.language.startsWith("nepali")) {
randomWord = Misc.convertNumberToNepali(randomWord);
} else if (Config.language.startsWith("hindi")) {
randomWord = Misc.convertNumberToHindi(randomWord);
}
}
}

View file

@ -35,6 +35,15 @@ export function convertNumberToNepali(numString: string): string {
return ret;
}
export function convertNumberToHindi(numString: string): string {
const hindiIndic = "०१२३४५६७८९";
let ret = "";
for (const char of numString) {
ret += hindiIndic[parseInt(char)];
}
return ret;
}
export function findGetParameter(
parameterName: string,
getOverride?: string