fix(i18n): standardize locale formatting for Intl APIs

This commit is contained in:
CaIon
2026-07-07 13:40:06 +08:00
parent 5cbb7b0be1
commit 8f31b30598
6 changed files with 35 additions and 7 deletions
@@ -51,6 +51,7 @@ import {
formatQuotaWithCurrency,
getCurrencyLabel,
} from '@/lib/currency'
import { toIntlLocale } from '@/i18n/languages'
import { formatTimestampToDate } from '@/lib/format'
import { truncateText } from '@/lib/utils'
@@ -310,7 +311,7 @@ function BalanceCell({ channel }: { channel: Channel }) {
const withSuffix = (value: string) =>
tokenSuffix && value !== '-' ? `${value}${tokenSuffix}` : value
const locale = i18n.resolvedLanguage || i18n.language
const locale = toIntlLocale(i18n.resolvedLanguage || i18n.language)
const balanceFormatOptions = {
digitsLarge: 2,
digitsSmall: 4,
@@ -519,7 +520,7 @@ export function useChannelsColumns(
const { t, i18n } = useTranslation()
const { sensitiveVisible } = useChannels()
const enableSelection = options.enableSelection ?? true
const locale = i18n.resolvedLanguage || i18n.language
const locale = toIntlLocale(i18n.resolvedLanguage || i18n.language)
// The column definitions only depend on the translation function, the active
// locale, and sensitive-data visibility. Memoizing keeps the array (and every
// cell renderer reference) stable across unrelated re-renders, so react-table