added nepali numbers

This commit is contained in:
Miodec 2022-10-13 19:36:33 +02:00
parent cf3cb5e4c2
commit b961d33a72
2 changed files with 16 additions and 3 deletions

View file

@ -745,7 +745,9 @@ function applyFunboxesToWord(word: string, wordset?: Wordset.Wordset): string {
} else if (Config.funbox === "58008") {
word = Misc.getNumbers(7);
if (Config.language.startsWith("kurdish")) {
word = Misc.convertNumberToArabicIndic(word);
word = Misc.convertNumberToArabic(word);
} else if (Config.language.startsWith("nepali")) {
word = Misc.convertNumberToNepali(word);
}
} else if (Config.funbox === "specials") {
word = Misc.getSpecials();
@ -852,7 +854,9 @@ async function getNextWord(
randomWord = Misc.getNumbers(4);
if (Config.language.startsWith("kurdish")) {
randomWord = Misc.convertNumberToArabicIndic(randomWord);
randomWord = Misc.convertNumberToArabic(randomWord);
} else if (Config.language.startsWith("nepali")) {
randomWord = Misc.convertNumberToNepali(randomWord);
}
}
}

View file

@ -573,7 +573,7 @@ export function getNumbers(len: number): string {
}
//convert numbers to arabic-indic
export function convertNumberToArabicIndic(numString: string): string {
export function convertNumberToArabic(numString: string): string {
const arabicIndic = "٠١٢٣٤٥٦٧٨٩";
let ret = "";
for (let i = 0; i < numString.length; i++) {
@ -582,6 +582,15 @@ export function convertNumberToArabicIndic(numString: string): string {
return ret;
}
export function convertNumberToNepali(numString: string): string {
const nepaliIndic = "०१२३४५६७८९";
let ret = "";
for (let i = 0; i < numString.length; i++) {
ret += nepaliIndic[parseInt(numString[i])];
}
return ret;
}
export function getSpecials(): string {
const randLen = randomIntFromRange(1, 7);
let ret = "";