# Is there a way to translate numbers e.g. "1.3K" in the "Views" column?

**URL:** <https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374>\
**Category:** Support\
**Created:** [2015年六月23日 13:42 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374 "2015-06-23T13:42:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)\
**Post date:** [2015年六月23日 13:42 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/1 "2015-06-23T13:42:55Z")

</div>

Russian-speaking people simply don’t understand what “1.3K” means - they keep asking our mods about the `K`. Is it possible to make it localized somehow?

---

<div class="post-metadata">

**Author:** ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)\
**Post date:** [2015年六月23日 13:58 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/2 "2015-06-23T13:58:50Z")

</div>

To be fair, the “k” (technically must be lower case, the upper case here on Discourse is a bug) is the international metric prefix for “thousand”.

> **[Metric prefix](https://en.wikipedia.org/wiki/Metric_prefix)**
>
> A metric prefix is a unit prefix that precedes a basic unit of measure to indicate a multiple or submultiple of the unit. All metric prefixes used today are decimal. Each prefix has a unique symbol that is prepended to any unit symbol. The prefix kilo, for example, may be added to gram to indicate multiplication by one thousand: one kilogram is equal to one thousand grams. The prefix milli, likewise, may be added to metre to indicate division by one thousand, so one millimetre is equal to one ...

I would have assumed that the only people to complain would be people from the United States. 😉

---

<div class="post-metadata">

**Author:** ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)\
**Post date:** [2015年六月24日 02:21 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/3 "2015-06-24T02:21:16Z")

</div>

No one of the 120 registered users in our forum is aware of the “K”.

---

<div class="post-metadata">

**Author:** ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)\
**Post date:** [2015年六月24日 03:04 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/4 "2015-06-24T03:04:16Z")

</div>

Does Russia use kilometers..? Sorry, I don’t know and a quick search was not enlightening.

---

<div class="post-metadata">

**Author:** ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)\
**Post date:** [2015年六月24日 03:25 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/5 "2015-06-24T03:25:19Z")

</div>

Both Russian and Ukrainian language do not use K for “thousand”.  
For kilometers, we use “km” (or “км”, a Russian version).

Even though technical people do understand the K, most of regular people don’t.

---

<div class="post-metadata">

**Author:** ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
**Post date:** [2015年六月24日 04:37 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/6 "2015-06-24T04:37:27Z")

</div>

I can’t recall if something like 2236 was ever displayed as 2236 or if it was shortened to make more room back when there were more columns.

Obviously there needs to be a sane limit at some point. IMHO seeing a whole mess of numbers with varying lengths of digits would muddy things up.

