mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	feat(settings): make the formatting locale value adjustable
This commit is contained in:
		| @@ -56,6 +56,10 @@ export default class LocalizationOptions extends OptionsWidget { | |||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         this.$formattingLocaleSelect = this.$widget.find(".formatting-locale-select"); |         this.$formattingLocaleSelect = this.$widget.find(".formatting-locale-select"); | ||||||
|  |         this.$formattingLocaleSelect.on("change", async () => { | ||||||
|  |             const newLocale = this.$formattingLocaleSelect.val(); | ||||||
|  |             await server.put(`options/formattingLocale/${newLocale}`); | ||||||
|  |         }); | ||||||
|  |  | ||||||
|         this.$widget.find(`input[name="first-day-of-week"]`).on("change", () => { |         this.$widget.find(`input[name="first-day-of-week"]`).on("change", () => { | ||||||
|             const firstDayOfWeek = String(this.$widget.find(`input[name="first-day-of-week"]:checked`).val()); |             const firstDayOfWeek = String(this.$widget.find(`input[name="first-day-of-week"]:checked`).val()); | ||||||
| @@ -84,6 +88,7 @@ export default class LocalizationOptions extends OptionsWidget { | |||||||
|         for (const locale of allLocales.filter(l => l.electronLocale)) { |         for (const locale of allLocales.filter(l => l.electronLocale)) { | ||||||
|             this.$formattingLocaleSelect.append(buildLocaleItem(locale)); |             this.$formattingLocaleSelect.append(buildLocaleItem(locale)); | ||||||
|         } |         } | ||||||
|  |         this.$formattingLocaleSelect.val(options.formattingLocale); | ||||||
|  |  | ||||||
|         this.$widget.find(`input[name="first-day-of-week"][value="${options.firstDayOfWeek}"]`) |         this.$widget.find(`input[name="first-day-of-week"][value="${options.firstDayOfWeek}"]`) | ||||||
|                     .prop("checked", "true"); |                     .prop("checked", "true"); | ||||||
|   | |||||||
| @@ -70,6 +70,7 @@ const ALLOWED_OPTIONS = new Set<OptionNames>([ | |||||||
|     "promotedAttributesOpenInRibbon", |     "promotedAttributesOpenInRibbon", | ||||||
|     "editedNotesOpenInRibbon", |     "editedNotesOpenInRibbon", | ||||||
|     "locale", |     "locale", | ||||||
|  |     "formattingLocale", | ||||||
|     "firstDayOfWeek", |     "firstDayOfWeek", | ||||||
|     "languages", |     "languages", | ||||||
|     "textNoteEditorType", |     "textNoteEditorType", | ||||||
|   | |||||||
| @@ -137,6 +137,7 @@ const defaultOptions: DefaultOption[] = [ | |||||||
|  |  | ||||||
|     // Internationalization |     // Internationalization | ||||||
|     { name: "locale", value: "en", isSynced: true }, |     { name: "locale", value: "en", isSynced: true }, | ||||||
|  |     { name: "formattingLocale", value: "en", isSynced: true }, | ||||||
|     { name: "firstDayOfWeek", value: "1", isSynced: true }, |     { name: "firstDayOfWeek", value: "1", isSynced: true }, | ||||||
|     { name: "languages", value: "[]", isSynced: true }, |     { name: "languages", value: "[]", isSynced: true }, | ||||||
|  |  | ||||||
|   | |||||||
| @@ -35,6 +35,7 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions<KeyboardActi | |||||||
|     customSearchEngineName: string; |     customSearchEngineName: string; | ||||||
|     customSearchEngineUrl: string; |     customSearchEngineUrl: string; | ||||||
|     locale: string; |     locale: string; | ||||||
|  |     formattingLocale: string; | ||||||
|     codeBlockTheme: string; |     codeBlockTheme: string; | ||||||
|     textNoteEditorType: string; |     textNoteEditorType: string; | ||||||
|     layoutOrientation: string; |     layoutOrientation: string; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user