mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-25 22:41:36 +08:00
feat(note_language): add a button to configure the language
This commit is contained in:
parent
4a75f9f48b
commit
25c9f52cf4
@ -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) {
|
||||||
|
@ -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..."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user