Browse Source

refactor(nc-gui): tree-shake locale-codes

pull/3801/head
braks 2 years ago
parent
commit
1e163d7867
  1. 18
      packages/nc-gui/utils/currencyUtils.ts

18
packages/nc-gui/utils/currencyUtils.ts

@ -1,4 +1,4 @@
import locale from 'locale-codes' import { all } from 'locale-codes'
export const currencyCodes = [ export const currencyCodes = [
'AED', 'AED',
@ -191,24 +191,14 @@ export function validateCurrencyCode(v: string) {
} }
export function currencyLocales() { export function currencyLocales() {
const localeList = locale.all return all
.filter((l: Record<string, any>) => { .filter((l) => validateCurrencyLocale(l.tag))
try { .map((l) => {
if (Intl.NumberFormat.supportedLocalesOf(l.tag).length > 0) {
return true
}
return false
} catch (e) {
return false
}
})
.map((l: Record<string, any>) => {
return { return {
text: `${l.name} (${l.tag})`, text: `${l.name} (${l.tag})`,
value: l.tag, value: l.tag,
} }
}) })
return localeList
} }
export function validateCurrencyLocale(v: string) { export function validateCurrencyLocale(v: string) {

Loading…
Cancel
Save