fix the locale settings on the profile page does not immediately update the preview
This commit is contained in:
+69
-60
@@ -777,8 +777,10 @@ export function useI18n() {
|
||||
format = FiscalYearFormat.Default;
|
||||
}
|
||||
|
||||
if (!isDefined(calendarType) || !isGregorianLikeCalendarType(calendarType)) {
|
||||
if (!isDefined(calendarType)) {
|
||||
calendarType = getGregorianLikeCalendarType();
|
||||
} else if (!isGregorianLikeCalendarType(calendarType)) {
|
||||
calendarType = CalendarType.Gregorian;
|
||||
}
|
||||
|
||||
const dateTimeFormatOptions = getDateTimeFormatOptions({
|
||||
@@ -1611,109 +1613,109 @@ export function useI18n() {
|
||||
return numeralSystem.getAllDigits();
|
||||
}
|
||||
|
||||
function getCurrentCalendarDisplayType(): CalendarDisplayType {
|
||||
let calendarDisplayType = CalendarDisplayType.valueOf(userStore.currentUserCalendarDisplayType);
|
||||
function getLocaleDefaultCalendarDisplayType(): CalendarDisplayType {
|
||||
const defaultCalendarDisplayTypeName = t('default.calendarDisplayType');
|
||||
let calendarDisplayType = CalendarDisplayType.parse(defaultCalendarDisplayTypeName);
|
||||
|
||||
if (!calendarDisplayType) {
|
||||
const defaultCalendarDisplayTypeName = t('default.calendarDisplayType');
|
||||
calendarDisplayType = CalendarDisplayType.parse(defaultCalendarDisplayTypeName);
|
||||
|
||||
if (!calendarDisplayType) {
|
||||
calendarDisplayType = CalendarDisplayType.Default;
|
||||
}
|
||||
calendarDisplayType = CalendarDisplayType.Default;
|
||||
}
|
||||
|
||||
return calendarDisplayType;
|
||||
}
|
||||
|
||||
function getCurrentDateDisplayType(): DateDisplayType {
|
||||
let dateDisplayType = DateDisplayType.valueOf(userStore.currentUserDateDisplayType);
|
||||
function getLocaleDefaultDateDisplayType(): DateDisplayType {
|
||||
const defaultDateDisplayTypeName = t('default.dateDisplayType');
|
||||
let dateDisplayType = DateDisplayType.parse(defaultDateDisplayTypeName);
|
||||
|
||||
if (!dateDisplayType) {
|
||||
const defaultDateDisplayTypeName = t('default.dateDisplayType');
|
||||
dateDisplayType = DateDisplayType.parse(defaultDateDisplayTypeName);
|
||||
|
||||
if (!dateDisplayType) {
|
||||
dateDisplayType = DateDisplayType.Default;
|
||||
}
|
||||
dateDisplayType = DateDisplayType.Default;
|
||||
}
|
||||
|
||||
return dateDisplayType;
|
||||
}
|
||||
|
||||
function getCurrentNumeralSystemType(): NumeralSystem {
|
||||
let numeralSystemType = NumeralSystem.valueOf(userStore.currentUserNumeralSystem);
|
||||
function getLocaleDefaultNumeralSystemType(): NumeralSystem {
|
||||
const defaultNumeralSystemTypeName = t('default.numeralSystem');
|
||||
let numeralSystemType = NumeralSystem.parse(defaultNumeralSystemTypeName);
|
||||
|
||||
if (!numeralSystemType) {
|
||||
const defaultNumeralSystemTypeName = t('default.numeralSystem');
|
||||
numeralSystemType = NumeralSystem.parse(defaultNumeralSystemTypeName);
|
||||
|
||||
if (!numeralSystemType) {
|
||||
numeralSystemType = NumeralSystem.Default;
|
||||
}
|
||||
numeralSystemType = NumeralSystem.Default;
|
||||
}
|
||||
|
||||
return numeralSystemType;
|
||||
}
|
||||
|
||||
function getCurrentDecimalSeparator(): string {
|
||||
let decimalSeparatorType = DecimalSeparator.valueOf(userStore.currentUserDecimalSeparator);
|
||||
function getLocaleDefaultDecimalSeparator(): DecimalSeparator {
|
||||
const defaultDecimalSeparatorTypeName = t('default.decimalSeparator');
|
||||
let decimalSeparatorType = DecimalSeparator.parse(defaultDecimalSeparatorTypeName);
|
||||
|
||||
if (!decimalSeparatorType) {
|
||||
const defaultDecimalSeparatorTypeName = t('default.decimalSeparator');
|
||||
decimalSeparatorType = DecimalSeparator.parse(defaultDecimalSeparatorTypeName);
|
||||
|
||||
if (!decimalSeparatorType) {
|
||||
decimalSeparatorType = DecimalSeparator.Default;
|
||||
}
|
||||
decimalSeparatorType = DecimalSeparator.Default;
|
||||
}
|
||||
|
||||
return decimalSeparatorType.symbol;
|
||||
return decimalSeparatorType;
|
||||
}
|
||||
|
||||
function getCurrentDigitGroupingSymbol(): string {
|
||||
let digitGroupingSymbolType = DigitGroupingSymbol.valueOf(userStore.currentUserDigitGroupingSymbol);
|
||||
function getLocaleDefaultDigitGroupingSymbol(): DigitGroupingSymbol {
|
||||
const defaultDigitGroupingSymbolTypeName = t('default.digitGroupingSymbol');
|
||||
let digitGroupingSymbolType = DigitGroupingSymbol.parse(defaultDigitGroupingSymbolTypeName);
|
||||
|
||||
if (!digitGroupingSymbolType) {
|
||||
const defaultDigitGroupingSymbolTypeName = t('default.digitGroupingSymbol');
|
||||
digitGroupingSymbolType = DigitGroupingSymbol.parse(defaultDigitGroupingSymbolTypeName);
|
||||
|
||||
if (!digitGroupingSymbolType) {
|
||||
digitGroupingSymbolType = DigitGroupingSymbol.Default;
|
||||
}
|
||||
digitGroupingSymbolType = DigitGroupingSymbol.Default;
|
||||
}
|
||||
|
||||
return digitGroupingSymbolType.symbol;
|
||||
return digitGroupingSymbolType;
|
||||
}
|
||||
|
||||
function getCurrentDigitGroupingType(): DigitGroupingType {
|
||||
let digitGroupingType = DigitGroupingType.valueOf(userStore.currentUserDigitGrouping);
|
||||
function getLocaleDefaultDigitGroupingType(): DigitGroupingType {
|
||||
const defaultDigitGroupingTypeName = t('default.digitGrouping');
|
||||
let digitGroupingType = DigitGroupingType.parse(defaultDigitGroupingTypeName);
|
||||
|
||||
if (!digitGroupingType) {
|
||||
const defaultDigitGroupingTypeName = t('default.digitGrouping');
|
||||
digitGroupingType = DigitGroupingType.parse(defaultDigitGroupingTypeName);
|
||||
|
||||
if (!digitGroupingType) {
|
||||
digitGroupingType = DigitGroupingType.Default;
|
||||
}
|
||||
digitGroupingType = DigitGroupingType.Default;
|
||||
}
|
||||
|
||||
return digitGroupingType;
|
||||
}
|
||||
|
||||
function getCurrentFiscalYearFormatType(): number {
|
||||
let fiscalYearFormat = FiscalYearFormat.valueOf(userStore.currentUserFiscalYearFormat);
|
||||
function getLocaleFiscalYearFormatType(): FiscalYearFormat {
|
||||
const defaultFiscalYearFormatTypeName = t('default.fiscalYearFormat');
|
||||
let fiscalYearFormat = FiscalYearFormat.parse(defaultFiscalYearFormatTypeName);
|
||||
|
||||
if (!fiscalYearFormat) {
|
||||
const defaultFiscalYearFormatTypeName = t('default.fiscalYearFormat');
|
||||
fiscalYearFormat = FiscalYearFormat.parse(defaultFiscalYearFormatTypeName);
|
||||
|
||||
if (!fiscalYearFormat) {
|
||||
fiscalYearFormat = FiscalYearFormat.Default;
|
||||
}
|
||||
fiscalYearFormat = FiscalYearFormat.Default;
|
||||
}
|
||||
|
||||
return fiscalYearFormat.type;
|
||||
return fiscalYearFormat;
|
||||
}
|
||||
|
||||
function getCurrentCalendarDisplayType(): CalendarDisplayType {
|
||||
return CalendarDisplayType.valueOf(userStore.currentUserCalendarDisplayType) ?? getLocaleDefaultCalendarDisplayType();
|
||||
}
|
||||
|
||||
function getCurrentDateDisplayType(): DateDisplayType {
|
||||
return DateDisplayType.valueOf(userStore.currentUserDateDisplayType) ?? getLocaleDefaultDateDisplayType();
|
||||
}
|
||||
|
||||
function getCurrentNumeralSystemType(): NumeralSystem {
|
||||
return NumeralSystem.valueOf(userStore.currentUserNumeralSystem) ?? getLocaleDefaultNumeralSystemType();
|
||||
}
|
||||
|
||||
function getCurrentDecimalSeparator(): string {
|
||||
return DecimalSeparator.valueOf(userStore.currentUserDecimalSeparator)?.symbol ?? getLocaleDefaultDecimalSeparator().symbol;
|
||||
}
|
||||
|
||||
function getCurrentDigitGroupingSymbol(): string {
|
||||
return DigitGroupingSymbol.valueOf(userStore.currentUserDigitGroupingSymbol)?.symbol ?? getLocaleDefaultDigitGroupingSymbol().symbol;
|
||||
}
|
||||
|
||||
function getCurrentDigitGroupingType(): DigitGroupingType {
|
||||
return DigitGroupingType.valueOf(userStore.currentUserDigitGrouping) ?? getLocaleDefaultDigitGroupingType();
|
||||
}
|
||||
|
||||
function getCurrentFiscalYearFormatType(): number {
|
||||
return FiscalYearFormat.valueOf(userStore.currentUserFiscalYearFormat)?.type ?? getLocaleFiscalYearFormatType().type;
|
||||
}
|
||||
|
||||
function getCurrencyName(currencyCode: string): string {
|
||||
@@ -2328,6 +2330,13 @@ export function useI18n() {
|
||||
getMultiMonthdayShortNames,
|
||||
getMultiWeekdayLongNames,
|
||||
getAllLocalizedDigits,
|
||||
getLocaleDefaultCalendarDisplayType,
|
||||
getLocaleDefaultDateDisplayType,
|
||||
getLocaleDefaultNumeralSystemType,
|
||||
getLocaleDefaultDecimalSeparator,
|
||||
getLocaleDefaultDigitGroupingSymbol,
|
||||
getLocaleDefaultDigitGroupingType,
|
||||
getLocaleFiscalYearFormatType,
|
||||
getCurrentCalendarDisplayType,
|
||||
getCurrentDateDisplayType,
|
||||
getCurrentNumeralSystemType,
|
||||
|
||||
@@ -39,6 +39,10 @@ export function useUserProfilePageBase() {
|
||||
getAllExpenseAmountColors,
|
||||
getAllIncomeAmountColors,
|
||||
getAllTransactionEditScopeTypes,
|
||||
getLocaleDefaultDateDisplayType,
|
||||
getLocaleDefaultNumeralSystemType,
|
||||
getLocaleDefaultDecimalSeparator,
|
||||
getLocaleDefaultDigitGroupingSymbol,
|
||||
setLanguage
|
||||
} = useI18n();
|
||||
|
||||
@@ -57,22 +61,27 @@ export function useUserProfilePageBase() {
|
||||
const resending = ref<boolean>(false);
|
||||
const saving = ref<boolean>(false);
|
||||
|
||||
const currentDateDisplayType = computed<DateDisplayType>(() => DateDisplayType.valueOf(newProfile.value.dateDisplayType) ?? getLocaleDefaultDateDisplayType());
|
||||
const currentNumeralSystem = computed<NumeralSystem>(() => NumeralSystem.valueOf(newProfile.value.numeralSystem) ?? getLocaleDefaultNumeralSystemType());
|
||||
const currentDecimalSeparator = computed<string>(() => DecimalSeparator.valueOf(newProfile.value.decimalSeparator)?.symbol ?? getLocaleDefaultDecimalSeparator().symbol);
|
||||
const currentDigitGroupingSymbol = computed<string>(() => DigitGroupingSymbol.valueOf(newProfile.value.digitGroupingSymbol)?.symbol ?? getLocaleDefaultDigitGroupingSymbol().symbol);
|
||||
|
||||
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
|
||||
const allVisibleAccounts = computed<Account[]>(() => accountsStore.allVisiblePlainAccounts);
|
||||
const allVisibleCategorizedAccounts = computed<CategorizedAccount[]>(() => getCategorizedAccounts(allVisibleAccounts.value));
|
||||
const allWeekDays = computed<TypeAndDisplayName[]>(() => getAllWeekDays());
|
||||
const allCalendarDisplayTypes = computed<TypeAndDisplayName[]>(() => getAllCalendarDisplayTypes());
|
||||
const allDateDisplayTypes = computed<TypeAndDisplayName[]>(() => getAllDateDisplayTypes());
|
||||
const allLongDateFormats = computed<TypeAndDisplayName[]>(() => getAllLongDateFormats(NumeralSystem.valueOf(newProfile.value.numeralSystem) ?? NumeralSystem.Default, DateDisplayType.valueOf(newProfile.value.dateDisplayType)?.calendarType || DateDisplayType.Default.calendarType));
|
||||
const allShortDateFormats = computed<TypeAndDisplayName[]>(() => getAllShortDateFormats(NumeralSystem.valueOf(newProfile.value.numeralSystem) ?? NumeralSystem.Default, DateDisplayType.valueOf(newProfile.value.dateDisplayType)?.calendarType || DateDisplayType.Default.calendarType));
|
||||
const allLongTimeFormats = computed<TypeAndDisplayName[]>(() => getAllLongTimeFormats(NumeralSystem.valueOf(newProfile.value.numeralSystem) ?? NumeralSystem.Default));
|
||||
const allShortTimeFormats = computed<TypeAndDisplayName[]>(() => getAllShortTimeFormats(NumeralSystem.valueOf(newProfile.value.numeralSystem) ?? NumeralSystem.Default));
|
||||
const allFiscalYearFormats = computed<TypeAndDisplayName[]>(() => getAllFiscalYearFormats(NumeralSystem.valueOf(newProfile.value.numeralSystem) ?? NumeralSystem.Default, DateDisplayType.valueOf(newProfile.value.dateDisplayType)?.calendarType || DateDisplayType.Default.calendarType));
|
||||
const allCurrencyDisplayTypes = computed<TypeAndDisplayName[]>(() => getAllCurrencyDisplayTypes(NumeralSystem.valueOf(newProfile.value.numeralSystem) ?? NumeralSystem.Default, DecimalSeparator.valueOf(newProfile.value.decimalSeparator)?.symbol || DecimalSeparator.Default.symbol));
|
||||
const allLongDateFormats = computed<TypeAndDisplayName[]>(() => getAllLongDateFormats(currentNumeralSystem.value, currentDateDisplayType.value.calendarType));
|
||||
const allShortDateFormats = computed<TypeAndDisplayName[]>(() => getAllShortDateFormats(currentNumeralSystem.value, currentDateDisplayType.value.calendarType));
|
||||
const allLongTimeFormats = computed<TypeAndDisplayName[]>(() => getAllLongTimeFormats(currentNumeralSystem.value));
|
||||
const allShortTimeFormats = computed<TypeAndDisplayName[]>(() => getAllShortTimeFormats(currentNumeralSystem.value));
|
||||
const allFiscalYearFormats = computed<TypeAndDisplayName[]>(() => getAllFiscalYearFormats(currentNumeralSystem.value, currentDateDisplayType.value.calendarType));
|
||||
const allCurrencyDisplayTypes = computed<TypeAndDisplayName[]>(() => getAllCurrencyDisplayTypes(currentNumeralSystem.value, currentDecimalSeparator.value));
|
||||
const allNumeralSystemTypes = computed<TypeAndDisplayName[]>(() => getAllNumeralSystemTypes());
|
||||
const allDecimalSeparators = computed<TypeAndDisplayName[]>(() => getAllDecimalSeparators());
|
||||
const allDigitGroupingSymbols = computed<TypeAndDisplayName[]>(() => getAllDigitGroupingSymbols());
|
||||
const allDigitGroupingTypes = computed<LocalizedDigitGroupingType[]>(() => getAllDigitGroupingTypes(NumeralSystem.valueOf(newProfile.value.numeralSystem) ?? NumeralSystem.Default, DigitGroupingSymbol.valueOf(newProfile.value.digitGroupingSymbol)?.symbol || DigitGroupingSymbol.Default.symbol));
|
||||
const allDigitGroupingTypes = computed<LocalizedDigitGroupingType[]>(() => getAllDigitGroupingTypes(currentNumeralSystem.value, currentDigitGroupingSymbol.value));
|
||||
const allCoordinateDisplayTypes = computed<TypeAndDisplayName[]>(() => getAllCoordinateDisplayTypes());
|
||||
const allExpenseAmountColorTypes = computed<TypeAndDisplayName[]>(() => getAllExpenseAmountColors());
|
||||
const allIncomeAmountColorTypes = computed<TypeAndDisplayName[]>(() => getAllIncomeAmountColors());
|
||||
|
||||
Reference in New Issue
Block a user