Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No plural form for dates with russian translation #8327

Open
1 task done
KarelWintersky opened this issue Sep 30, 2019 · 12 comments
Open
1 task done

No plural form for dates with russian translation #8327

KarelWintersky opened this issue Sep 30, 2019 · 12 comments
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented modifies/translation type/enhancement An improvement of existing functionality

Comments

@KarelWintersky
Copy link

KarelWintersky commented Sep 30, 2019

  • Gitea version (or commit ref): 1.8.3
  • Database (use [x]): any
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)

Description

Problem with plural forms of dates on russian translation:

  • Обновлено 2 дней назад must be "2 дня"

Same:

  • 1 день
  • 2,3,4 дня
  • 5-20 дней
  • 21 день
  • 22, 23, 24 дня
  • 25 дней

i.e. correct code (PHP, sorry):

return
            ($number % 10 == 1 && $number % 100 != 11)
                ? $forms[0]
                : (
            ($number % 10 >= 2 && $number % 10 <= 4 && ($number % 100 < 10 || $number % 100 >= 20))
                ? $forms[1]
                : $forms[2]
            );

and usage: pluralForm(days, [ 'день', 'дня', 'дней' ]) and so on.

Screenshots

https://try.gitea.io/explore/repos?page=2&sort=recentupdate&q=

@KarelWintersky
Copy link
Author

@lunny
Copy link
Member

lunny commented Oct 1, 2019

Please go to https://crowdin.com/project/gitea to correct that.

@KarelWintersky
Copy link
Author

Sounds good, but, how gitea engine uses plural forms?

Sorry, GO is not my favorite language ;)

@guillep2k
Copy link
Member

@KarelWintersky I don't know anything about the Russian language, but currently Gitea handles two cases: 1 day, n days. The first, singular, is the string 1d:

1d=1 день

The second, plural, is days:

days=%d дней

Perhaps дней is the wrong word for days? If that's the case, you should propose a different word in Crowdin. If the problem is different, please elaborate.

Otherwise, can you paste a screen capture showing the wrong string and what it should look like?

@KarelWintersky
Copy link
Author

KarelWintersky commented Oct 2, 2019

дней not a wrong for days generally.

However, the spelling of the word "days" depends on their number:

1 day -- 1 день
2 days -- 2 дня (3, 4)
5 days -- 5 дней (6..20)
21 days -- 21 день
22 days -- 22 дня (23..24)
25 days -- 25 дней (26..30)

Similarly with weeks, months, years.

The plural form changes depending on the numeral.

This packages, I think, can solve problem:

https://github.com/go-playground/universal-translator
https://github.com/go-playground/locales
https://github.com/go-playground/locales/blob/master/ru_RU/ru_RU.go

@guillep2k
Copy link
Member

@lunny This is a complex case that can't be handled by Crowdin; the usual singular/plural duality does not apply to Russian. Perhaps we should re-label this issue? (kind/bug? kind/enhancement?)

@lunny lunny added the type/enhancement An improvement of existing functionality label Nov 2, 2019
@stale
Copy link

stale bot commented Jan 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale stale bot added the issue/stale label Jan 1, 2020
@techknowlogick techknowlogick added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented and removed issue/stale labels Jan 1, 2020
@lunny
Copy link
Member

lunny commented Jan 2, 2020

So we could depend on package https://github.com/go-playground/locales and use %s on these translation strings about days.

@KarelWintersky
Copy link
Author

I don't know GOlang syntax, but... I think, it looks like missed

PluralRuleOne
PluralRuleFew
PluralRuleMany

definitions at https://github.com/go-playground/locales/blob/master/ru_RU/ru_RU.go#L45

@j123b567
Copy link
Contributor

Lot of languages has more complex rules for plural form then English. From supported languages by gitea

Czech, Latvian, Lithuanian, Polish, Russian, Serbian, Ukrainian - have complex rules

French, Persian, Portuguese - are using singular for zero

Other supported languages have same rules as English or have same form for one and many, so they must duplicate the translation.

see https://unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html

So, it should be better to rename this issue to add general support for plural forms of all these languages and incorporate some existing mechanism.

There are many other situations in Gitea, not just dates.
It is really hard to translate e.g. this in all these languages.

repo:pulls.num_conflicting_files_1 = %d conflicting file
repo:pulls.num_conflicting_files_n = %d conflicting files

Translators must chose form which is less wrong, but stil wrong.

@yardenshoham
Copy link
Member

Did #23988 fix this?

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 29, 2023

It needs this (for a complete solution, but not only the date/time)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented modifies/translation type/enhancement An improvement of existing functionality
Projects
None yet
Development

No branches or pull requests

7 participants