Browse Source

fix: i18n for Currnecy

pull/6519/head
Muhammed Mustafa 12 months ago
parent
commit
e413a220dd
  1. 4
      packages/nc-gui/components/cell/Currency.vue
  2. 12
      packages/nc-gui/components/smartsheet/column/CurrencyOptions.vue
  3. 5
      packages/nc-gui/lang/en.json

4
packages/nc-gui/components/cell/Currency.vue

@ -79,7 +79,7 @@ onMounted(() => {
v-model="vModel" v-model="vModel"
type="number" type="number"
class="w-full h-full text-sm border-none rounded-md outline-none" class="w-full h-full text-sm border-none rounded-md outline-none"
:placeholder="isEditColumn ? '(Optional)' : ''" :placeholder="isEditColumn ? $t('labels.optional') : ''"
@blur="submitCurrency" @blur="submitCurrency"
@keydown.down.stop @keydown.down.stop
@keydown.left.stop @keydown.left.stop
@ -93,7 +93,7 @@ onMounted(() => {
@contextmenu.stop @contextmenu.stop
/> />
<span v-else-if="vModel === null && showNull" class="nc-null">NULL</span> <span v-else-if="vModel === null && showNull" class="nc-null">{{ $t('labels.null') }}</span>
<!-- only show the numeric value as previously string value was accepted --> <!-- only show the numeric value as previously string value was accepted -->
<span v-else-if="!isNaN(vModel)">{{ currency }}</span> <span v-else-if="!isNaN(vModel)">{{ currency }}</span>

12
packages/nc-gui/components/smartsheet/column/CurrencyOptions.vue

@ -12,6 +12,8 @@ const props = defineProps<{
const emit = defineEmits(['update:value']) const emit = defineEmits(['update:value'])
const { t } = useI18n()
const vModel = useVModel(props, 'value', emit) const vModel = useVModel(props, 'value', emit)
const validators = { const validators = {
@ -20,7 +22,7 @@ const validators = {
validator: (_: any, locale: any) => { validator: (_: any, locale: any) => {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
if (!validateCurrencyLocale(locale)) { if (!validateCurrencyLocale(locale)) {
return reject(new Error('Invalid locale')) return reject(new Error(t('msg.invalidLocale')))
} }
resolve() resolve()
}) })
@ -32,7 +34,7 @@ const validators = {
validator: (_: any, currencyCode: any) => { validator: (_: any, currencyCode: any) => {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
if (!validateCurrencyCode(currencyCode)) { if (!validateCurrencyCode(currencyCode)) {
return reject(new Error('Invalid Currency Code')) return reject(new Error(t('msg.invalidCurrencyCode')))
} }
resolve() resolve()
}) })
@ -54,7 +56,7 @@ const currencyLocaleList = ref<{ text: string; value: string }[]>([])
const isMoney = computed(() => vModel.value.dt === 'money') const isMoney = computed(() => vModel.value.dt === 'money')
const message = computed(() => { const message = computed(() => {
if (isMoney.value && isPg.value) return "PostgreSQL 'money' type has own currency settings" if (isMoney.value && isPg.value) return t('msg.postgresHasItsOwnCurrencySettings')
return '' return ''
}) })
@ -77,7 +79,7 @@ currencyLocales().then((locales) => {
<template> <template>
<a-row gutter="8"> <a-row gutter="8">
<a-col :span="12"> <a-col :span="12">
<a-form-item v-bind="validateInfos['meta.currency_locale']" label="Currency Locale"> <a-form-item v-bind="validateInfos['meta.currency_locale']" :label="$t('title.currencyLocale')">
<a-select <a-select
v-model:value="vModel.meta.currency_locale" v-model:value="vModel.meta.currency_locale"
class="w-52" class="w-52"
@ -94,7 +96,7 @@ currencyLocales().then((locales) => {
</a-col> </a-col>
<a-col :span="12"> <a-col :span="12">
<a-form-item v-bind="validateInfos['meta.currency_code']" label="Currency Code"> <a-form-item v-bind="validateInfos['meta.currency_code']" :label="$t('title.currencyCode')">
<a-select <a-select
v-model:value="vModel.meta.currency_code" v-model:value="vModel.meta.currency_code"
class="w-52" class="w-52"

5
packages/nc-gui/lang/en.json

@ -258,6 +258,8 @@
"isNotNull": "is not null" "isNotNull": "is not null"
}, },
"title": { "title": {
"currencyLocale": "Currency Locale",
"currencyCode": "Currency Code",
"searchMembers": "Search Members", "searchMembers": "Search Members",
"noMembersFound": "No members found", "noMembersFound": "No members found",
"dateJoined": "Date Joined", "dateJoined": "Date Joined",
@ -764,6 +766,9 @@
"selectField": "Select field" "selectField": "Select field"
}, },
"msg": { "msg": {
"invalidLocale": "Invalid locale",
"invalidCurrencyCode": "Invalid Currency Code",
"postgresHasItsOwnCurrencySettings": "PostgreSQL 'money' type has own currency settings",
"validColumnsForBarCode": "The valid Column Types for a Barcode Column are: Number, Single Line Text, Long Text, Phone Number, URL, Email, Decimal. Please create one first.", "validColumnsForBarCode": "The valid Column Types for a Barcode Column are: Number, Single Line Text, Long Text, Phone Number, URL, Email, Decimal. Please create one first.",
"hm": { "hm": {
"title": "Has Many Relation", "title": "Has Many Relation",

Loading…
Cancel
Save