mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
decimal separator
This commit is contained in:
parent
10d82a72fb
commit
0caaa055aa
@ -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("<x>", "" + round2Digits(speed)) +
|
||||
: T.ingame.buildingPlacement.infoTexts.itemsPerSecond.replace("<x>", "" + round2Digits(speed)).replace(".", separator) +
|
||||
(double ? " " + T.ingame.buildingPlacement.infoTexts.itemsPerSecondDouble : "");
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 <strong>balanceador</strong> - ¡Acepta dos entradas y las junta en una salida!
|
||||
desc: Has desbloqueado una variante compacta del <strong>balanceador</strong> - ¡Acepta dos entradas y las junta en una salida!
|
||||
|
||||
reward_cutter_quad:
|
||||
title: Cortador cuádruple
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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: 千
|
||||
|
Loading…
Reference in New Issue
Block a user