feat(settings): make the formatting locale value adjustable

This commit is contained in:
Elian Doran 2025-03-25 19:56:07 +02:00
parent c4559749f1
commit b923a23d95
No known key found for this signature in database
4 changed files with 8 additions and 0 deletions

View File

@ -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");

View File

@ -70,6 +70,7 @@ const ALLOWED_OPTIONS = new Set<OptionNames>([
"promotedAttributesOpenInRibbon", "promotedAttributesOpenInRibbon",
"editedNotesOpenInRibbon", "editedNotesOpenInRibbon",
"locale", "locale",
"formattingLocale",
"firstDayOfWeek", "firstDayOfWeek",
"languages", "languages",
"textNoteEditorType", "textNoteEditorType",

View File

@ -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 },

View File

@ -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;