diff --git a/src/util/format.js b/src/util/format.js index 9194b8a9db..37f207bf63 100644 --- a/src/util/format.js +++ b/src/util/format.js @@ -1,5 +1,5 @@ import amountFormatter from 'nfe-amount-formatter'; -import {currencyPostfix} from './types'; +import { currencyAffixNOK } from './types'; const getWeightedSumOfDigits = (accountNumber) => { const weights = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2, 1]; @@ -27,10 +27,8 @@ export function accountFormatter(accountNumber) { } export function balanceWithCurrency(balance = '', locale, currencyCode) { - if (currencyCode && currencyCode !== "NOK") { - return `${amountFormatter(balance, locale)} ${currencyCode}`; - } - - return `${amountFormatter(balance, locale)} ${currencyPostfix[locale]}`; + const amount = amountFormatter(balance, locale); + const currencyAffix = (currencyCode && currencyCode !== "NOK")? currencyCode : currencyAffixNOK[locale]; + return (locale === 'en')? `${currencyAffix} ${amount}` : `${amount} ${currencyAffix}`; } diff --git a/src/util/types.js b/src/util/types.js index 3a7df4cc91..7d550c0266 100644 --- a/src/util/types.js +++ b/src/util/types.js @@ -4,7 +4,7 @@ export const nb = 'nb'; export const en = 'en'; export const nn = 'nn'; -export const currencyPostfix = { +export const currencyAffixNOK = { [nb]: 'kr', [nn]: 'kr', [en]: 'NOK'