> [@meglio](#):
>
> do not use K for “thousand”.

So what do they use for the abbreviation of thousand?

---

<div class="post-metadata">

**Author:** ![downey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/downey/32/166878_2.png) [@downey](https://meta.discourse.org/u/downey)\
**Post date:** [2015年六月24日 06:22 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/7 "2015-06-24T06:22:53Z")

</div>

> [@meglio](#):
>
> For kilometers, we use “km” (or “км”, a Russian version).

thousand meters = kilo meters = km 🙂

---

<div class="post-metadata">

**Author:** ![fantasticfears](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fantasticfears/32/119608_2.png) [@fantasticfears](https://meta.discourse.org/u/fantasticfears)\
**Post date:** [2015年六月24日 06:34 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/8 "2015-06-24T06:34:33Z")

</div>

Though it’s a standard and Chinese users are used to kilo\*\*, it’s still a demand ask about that kind of features to translate it.

---

<div class="post-metadata">

**Author:** ![AmiAthena](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/amiathena/32/116030_2.png) [@AmiAthena](https://meta.discourse.org/u/AmiAthena)\
**Post date:** [2015年六月24日 08:49 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/9 "2015-06-24T08:49:30Z")

</div>

I have no idea if this symbol is actually used that way, but this is apparently a Cyrillic symbol for 1000: ҂

---

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [2015年六月24日 09:11 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/10 "2015-06-24T09:11:44Z")

</div>

The code that formats those numbers is here:  
[https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/lib/formatter.js#L260-L271](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/lib/formatter.js#L260-L271)

How would you format large numbers (thousands and millions) in your language without using too much space?

---

<div class="post-metadata">

**Author:** ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)\
**Post date:** [2015年六月25日 03:36 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/11 "2015-06-25T03:36:38Z")

</div>

> [@Mittineague](#):
>
> So what do they use for the abbreviation of thousand?

The standard says to use this: `тыс.`

`1,4тыс.`

Also, number formatting in Russian would be different as well (the same as in Ukrainian) - it would use a comma “,” instead of a dot “.” for thousand separator:

`1,4тыс.` - correct  
`1.4тыс.` - incorrect

---

<div class="post-metadata">

**Author:** ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)\
**Post date:** [2015年六月25日 03:41 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/12 "2015-06-25T03:41:57Z")

</div>

> [@Mittineague](#):
>
> Obviously there needs to be a sane limit at some point. IMHO seeing a whole mess of numbers with varying lengths of digits would muddy things up.

Correct. So I’m not proposing to cancel the shortening, but rather localizing it.

> [@downey](#):
>
> thousand meters = kilo meters = km

Yeap, that’s how it works.

> [@AmiAthena](#):
>
> I have no idea if this symbol is actually used that way, but this is apparently a Cyrillic symbol for 1000: ҂

No, it’s never used. The standard way, as mentioned above, is to use “тыс.”.

> [@gerhard](#):
>
> The code that formats those numbers is here:

Yeah, so as a translation contributor I’d like this to be internationalized.

> [@gerhard](#):
>
> How would you format large numbers (thousands and millions) in your language without using too much space?

`1,4тыс.` (with dot) for 1,400  
`2,5млн` (without dot) for 2,500,000

So I think it’s just matter of making it localizable, then we enter correct variations in Transifex.

Also, I remember Discourse using some library for numbers internationalization. I believe it solves this issue, but just hasn’t been used in this particular case.

P.S. For Russian-speaking people, here is an article with comprehensive info regarding short number notations: [http://habrahabr.ru/post/24544/](http://habrahabr.ru/post/24544/)

---

<div class="post-metadata">

**Author:** ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
**Post date:** [2015年六月25日 03:58 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/13 "2015-06-25T03:58:53Z")

</div>

Thanks, being an American I forgot about the comma vs period difference.

I was hoping the symbols came from a yml file, but unfortunately it seems, as gerhard has posted, they come from a hard-coded formatter.js file.

I don’t know which would be more work, l10n-ing it or over-riding the numbers function and tossing in a number.toLocaleString() - but it seems it should be possible to do somehow if it’s a big enough of a problem.

---

<div class="post-metadata">

**Author:** ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)\
**Post date:** [2015年六月25日 08:11 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/14 "2015-06-25T08:11:27Z")

</div>

But anyway I think it should be done on a project-level, not on a single installed instance level.

---

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [2015年六月25日 08:27 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/15 "2015-06-25T08:27:31Z")

</div>

> [@meglio](#):
>
> 1,4тыс. (with dot) for 1,400  
> 2,5млн (without dot) for 2,500,000
> 
> So I think it’s just matter of making it localizable, then we enter correct variations in Transifex.

I can create a PR to make the “k” and “M” localizable, but formatting numbers with the correct decimal and thousands separators is [another issue](https://meta.discourse.org/t/format-numbers-depending-on-selected-locale/30418). AFAIK there’s currently no library in Discourse that allows I18n for numbers.

---

<div class="post-metadata">

**Author:** ![mik01aj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mik01aj/32/116019_2.png) [@mik01aj](https://meta.discourse.org/u/mik01aj)\
**Post date:** [2015年六月25日 08:59 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/16 "2015-06-25T08:59:50Z")

</div>

> [@AmiAthena](#):
>
> this is apparently a Cyrillic symbol for 1000: ҂

[This one comes from Church Slavonic](https://en.wikipedia.org/wiki/Cyrillic_numerals), and it won’t be understood by anyone that doesn’t work with old manuscripts. 🙂

> [@meglio](#):
>
> 1,4тыс. (with dot) for 1,400  
> 2,5млн (without dot) for 2,500,000

+1 for this one. I think Polish would need this as well (“tys.” and “mln”, accordingly). I guess that other languages too.

---

<div class="post-metadata">

**Author:** ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)\
**Post date:** [2015年六月25日 10:11 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/17 "2015-06-25T10:11:40Z")

</div>

> [@gerhard](#):
>
> I can create a PR to make the “k” and “M” localizable

Very much appreciated, please do!

Just make sure that it’s not only “k” and “M” that’s localizable, but rather the whole strings, e.g.:

```
{{number}}K
{{number}}M

```

- this way I think it will be more flexible. For example, in some langauges a semi-space is compulsory after the number and before the letter.

---

<div class="post-metadata">

**Author:** ![naveedahmada036](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/naveedahmada036/32/122417_2.png) [@naveedahmada036](https://meta.discourse.org/u/naveedahmada036)\
**Post date:** [2015年六月25日 15:04 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/18 "2015-06-25T15:04:18Z")

</div>

Title showing actual number would also be great.

```
<span title="1345 views">1.3k</span>

```

---

<div class="post-metadata">

**Author:** ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
**Post date:** [2015年六月25日 15:18 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/19 "2015-06-25T15:18:12Z")

</div>

> [@gerhard](#):
>
> AFAIK there’s currently no library in Discourse that allows I18n for numbers.

The closest thing I could find (not that I looked very long or very deeply) that could do this is the JavaScript  
`number.toLocaleString` function.

> **[Number.prototype.toLocaleString() - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString)**
>
> The toLocaleString() method of Number values returns a string with a language-sensitive representation of this number. In implementations with Intl.NumberFormat API support, this method delegates to Intl.NumberFormat.

Sorry, but I have no idea at the moment (I need some ☕) how to work that into Discourse

---

<div class="post-metadata">

**Author:** ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
**Post date:** [2015年六月25日 21:41 UTC](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374/20 "2015-06-25T21:41:41Z")

</div>

It does that already or am I missing something?  
 ![](https://global.discourse-cdn.com/meta/original/3X/d/e/dec56d95c0d9439673e15eb04c4c2edbf432cec1.png)

I submitted a PR that should make those numbers localizable:  
[https://github.com/discourse/discourse/pull/3569](https://github.com/discourse/discourse/pull/3569)

[下一頁](https://meta.discourse.org/t/is-there-a-way-to-translate-numbers-e-g-1-3k-in-the-views-column/30374.md?page=2)
