mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 02:42:27 +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 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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user