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

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?

2 Likes

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”.

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

1 Like

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

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

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.

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.

So what do they use for the abbreviation of thousand?

thousand meters = kilo meters = km :slight_smile:

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.

1 Like

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

The code that formats those numbers is here:
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?

4 Likes

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

1 Like

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

Yeap, that’s how it works.

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

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

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/

4 Likes

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.

3 Likes

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

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. AFAIK there’s currently no library in Discourse that allows I18n for numbers.

This one comes from Church Slavonic, and it won’t be understood by anyone that doesn’t work with old manuscripts. :slight_smile:

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

2 Likes

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.

Title showing actual number would also be great.

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

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.

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

1 Like

It does that already or am I missing something?

I submitted a PR that should make those numbers localizable:

3 Likes