Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/assets/javascripts/discourse/lib/formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,18 @@ relativeAge = function(date, options) {
};

var number = function(val) {
var formattedNumber;

val = parseInt(val, 10);
if (isNaN(val)) val = 0;

if (val > 999999) {
return (val / 1000000).toFixed(1) + "M";
formattedNumber = I18n.toNumber(val / 1000000, {precision: 1});
return I18n.t("number.short.millions", {number: formattedNumber});
}
if (val > 999) {
return (val / 1000).toFixed(1) + "K";
formattedNumber = I18n.toNumber(val / 1000, {precision: 1});
return I18n.t("number.short.thousands", {number: formattedNumber});
}
return val.toString();
};
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.ar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
ar:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -23,6 +26,9 @@ ar:
kb: كيلو بايت
mb: ميجا
tb: تيرا
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "h:mm a"
long_no_year: "MMM D h:mm a"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.bs_BA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
bs_BA:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -16,6 +19,9 @@ bs_BA:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "h:mm a"
long_no_year: "MMM D h:mm a"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
cs:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -20,6 +23,9 @@ cs:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "h:mm a"
long_no_year: "MMM D h:mm a"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.da.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
da:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -19,6 +22,9 @@ da:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "h:mm a"
long_no_year: "MMM D h:mm a"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
de:
js:
number:
format:
separator: ","
delimiter: "."
human:
storage_units:
format: '%n %u'
Expand All @@ -19,6 +22,9 @@ de:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "HH:mm"
long_no_year: "DD. MMM HH:mm"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
en:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -29,6 +32,9 @@ en:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "h:mm a"
long_no_year: "MMM D h:mm a"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
es:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -19,6 +22,9 @@ es:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "h:mm a"
long_no_year: "MMM D h:mm a"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.fa_IR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
fa_IR:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -18,6 +21,9 @@ fa_IR:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "h:mm a"
long_no_year: "MMM D h:mm a"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.fi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
fi:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -19,6 +22,9 @@ fi:
kb: Kt
mb: Mt
tb: Tt
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "H:mm"
long_no_year: "D. MMMM[ta] H:mm"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
fr:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -19,6 +22,9 @@ fr:
kb: Ko
mb: Mo
tb: To
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "H:mm"
long_no_year: "DD MMM H:mm"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.he.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
he:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -19,6 +22,9 @@ he:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "h:mm a"
long_no_year: "MMM D h:mm a"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.id.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
id:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -18,6 +21,9 @@ id:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "j:mm a"
long_no_year: "BBB H j:mm a"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.it.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
it:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -19,6 +22,9 @@ it:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "h:mm a"
long_no_year: "D MMM h:mm a"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
ja:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -18,6 +21,9 @@ ja:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "h:mm a"
long_no_year: "MMM D h:mm a"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.ko.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
ko:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -18,6 +21,9 @@ ko:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "a h:mm"
long_no_year: "MMM D a h:mm "
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.nb_NO.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
nb_NO:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -19,6 +22,9 @@ nb_NO:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "h:mm a"
long_no_year: "D MMM h:mm a"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
nl:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -19,6 +22,9 @@ nl:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "h:mm a"
long_no_year: "MMM D h:mm a"
Expand Down
6 changes: 6 additions & 0 deletions config/locales/client.pl_PL.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
pl_PL:
js:
number:
format:
separator: "."
delimiter: ","
human:
storage_units:
format: '%n %u'
Expand All @@ -20,6 +23,9 @@ pl_PL:
kb: KB
mb: MB
tb: TB
short:
thousands: "{{number}}k"
millions: "{{number}}M"
dates:
time: "H:mm"
long_no_year: "D MMM H:mm"
Expand Down
Loading