mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	feat(note_language): add an option for no language set
This commit is contained in:
		| @@ -1,6 +1,7 @@ | ||||
| import { Dropdown } from "bootstrap"; | ||||
| import NoteContextAwareWidget from "./note_context_aware_widget.js"; | ||||
| import { getAvailableLocales, type Locale } from "../services/i18n.js"; | ||||
| import { t } from "i18next"; | ||||
|  | ||||
| const TPL = `\ | ||||
| <div class="dropdown note-language-widget"> | ||||
| @@ -36,13 +37,26 @@ export default class NoteLanguageWidget extends NoteContextAwareWidget { | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         for (const locale of getAvailableLocales()) { | ||||
|             const $title = $("<span>").text(locale.name); | ||||
|             const $link = $('<a class="dropdown-item">') | ||||
|                 .attr("data-language", locale.id) | ||||
|                 .append('<span class="check">✓</span> ') | ||||
|                 .append($title); | ||||
|             this.$noteLanguageDropdown.append($link); | ||||
|         const locales: (Locale | "---")[] = [ | ||||
|             { | ||||
|                 id: "", | ||||
|                 name: t("note_language.not_set") | ||||
|             }, | ||||
|             "---", | ||||
|             ...getAvailableLocales() | ||||
|         ]; | ||||
|  | ||||
|         for (const locale of locales) { | ||||
|             if (typeof locale === "object") { | ||||
|                 const $title = $("<span>").text(locale.name); | ||||
|                 const $link = $('<a class="dropdown-item">') | ||||
|                     .attr("data-language", locale.id) | ||||
|                     .append('<span class="check">✓</span> ') | ||||
|                     .append($title); | ||||
|                 this.$noteLanguageDropdown.append($link); | ||||
|             } else { | ||||
|                 this.$noteLanguageDropdown.append('<div class="dropdown-divider"></div>'); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -1686,5 +1686,8 @@ | ||||
|   }, | ||||
|   "content_widget": { | ||||
|     "unknown_widget": "Unknown widget for \"{{id}}\"." | ||||
|   }, | ||||
|   "note_language": { | ||||
|     "not_set": "Not set" | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user