mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-24 16:21:32 +08:00
feat(settings): make the formatting locale value adjustable
This commit is contained in:
parent
c4559749f1
commit
b923a23d95
@ -56,6 +56,10 @@ export default class LocalizationOptions extends OptionsWidget {
|
||||
});
|
||||
|
||||
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", () => {
|
||||
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)) {
|
||||
this.$formattingLocaleSelect.append(buildLocaleItem(locale));
|
||||
}
|
||||
this.$formattingLocaleSelect.val(options.formattingLocale);
|
||||
|
||||
this.$widget.find(`input[name="first-day-of-week"][value="${options.firstDayOfWeek}"]`)
|
||||
.prop("checked", "true");
|
||||
|
||||
@ -70,6 +70,7 @@ const ALLOWED_OPTIONS = new Set<OptionNames>([
|
||||
"promotedAttributesOpenInRibbon",
|
||||
"editedNotesOpenInRibbon",
|
||||
"locale",
|
||||
"formattingLocale",
|
||||
"firstDayOfWeek",
|
||||
"languages",
|
||||
"textNoteEditorType",
|
||||
|
||||
@ -137,6 +137,7 @@ const defaultOptions: DefaultOption[] = [
|
||||
|
||||
// Internationalization
|
||||
{ name: "locale", value: "en", isSynced: true },
|
||||
{ name: "formattingLocale", value: "en", isSynced: true },
|
||||
{ name: "firstDayOfWeek", value: "1", isSynced: true },
|
||||
{ name: "languages", value: "[]", isSynced: true },
|
||||
|
||||
|
||||
@ -35,6 +35,7 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions<KeyboardActi
|
||||
customSearchEngineName: string;
|
||||
customSearchEngineUrl: string;
|
||||
locale: string;
|
||||
formattingLocale: string;
|
||||
codeBlockTheme: string;
|
||||
textNoteEditorType: string;
|
||||
layoutOrientation: string;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user