mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-10 02:02:29 +08:00
feat(note_language): filter by enabled languages
This commit is contained in:
parent
9f6b97cdfa
commit
775fd3f22b
@ -6,6 +6,7 @@ import type { EventData } from "../components/app_context.js";
|
||||
import type FNote from "../entities/fnote.js";
|
||||
import attributes from "../services/attributes.js";
|
||||
import type { Locale } from "../../../services/i18n.js";
|
||||
import options from "../services/options.js";
|
||||
|
||||
const TPL = `\
|
||||
<div class="dropdown note-language-widget">
|
||||
@ -43,9 +44,10 @@ export default class NoteLanguageWidget extends NoteContextAwareWidget {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
const allLanguages = getAvailableLocales();
|
||||
const leftToRightLanguages = allLanguages.filter((l) => !l.rtl);
|
||||
const rightToLeftLanguages = allLanguages.filter((l) => l.rtl);
|
||||
const enabledLanguages = JSON.parse(options.get("languages") ?? "[]") as string[];
|
||||
const filteredLanguages = getAvailableLocales().filter((l) => typeof l !== "object" || enabledLanguages.includes(l.id));
|
||||
const leftToRightLanguages = filteredLanguages.filter((l) => !l.rtl);
|
||||
const rightToLeftLanguages = filteredLanguages.filter((l) => l.rtl);
|
||||
|
||||
this.locales = [
|
||||
DEFAULT_LOCALE,
|
||||
|
Loading…
x
Reference in New Issue
Block a user