feat(note_language): add a button to configure the language

This commit is contained in:
Elian Doran 2025-03-05 16:44:36 +02:00
parent 4a75f9f48b
commit 25c9f52cf4
No known key found for this signature in database
2 changed files with 10 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import type FNote from "../entities/fnote.js";
import attributes from "../services/attributes.js"; import attributes from "../services/attributes.js";
import type { Locale } from "../../../services/i18n.js"; import type { Locale } from "../../../services/i18n.js";
import options from "../services/options.js"; import options from "../services/options.js";
import appContext from "../components/app_context.js";
const TPL = `\ const TPL = `\
<div class="dropdown note-language-widget"> <div class="dropdown note-language-widget">
@ -62,6 +63,8 @@ export default class NoteLanguageWidget extends NoteContextAwareWidget {
...rightToLeftLanguages ...rightToLeftLanguages
]; ];
} }
this.locales.push("---"); // this will separate the list of languages from the "Configure languages" button.
} }
doRender() { doRender() {
@ -106,6 +109,11 @@ export default class NoteLanguageWidget extends NoteContextAwareWidget {
this.$noteLanguageDropdown.append('<div class="dropdown-divider"></div>'); this.$noteLanguageDropdown.append('<div class="dropdown-divider"></div>');
} }
} }
const $configureLink = $('<a class="dropdown-item">')
.append(`<span>${t("note_language.configure-languages")}</span>`)
.on("click", () => appContext.tabManager.openContextWithNote("_optionsLocalization", { activate: true }));
this.$noteLanguageDropdown.append($configureLink);
} }
async save(languageId: string) { async save(languageId: string) {

View File

@ -1688,6 +1688,7 @@
"unknown_widget": "Unknown widget for \"{{id}}\"." "unknown_widget": "Unknown widget for \"{{id}}\"."
}, },
"note_language": { "note_language": {
"not_set": "Not set" "not_set": "Not set",
"configure-languages": "Configure languages..."
} }
} }