mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 16:25:51 +01:00
feat(note_language): filter by enabled languages
This commit is contained in:
@@ -6,6 +6,7 @@ import type { EventData } from "../components/app_context.js";
|
|||||||
import type FNote from "../entities/fnote.js";
|
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";
|
||||||
|
|
||||||
const TPL = `\
|
const TPL = `\
|
||||||
<div class="dropdown note-language-widget">
|
<div class="dropdown note-language-widget">
|
||||||
@@ -43,9 +44,10 @@ export default class NoteLanguageWidget extends NoteContextAwareWidget {
|
|||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
const allLanguages = getAvailableLocales();
|
const enabledLanguages = JSON.parse(options.get("languages") ?? "[]") as string[];
|
||||||
const leftToRightLanguages = allLanguages.filter((l) => !l.rtl);
|
const filteredLanguages = getAvailableLocales().filter((l) => typeof l !== "object" || enabledLanguages.includes(l.id));
|
||||||
const rightToLeftLanguages = allLanguages.filter((l) => l.rtl);
|
const leftToRightLanguages = filteredLanguages.filter((l) => !l.rtl);
|
||||||
|
const rightToLeftLanguages = filteredLanguages.filter((l) => l.rtl);
|
||||||
|
|
||||||
this.locales = [
|
this.locales = [
|
||||||
DEFAULT_LOCALE,
|
DEFAULT_LOCALE,
|
||||||
|
|||||||
Reference in New Issue
Block a user