go-playground / locales

:earth_americas: a set of locales generated from the CLDR Project which can be used independently or within an i18n package; these were built for use with, but not exclusive to https://github.com/go-playground/universal-translator
MIT License
270 stars 57 forks source link

Tests for ru_RU #3

Closed nikolay-turpitko closed 7 years ago

nikolay-turpitko commented 7 years ago

Hi! I've tried to supply tests for Russian, there are some issues, though.

Frankly, I am not sure in ordinal/cardinal rules. Table http://www.unicode.org/cldr/charts/29/supplemental/language_plural_rules.html seems OK, but tests, I created, fails. Not sure, that I got it right.

Date formats: there should be space between year number and abbreviation and there should be no quotation marks.

Currency formats: fails due of unnecessary extra space after currency name.

Format with percents: traditionally, we do not insert space between number and percent sign. Wikipedia says, that such a standard was issued in 80th, but it was not largely spread. Most books, banking and accounting software, even government web sites do not use space between number and percent sign. See https://ru.wikipedia.org/wiki/%D0%92%D0%B8%D0%BA%D0%B8%D0%BF%D0%B5%D0%B4%D0%B8%D1%8F:%D0%9E%D1%82%D0%B1%D0%B8%D0%B2%D0%BA%D0%B0_%D0%B7%D0%BD%D0%B0%D0%BA%D0%B0_%D0%BF%D1%80%D0%BE%D1%86%D0%B5%D0%BD%D1%82%D0%B0_%D0%BE%D1%82_%D0%BF%D1%80%D0%B5%D0%B4%D1%88%D0%B5%D1%81%D1%82%D0%B2%D1%83%D1%8E%D1%89%D0%B5%D0%B9_%D1%86%D0%B8%D1%84%D1%80%D1%8B.

nikolay-turpitko commented 7 years ago
--- FAIL: TestCardinalPlurals (0.00s)
    ru_RU_test.go:268: Expected 'Few' Got 'Other'
    ru_RU_test.go:268: Expected 'Few' Got 'Other'
    ru_RU_test.go:268: Expected 'Few' Got 'Other'
    ru_RU_test.go:268: Expected 'Few' Got 'Other'
--- FAIL: TestFmtDateFull (0.00s)
    ru_RU_test.go:844: Expected 'среда, 3 февраля 2016 г.' Got 'среда, 3 февраля 2016'г'.'
--- FAIL: TestFmtDateLong (0.00s)
    ru_RU_test.go:866: Expected '3 февраля 2016 г.' Got '3 февраля 2016'г'.'
--- FAIL: TestFmtDateMedium (0.00s)
    ru_RU_test.go:888: Expected '3 февр. 2016 г.' Got '3 февр. 2016'г'.'
--- FAIL: TestFmtCurrency (0.00s)
    ru_RU_test.go:1047: Expected '1 123 456,56 USD' Got '1 123 456,56 USD '
    ru_RU_test.go:1047: Expected '1 123 456,60 USD' Got '1 123 456,60 USD '
    ru_RU_test.go:1047: Expected '221 123 456,564 USD' Got '221 123 456,564 USD '
    ru_RU_test.go:1047: Expected '-221 123 456,564 USD' Got '-221 123 456,564 USD '
    ru_RU_test.go:1047: Expected '-221 123 456,564 CAD' Got '-221 123 456,564 CAD '
    ru_RU_test.go:1047: Expected '0,00 USD' Got '0,00 USD '
    ru_RU_test.go:1047: Expected '0,00 USD' Got '0,00 USD '
    ru_RU_test.go:1047: Expected '0,00 CAD' Got '0,00 CAD '
    ru_RU_test.go:1047: Expected '1,00 USD' Got '1,00 USD '
