No plural form for dates with russian translation #4036

Open
opened 2025-11-02 05:35:09 -06:00 by GiteaMirror · 12 comments
Owner

Originally created by @KarelWintersky on GitHub (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=

Originally created by @KarelWintersky on GitHub (Sep 30, 2019). <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.8.3 - Database (use `[x]`): any - Can you reproduce the bug at https://try.gitea.io: - [x] 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=
GiteaMirror added the issue/confirmedtype/enhancementmodifies/translation labels 2025-11-02 05:35:09 -06:00
Author
Owner

@KarelWintersky commented on GitHub (Sep 30, 2019):

Problem somewhere here: https://github.com/go-gitea/gitea/blob/master/options/locale/locale_ru-RU.ini#L1804

@KarelWintersky commented on GitHub (Sep 30, 2019): Problem somewhere here: https://github.com/go-gitea/gitea/blob/master/options/locale/locale_ru-RU.ini#L1804
Author
Owner

@lunny commented on GitHub (Oct 1, 2019):

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

@lunny commented on GitHub (Oct 1, 2019): Please go to https://crowdin.com/project/gitea to correct that.
Author
Owner

@KarelWintersky commented on GitHub (Oct 1, 2019):

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

Sorry, GO is not my favorite language ;)

@KarelWintersky commented on GitHub (Oct 1, 2019): Sounds good, but, how gitea engine uses plural forms? Sorry, GO is not my favorite language ;)
Author
Owner

@guillep2k commented on GitHub (Oct 2, 2019):

@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:

149758c912/options/locale/locale_ru-RU.ini (L1797)

The second, plural, is days:

149758c912/options/locale/locale_ru-RU.ini (L1804)

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?

@guillep2k commented on GitHub (Oct 2, 2019): @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`: https://github.com/go-gitea/gitea/blob/149758c912842bedda86b5087cffd59ce0682e58/options/locale/locale_ru-RU.ini#L1797 The second, plural, is `days`: https://github.com/go-gitea/gitea/blob/149758c912842bedda86b5087cffd59ce0682e58/options/locale/locale_ru-RU.ini#L1804 Perhaps `дней` is the wrong word for `days`? If that's the case, you should propose a different word in [Crowdin](https://crowdin.com/project/gitea). If the problem is different, please elaborate. Otherwise, can you paste a screen capture showing the wrong string and what it should look like?
Author
Owner

@KarelWintersky commented on GitHub (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

@KarelWintersky commented on GitHub (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
Author
Owner

@guillep2k commented on GitHub (Oct 2, 2019):

@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?)

@guillep2k commented on GitHub (Oct 2, 2019): @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?)
Author
Owner

@stale[bot] commented on GitHub (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[bot] commented on GitHub (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.
Author
Owner

@lunny commented on GitHub (Jan 2, 2020):

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

@lunny commented on GitHub (Jan 2, 2020): So we could depend on package https://github.com/go-playground/locales and use %s on these translation strings about days.
Author
Owner

@KarelWintersky commented on GitHub (Jan 7, 2020):

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

@KarelWintersky commented on GitHub (Jan 7, 2020): 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
Author
Owner

@j123b567 commented on GitHub (Feb 12, 2020):

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.

@j123b567 commented on GitHub (Feb 12, 2020): 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.
Author
Owner

@yardenshoham commented on GitHub (Apr 29, 2023):

Did #23988 fix this?

@yardenshoham commented on GitHub (Apr 29, 2023): Did #23988 fix this?
Author
Owner

@wxiaoguang commented on GitHub (Apr 29, 2023):

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

@wxiaoguang commented on GitHub (Apr 29, 2023): It needs this (for a complete solution, but not only the date/time) * #23863
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4036