diff --git a/src/js/core/utils.js b/src/js/core/utils.js index 8f5a1dc6..a5319245 100644 --- a/src/js/core/utils.js +++ b/src/js/core/utils.js @@ -413,10 +413,10 @@ function roundSmart(n) { /** * Formats a big number * @param {number} num - * @param {string=} divider THe divider for numbers like 50,000 (divider=',') + * @param {string=} separator The decimal separator for numbers like 50.1 (divider='.') * @returns {string} */ -export function formatBigNumber(num, divider = ".") { +export function formatBigNumber(num, separator = T.global.decimalSeparator) { const sign = num < 0 ? "-" : ""; num = Math.abs(num); @@ -445,7 +445,7 @@ export function formatBigNumber(num, divider = ".") { } } const leadingDigitsRounded = round1Digit(leadingDigits); - const leadingDigitsNoTrailingDecimal = leadingDigitsRounded.toString().replace(".0", ""); + const leadingDigitsNoTrailingDecimal = leadingDigitsRounded.toString().replace(".0", "").replace(".", separator); return sign + leadingDigitsNoTrailingDecimal + suffix; } } @@ -453,7 +453,7 @@ export function formatBigNumber(num, divider = ".") { /** * Formats a big number, but does not add any suffix and instead uses its full representation * @param {number} num - * @param {string=} divider THe divider for numbers like 50,000 (divider=',') + * @param {string=} divider The divider for numbers like 50,000 (divider=',') * @returns {string} */ export function formatBigNumberFull(num, divider = T.global.thousandsDivider) { @@ -954,10 +954,11 @@ export function capitalizeFirstLetter(str) { * Formats a number like 2.5 to "2.5 items / s" * @param {number} speed * @param {boolean=} double + * @param {string=} separator The decimal separator for numbers like 50.1 (divider='.') */ -export function formatItemsPerSecond(speed, double = false) { +export function formatItemsPerSecond(speed, double = false, separator = T.global.decimalSeparator) { return speed === 1.0 ? T.ingame.buildingPlacement.infoTexts.oneItemPerSecond - : T.ingame.buildingPlacement.infoTexts.itemsPerSecond.replace("", "" + round2Digits(speed)) + + : T.ingame.buildingPlacement.infoTexts.itemsPerSecond.replace("", "" + round2Digits(speed)).replace(".", separator) + (double ? " " + T.ingame.buildingPlacement.infoTexts.itemsPerSecondDouble : ""); } diff --git a/translations/base-ar.yaml b/translations/base-ar.yaml index 0d31ee22..c42d5e0d 100644 --- a/translations/base-ar.yaml +++ b/translations/base-ar.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-cat.yaml b/translations/base-cat.yaml index da1e9085..1abab2ca 100644 --- a/translations/base-cat.yaml +++ b/translations/base-cat.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-cz.yaml b/translations/base-cz.yaml index 14c8d192..e722a7ee 100644 --- a/translations/base-cz.yaml +++ b/translations/base-cz.yaml @@ -72,6 +72,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: " " + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-da.yaml b/translations/base-da.yaml index f5ff3fcd..a87f7587 100644 --- a/translations/base-da.yaml +++ b/translations/base-da.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-de.yaml b/translations/base-de.yaml index fe745046..eac6ae23 100644 --- a/translations/base-de.yaml +++ b/translations/base-de.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "." + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "," + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-el.yaml b/translations/base-el.yaml index ac0baf89..90430f6a 100644 --- a/translations/base-el.yaml +++ b/translations/base-el.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-en.yaml b/translations/base-en.yaml index 90421a8c..3fcf67fc 100644 --- a/translations/base-en.yaml +++ b/translations/base-en.yaml @@ -92,6 +92,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-es.yaml b/translations/base-es.yaml index 436bf750..80e13517 100644 --- a/translations/base-es.yaml +++ b/translations/base-es.yaml @@ -92,6 +92,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "." + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "," + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k @@ -599,8 +602,7 @@ storyRewards: reward_splitter_compact: title: Balanceador compacto - desc: >- - Has desbloqueado una variante compacta del balanceador - ¡Acepta dos entradas y las junta en una salida! + desc: Has desbloqueado una variante compacta del balanceador - ¡Acepta dos entradas y las junta en una salida! reward_cutter_quad: title: Cortador cuádruple diff --git a/translations/base-fi.yaml b/translations/base-fi.yaml index 892ee7ae..2a2c83af 100644 --- a/translations/base-fi.yaml +++ b/translations/base-fi.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-fr.yaml b/translations/base-fr.yaml index 181b5003..689b6df9 100644 --- a/translations/base-fr.yaml +++ b/translations/base-fr.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "." + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "," + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. cf wikipedia système international d'unité # For french: https://fr.wikipedia.org/wiki/Pr%C3%A9fixes_du_Syst%C3%A8me_international_d%27unit%C3%A9s suffix: diff --git a/translations/base-hr.yaml b/translations/base-hr.yaml index 01d43304..d5858cb1 100644 --- a/translations/base-hr.yaml +++ b/translations/base-hr.yaml @@ -120,6 +120,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: " " + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-hu.yaml b/translations/base-hu.yaml index 798cff44..ebdf03af 100644 --- a/translations/base-hu.yaml +++ b/translations/base-hu.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: E diff --git a/translations/base-it.yaml b/translations/base-it.yaml index a9e88aa4..8583a102 100644 --- a/translations/base-it.yaml +++ b/translations/base-it.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-ja.yaml b/translations/base-ja.yaml index f9f37b64..9d187de9 100644 --- a/translations/base-ja.yaml +++ b/translations/base-ja.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-kor.yaml b/translations/base-kor.yaml index 6e6c58d6..1f256dc7 100644 --- a/translations/base-kor.yaml +++ b/translations/base-kor.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-lt.yaml b/translations/base-lt.yaml index 81d23e95..134105ff 100644 --- a/translations/base-lt.yaml +++ b/translations/base-lt.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-nl.yaml b/translations/base-nl.yaml index 0626033a..229befe4 100644 --- a/translations/base-nl.yaml +++ b/translations/base-nl.yaml @@ -90,6 +90,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "." + + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "," # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: diff --git a/translations/base-no.yaml b/translations/base-no.yaml index ab8769d5..ae49885e 100644 --- a/translations/base-no.yaml +++ b/translations/base-no.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-pl.yaml b/translations/base-pl.yaml index f60fede8..c4223a4c 100644 --- a/translations/base-pl.yaml +++ b/translations/base-pl.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: " " + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. # Translator note: We don't use SI size units for common speak, but if you want to keep it SI # ...also, Polish has wierd nature of diffrent number naming, we have "million" and "milliard"-thing wich actually is billion in English diff --git a/translations/base-pt-BR.yaml b/translations/base-pt-BR.yaml index b4ce97a4..5f7a8948 100644 --- a/translations/base-pt-BR.yaml +++ b/translations/base-pt-BR.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "." + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "," + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: K diff --git a/translations/base-pt-PT.yaml b/translations/base-pt-PT.yaml index f952bcf0..b04c2c90 100644 --- a/translations/base-pt-PT.yaml +++ b/translations/base-pt-PT.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-ro.yaml b/translations/base-ro.yaml index 9986f8d6..d7b7a8fc 100644 --- a/translations/base-ro.yaml +++ b/translations/base-ro.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-ru.yaml b/translations/base-ru.yaml index 102ccdd8..9166fed8 100644 --- a/translations/base-ru.yaml +++ b/translations/base-ru.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-sl.yaml b/translations/base-sl.yaml index 6d3b6fee..d65ee79b 100644 --- a/translations/base-sl.yaml +++ b/translations/base-sl.yaml @@ -92,6 +92,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-sv.yaml b/translations/base-sv.yaml index 442ada69..69d6a1a0 100644 --- a/translations/base-sv.yaml +++ b/translations/base-sv.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "." + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "," + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-tr.yaml b/translations/base-tr.yaml index c4a6dbbc..ea7e3eda 100644 --- a/translations/base-tr.yaml +++ b/translations/base-tr.yaml @@ -91,6 +91,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: b diff --git a/translations/base-uk.yaml b/translations/base-uk.yaml index a2658070..9d02bc0c 100644 --- a/translations/base-uk.yaml +++ b/translations/base-uk.yaml @@ -92,6 +92,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "," + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: k diff --git a/translations/base-zh-CN.yaml b/translations/base-zh-CN.yaml index 989751f1..e99d1132 100644 --- a/translations/base-zh-CN.yaml +++ b/translations/base-zh-CN.yaml @@ -119,6 +119,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: "" + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # TODO: Chinese translation: suffix changes every 10000 in Chinese numbering system. # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: diff --git a/translations/base-zh-TW.yaml b/translations/base-zh-TW.yaml index eb8181bf..f3437e77 100644 --- a/translations/base-zh-TW.yaml +++ b/translations/base-zh-TW.yaml @@ -118,6 +118,9 @@ global: # How big numbers are rendered, e.g. "10,000" thousandsDivider: " " + # What symbol to use to seperate the integer part from the fractional part of a number, e.g. "0.4" + decimalSeparator: "." + # The suffix for large numbers, e.g. 1.3k, 400.2M, etc. suffix: thousands: 千