Browse Source
Task/refactor default locale (#7066)
Refactor default locale
pull/7061/head^2
Thomas Kaul
3 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with
20 additions and
22 deletions
-
apps/api/src/app/user/user.service.ts
-
apps/client/src/app/components/admin-market-data/admin-market-data.component.ts
-
apps/client/src/app/components/admin-users/admin-users.component.ts
-
apps/client/src/app/components/home-watchlist/home-watchlist.component.ts
-
apps/client/src/app/pages/portfolio/activities/create-or-update-activity-dialog/create-or-update-activity-dialog.component.ts
-
libs/common/src/lib/config.ts
-
libs/common/src/lib/helper.ts
-
libs/ui/src/lib/fire-calculator/fire-calculator.component.stories.ts
|
|
|
@ -28,11 +28,11 @@ import { |
|
|
|
DEFAULT_CURRENCY, |
|
|
|
DEFAULT_DATE_RANGE, |
|
|
|
DEFAULT_LANGUAGE_CODE, |
|
|
|
DEFAULT_LOCALE, |
|
|
|
PROPERTY_IS_READ_ONLY_MODE, |
|
|
|
PROPERTY_REFERRAL_PARTNERS, |
|
|
|
PROPERTY_SYSTEM_MESSAGE, |
|
|
|
TAG_ID_EXCLUDE_FROM_ANALYSIS, |
|
|
|
locale as defaultLocale |
|
|
|
TAG_ID_EXCLUDE_FROM_ANALYSIS |
|
|
|
} from '@ghostfolio/common/config'; |
|
|
|
import { SubscriptionType } from '@ghostfolio/common/enums'; |
|
|
|
import { |
|
|
|
@ -102,7 +102,7 @@ export class UserService { |
|
|
|
|
|
|
|
public async getUser({ |
|
|
|
impersonationUserId, |
|
|
|
locale = defaultLocale, |
|
|
|
locale = DEFAULT_LOCALE, |
|
|
|
user |
|
|
|
}: { |
|
|
|
impersonationUserId: string; |
|
|
|
|
|
|
|
@ -1,8 +1,8 @@ |
|
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service'; |
|
|
|
import { |
|
|
|
DEFAULT_COLOR_SCHEME, |
|
|
|
DEFAULT_PAGE_SIZE, |
|
|
|
locale |
|
|
|
DEFAULT_LOCALE, |
|
|
|
DEFAULT_PAGE_SIZE |
|
|
|
} from '@ghostfolio/common/config'; |
|
|
|
import { |
|
|
|
canDeleteAssetProfile, |
|
|
|
@ -429,7 +429,7 @@ export class GfAdminMarketDataComponent implements AfterViewInit, OnInit { |
|
|
|
colorScheme: |
|
|
|
this.user?.settings.colorScheme ?? DEFAULT_COLOR_SCHEME, |
|
|
|
deviceType: this.deviceType(), |
|
|
|
locale: this.user?.settings?.locale ?? locale |
|
|
|
locale: this.user?.settings?.locale ?? DEFAULT_LOCALE |
|
|
|
} satisfies AssetProfileDialogParams, |
|
|
|
height: this.deviceType() === 'mobile' ? '98vh' : '80vh', |
|
|
|
width: this.deviceType() === 'mobile' ? '100vw' : '50rem' |
|
|
|
@ -464,7 +464,7 @@ export class GfAdminMarketDataComponent implements AfterViewInit, OnInit { |
|
|
|
autoFocus: false, |
|
|
|
data: { |
|
|
|
deviceType: this.deviceType(), |
|
|
|
locale: this.user?.settings?.locale ?? locale |
|
|
|
locale: this.user?.settings?.locale ?? DEFAULT_LOCALE |
|
|
|
} satisfies CreateAssetProfileDialogParams, |
|
|
|
width: this.deviceType() === 'mobile' ? '100vw' : '50rem' |
|
|
|
}); |
|
|
|
|
|
|
|
@ -5,7 +5,7 @@ import { |
|
|
|
import { GfUserDetailDialogComponent } from '@ghostfolio/client/components/user-detail-dialog/user-detail-dialog.component'; |
|
|
|
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; |
|
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service'; |
|
|
|
import { DEFAULT_PAGE_SIZE, locale } from '@ghostfolio/common/config'; |
|
|
|
import { DEFAULT_LOCALE, DEFAULT_PAGE_SIZE } from '@ghostfolio/common/config'; |
|
|
|
import { ConfirmationDialogType } from '@ghostfolio/common/enums'; |
|
|
|
import { |
|
|
|
getDateFnsLocale, |
|
|
|
@ -317,7 +317,7 @@ export class GfAdminUsersComponent implements OnInit { |
|
|
|
currentUserId: this.user?.id, |
|
|
|
deviceType: this.deviceType(), |
|
|
|
hasPermissionForSubscription: this.hasPermissionForSubscription, |
|
|
|
locale: this.user?.settings?.locale ?? locale, |
|
|
|
locale: this.user?.settings?.locale ?? DEFAULT_LOCALE, |
|
|
|
userId: aUserId |
|
|
|
} satisfies UserDetailDialogParams, |
|
|
|
height: this.deviceType() === 'mobile' ? '98vh' : '60vh', |
|
|
|
|
|
|
|
@ -1,6 +1,6 @@ |
|
|
|
import { ImpersonationStorageService } from '@ghostfolio/client/services/impersonation-storage.service'; |
|
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service'; |
|
|
|
import { locale as defaultLocale } from '@ghostfolio/common/config'; |
|
|
|
import { DEFAULT_LOCALE } from '@ghostfolio/common/config'; |
|
|
|
import { |
|
|
|
AssetProfileIdentifier, |
|
|
|
Benchmark, |
|
|
|
@ -149,7 +149,7 @@ export class GfHomeWatchlistComponent implements OnInit { |
|
|
|
autoFocus: false, |
|
|
|
data: { |
|
|
|
deviceType: this.deviceType(), |
|
|
|
locale: this.user?.settings?.locale ?? defaultLocale |
|
|
|
locale: this.user?.settings?.locale ?? DEFAULT_LOCALE |
|
|
|
}, |
|
|
|
width: this.deviceType() === 'mobile' ? '100vw' : '50rem' |
|
|
|
}); |
|
|
|
|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
import { UserService } from '@ghostfolio/client/services/user/user.service'; |
|
|
|
import { ASSET_CLASS_MAPPING } from '@ghostfolio/common/config'; |
|
|
|
import { locale as defaultLocale } from '@ghostfolio/common/config'; |
|
|
|
import { ASSET_CLASS_MAPPING, DEFAULT_LOCALE } from '@ghostfolio/common/config'; |
|
|
|
import { CreateOrderDto, UpdateOrderDto } from '@ghostfolio/common/dtos'; |
|
|
|
import { getDateFormatString } from '@ghostfolio/common/helper'; |
|
|
|
import { |
|
|
|
@ -120,7 +119,7 @@ export class GfCreateOrUpdateActivityDialogComponent { |
|
|
|
this.hasPermissionToCreateOwnTag = |
|
|
|
this.data.user?.settings?.isExperimentalFeatures && |
|
|
|
hasPermission(this.data.user?.permissions, permissions.createOwnTag); |
|
|
|
this.locale = this.data.user.settings.locale ?? defaultLocale; |
|
|
|
this.locale = this.data.user.settings.locale ?? DEFAULT_LOCALE; |
|
|
|
this.mode = this.data.activity?.id ? 'update' : 'create'; |
|
|
|
|
|
|
|
this.dateAdapter.setLocale(this.locale); |
|
|
|
|
|
|
|
@ -13,8 +13,6 @@ export const ghostfolioFearAndGreedIndexSymbol = `${ghostfolioScraperApiSymbolPr |
|
|
|
export const ghostfolioFearAndGreedIndexSymbolCryptocurrencies = `${ghostfolioPrefix}_FEAR_AND_GREED_INDEX_CRYPTOCURRENCIES`; |
|
|
|
export const ghostfolioFearAndGreedIndexSymbolStocks = `${ghostfolioPrefix}_FEAR_AND_GREED_INDEX_STOCKS`; |
|
|
|
|
|
|
|
export const locale = 'en-US'; |
|
|
|
|
|
|
|
export const primaryColorHex = '#36cfcc'; |
|
|
|
export const primaryColorRgb = { |
|
|
|
r: 54, |
|
|
|
@ -85,6 +83,7 @@ export const DEFAULT_DATE_FORMAT_MONTH_YEAR = 'MMM yyyy'; |
|
|
|
export const DEFAULT_DATE_RANGE: DateRange = 'max'; |
|
|
|
export const DEFAULT_HOST = '0.0.0.0'; |
|
|
|
export const DEFAULT_LANGUAGE_CODE = 'en'; |
|
|
|
export const DEFAULT_LOCALE = 'en-US'; |
|
|
|
export const DEFAULT_PAGE_SIZE = 50; |
|
|
|
export const DEFAULT_PORT = 3333; |
|
|
|
export const DEFAULT_PROCESSOR_GATHER_ASSET_PROFILE_CONCURRENCY = 1; |
|
|
|
|
|
|
|
@ -36,12 +36,12 @@ import { get, isNil, isString } from 'lodash'; |
|
|
|
|
|
|
|
import { |
|
|
|
DEFAULT_CURRENCY, |
|
|
|
DEFAULT_LOCALE, |
|
|
|
DERIVED_CURRENCIES, |
|
|
|
ghostfolioFearAndGreedIndexSymbol, |
|
|
|
ghostfolioFearAndGreedIndexSymbolCryptocurrencies, |
|
|
|
ghostfolioFearAndGreedIndexSymbolStocks, |
|
|
|
ghostfolioScraperApiSymbolPrefix, |
|
|
|
locale |
|
|
|
ghostfolioScraperApiSymbolPrefix |
|
|
|
} from './config'; |
|
|
|
import { |
|
|
|
AdminMarketDataItem, |
|
|
|
@ -261,7 +261,7 @@ export function getCurrencyFromSymbol(aSymbol = '') { |
|
|
|
export function getCountryName({ code }: { code: string }): string { |
|
|
|
try { |
|
|
|
return ( |
|
|
|
new Intl.DisplayNames([document.documentElement.lang || locale], { |
|
|
|
new Intl.DisplayNames([document.documentElement.lang || DEFAULT_LOCALE], { |
|
|
|
type: 'region' |
|
|
|
}).of(code) ?? code |
|
|
|
); |
|
|
|
@ -338,7 +338,7 @@ export function getEmojiFlag(aCountryCode: string) { |
|
|
|
} |
|
|
|
|
|
|
|
export function getLocale() { |
|
|
|
return navigator.language ?? locale; |
|
|
|
return navigator.language ?? DEFAULT_LOCALE; |
|
|
|
} |
|
|
|
|
|
|
|
export function getLowercase(object: object, path: string) { |
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
import { locale } from '@ghostfolio/common/config'; |
|
|
|
import { DEFAULT_LOCALE } from '@ghostfolio/common/config'; |
|
|
|
|
|
|
|
import { CommonModule } from '@angular/common'; |
|
|
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
|
|
|
@ -47,7 +47,7 @@ export const Simple: Story = { |
|
|
|
annualInterestRate: 5, |
|
|
|
currency: 'USD', |
|
|
|
fireWealth: 50000, |
|
|
|
locale: locale, |
|
|
|
locale: DEFAULT_LOCALE, |
|
|
|
savingsRate: 1000 |
|
|
|
} |
|
|
|
}; |
|
|
|
|