${t("i18n.first-day-of-the-week")}
@@ -35,6 +43,7 @@ const TPL = `
export default class LocalizationOptions extends OptionsWidget {
private $localeSelect!: JQuery;
+ private $formattingLocaleSelect!: JQuery;
doRender() {
this.$widget = $(TPL);
@@ -46,6 +55,8 @@ export default class LocalizationOptions extends OptionsWidget {
utils.reloadFrontendApp("locale change");
});
+ this.$formattingLocaleSelect = this.$widget.find(".formatting-locale-select");
+
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());
this.updateOption("firstDayOfWeek", firstDayOfWeek);
@@ -53,14 +64,27 @@ export default class LocalizationOptions extends OptionsWidget {
}
async optionsLoaded(options: OptionMap) {
- const availableLocales = getAvailableLocales().filter(l => !l.contentOnly);
- this.$localeSelect.empty();
+ const allLocales = getAvailableLocales();
- for (const locale of availableLocales) {
- this.$localeSelect.append($("").attr("value", locale.id).text(locale.name));
+ function buildLocaleItem(locale: Locale) {
+ return $(" ")
+ .attr("value", locale.id)
+ .text(locale.name)
}
+ // Build list of UI locales.
+ this.$localeSelect.empty();
+ for (const locale of allLocales.filter(l => !l.contentOnly)) {
+ this.$localeSelect.append(buildLocaleItem(locale));
+ }
this.$localeSelect.val(options.locale);
+
+ // Build list of Electron locales.
+ this.$formattingLocaleSelect.empty();
+ for (const locale of allLocales.filter(l => l.electronLocale)) {
+ this.$formattingLocaleSelect.append(buildLocaleItem(locale));
+ }
+
this.$widget.find(`input[name="first-day-of-week"][value="${options.firstDayOfWeek}"]`)
.prop("checked", "true");
}
diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json
index 865d0dca0..2355f0fa7 100644
--- a/src/public/translations/en/translation.json
+++ b/src/public/translations/en/translation.json
@@ -1242,7 +1242,8 @@
"language": "Language",
"first-day-of-the-week": "First day of the week",
"sunday": "Sunday",
- "monday": "Monday"
+ "monday": "Monday",
+ "formatting-locale": "Formats (date, numbers)"
},
"backup": {
"automatic_backup": "Automatic backup",
diff --git a/src/services/i18n.ts b/src/services/i18n.ts
index e40a670ab..691f150b7 100644
--- a/src/services/i18n.ts
+++ b/src/services/i18n.ts
@@ -13,12 +13,15 @@ export interface Locale {
rtl?: boolean;
/** `true` if the language is not supported by the application as a display language, but it is selectable by the user for the content. */
contentOnly?: boolean;
+ /** The value to pass to `--lang` for the Electron instance in order to set it as a locale. Not setting it will hide it from the list of supported locales. */
+ electronLocale?: string;
}
const LOCALES: Locale[] = [
{
id: "en",
- name: "English"
+ name: "English",
+ electronLocale: "en"
},
{
id: "de",