Skip to content

Commit

Permalink
fix: update number formats for german
Browse files Browse the repository at this point in the history
add missing currency display in CurrencyCell
  • Loading branch information
simonwep committed Dec 29, 2023
1 parent 6e2e835 commit a2bc10a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions src/app/components/base/currency-cell/CurrencyCell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<script lang="ts" setup>
import { computed, nextTick, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n';
import { useDataStore } from '@store/state';
const modelValue = defineModel<number | undefined>();
Expand All @@ -29,11 +30,14 @@ const props = withDefaults(
const input = ref<HTMLInputElement>();
const focused = ref(false);
const { state } = useDataStore();
const { n } = useI18n();
const value = computed(() => {
return focused.value || !modelValue.value ? modelValue.value || '' : n(modelValue.value, 'currency');
});
const value = computed(() =>
focused.value || !modelValue.value
? modelValue.value || ''
: n(modelValue.value, { key: 'currency', currency: state.currency })
);
const updateModelValue = (raw?: string) => {
const number = Number(raw?.trim() || NaN);
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"currency": {
"currency": "USD",
"minimumFractionDigits": 0,
"style": "Währung"
"style": "currency"
},
"percent": {
"maximumFractionDigits": 0,
"style": "Prozent"
"style": "percent"
}
},
"navigation": {
Expand Down

0 comments on commit a2bc10a

Please sign in to comment.