--- FAIL: TestFmtAccounting (0.00s)
    ru_RU_test.go:1115: Expected '1 123 456,56 USD' Got '1 123 456,56 USD '
    ru_RU_test.go:1115: Expected '1 123 456,60 USD' Got '1 123 456,60 USD '
    ru_RU_test.go:1115: Expected '221 123 456,564 USD' Got '221 123 456,564 USD '
    ru_RU_test.go:1115: Expected '-221 123 456,564 USD' Got '-221 123 456,564 USD '
    ru_RU_test.go:1115: Expected '-221 123 456,564 CAD' Got '-221 123 456,564 CAD '
    ru_RU_test.go:1115: Expected '0,00 USD' Got '0,00 USD '
    ru_RU_test.go:1115: Expected '0,00 CAD' Got '0,00 CAD '
    ru_RU_test.go:1115: Expected '1,00 USD' Got '1,00 USD '
--- FAIL: TestFmtPercent (0.00s)
    ru_RU_test.go:1159: Expected '15%' Got '15 %'
    ru_RU_test.go:1159: Expected '15,00%' Got '15,00 %'
    ru_RU_test.go:1159: Expected '434%' Got '434 %'
    ru_RU_test.go:1159: Expected '34,40%' Got '34,40 %'
    ru_RU_test.go:1159: Expected '-34%' Got '-34 %'
FAIL
exit status 1
FAIL    github.com/go-playground/locales/ru_RU  0.004s
deankarn commented 7 years ago

Thanks @nikolay-turpitko 👍 I will definitely look into the space between the number and percent sign, hopefully I can lean on you for any other information as I correct this :smile:

Some of the plural rules might be the CLDR rules being incorrect or incomplete, or I may have a bug in my generation code.

I'm out of town for a couple days and will take a look when I get back.

deankarn commented 7 years ago

Hey @nikolay-turpitko

I'm nearly done fixing these few issues, just had a couple of questions just to confirm:

for percents the CLDR percent format is showing #,##0 % but tests assume #,##0%, just to confirm, should there be a space?

P.S. I have pulled your changes locally onto my PC and will merge them into master then push, so don't be alarmed if when complete I close instead of merging; your contributions will be preserved.

nikolay-turpitko commented 7 years ago

@joeybloggs

Dean, I cannot say for all Russians, but percent format without space seems more natural for me. As I said earlier, wiki article mentions some industrial standard for this format, it actually contains space between number and percent sign. But it seems, that nobody actually adopted this standard, not even government or scientific periodic. Personally I am might not be that credible in the matter, though I learned in Russian school and university and had several engineering jobs. But I've never thought about this little formatting thing, reading the books or articles. So, I may be wrong at my feeling. But I tried to investigate this issue with Goggle, and it seems for me, that format without space is more popular. So, I'm afraid, this is all you going to have about this issue. This is not a yes/no question, but fuzzy one, related to personal preference.

May be, as with other preference issues, it's worth to have a flag in the library settings? Or, better, a way to supply custom formatting strings for locale? For example, some kind of locale object builder. I'm only speculating here, Java or ICU has huge libs and it's for sure a tremendous and time-consuming task to get all this little things configurable...

For example (https://docs.oracle.com/javase/tutorial/i18n/format/decimalFormat.html) Java has a setting to customize decimal delimiter. Cannot find a way to customize a space in percent format in Java, though.

BTW, decimal delimiter is another similar issue. Though it's accustomed that Russians should use comma as a decimal delimiter, but many of us have to fight with software to use dot instead. Again, my personal preference is a dot and I always change settings of OS to make it default. But here I am sure that comma is a standard. Funny, that when I worked on banking project, they explicitly asked us to print all reports for government regulators with dot delimiter...

Speaking of Java and percent format, I created a simple gist: https://gist.github.com/anonymous/d22e9c08de7dc2c9297323895f8b1dc0, it can be executed with https://www.compilejava.net/. And it prints "75% ru_RU" - without space.

deankarn commented 7 years ago

@nikolay-turpitko

Will keep the no space percent, see issue #4 I touch on the rest and thanks again.