fix: weird behavior when using quote mode with a language that doesnt have a base (200) list

This commit is contained in:
Miodec 2024-02-05 12:36:39 +01:00
parent 1cfce348a1
commit 6fddc7c070
2 changed files with 7 additions and 30 deletions

View file

@ -84,8 +84,14 @@ export async function update(): Promise<void> {
}
if (Config.mode !== "zen") {
let language = Config.language;
if (Config.mode === "quote") {
language = language.split(/_\d+k$/)[0] as string;
}
$(".pageTest #testModesNotice").append(
`<div class="textButton" commands="languages"><i class="fas fa-globe-americas"></i>${Config.language.replace(
`<div class="textButton" commands="languages"><i class="fas fa-globe-americas"></i>${language.replace(
/_/g,
" "
)}</div>`

View file

@ -411,7 +411,6 @@ export function restart(options = {} as RestartOptions): void {
let rememberLazyMode: boolean;
let testReinitCount = 0;
let languageBeforeQuoteMode: string | undefined;
export async function init(): Promise<void> {
console.debug("Initializing test");
testReinitCount++;
@ -458,34 +457,6 @@ export async function init(): Promise<void> {
if (Config.quoteLength.includes(-3) && !Auth?.currentUser) {
UpdateConfig.setQuoteLength(-1);
}
let group;
try {
group = await Misc.findCurrentGroup(Config.language);
} catch (e) {
console.error(
Misc.createErrorMessage(e, "Failed to find current language group")
);
return;
}
if (
group &&
group.name !== "code" &&
group.name !== "other" &&
group.name !== Config.language
) {
languageBeforeQuoteMode = Config.language;
UpdateConfig.setLanguage(group.name);
}
} else {
if (
languageBeforeQuoteMode &&
Config.language === languageBeforeQuoteMode.split("_")[0]
) {
UpdateConfig.setLanguage(languageBeforeQuoteMode);
languageBeforeQuoteMode = undefined;
await init();
return;
}
}
if (Config.tapeMode !== "off" && language.rightToLeft === true) {