hydralauncher / hydra

Hydra is a game launcher with its own embedded bittorrent client and a self-managed repack scraper.
MIT License
9.49k stars 1.76k forks source link

Update i18n so it works for RU/UA plurals #282

Open squidsdev opened 1 month ago

squidsdev commented 1 month ago

Describe the bug Due to the peculiarities of the programme, it is not possible to declare localization for some plural words correctly. While in English it is easy, you just have to add "s" at the end if the word is plural, in Russian and Ukrainian it is difficult.

To Reproduce Steps to reproduce the behavior:

  1. Open Launcher
  2. Go to downloads tab
  3. Find the game with two or more download options

Expected behavior Let us take the example of "download_options_other". ("{{count}} download options")

If a number ends in 1 but not 11, the form "вариант" is used: 21 вариант, 31 вариант, 101 вариант.

If a number ends in 2, 3, or 4 but not in 12, 13, or 14, the "варианта" form is used: 2 варианта, 3 варианта, 3 варианта, 4 варианта, 22 варианта, 23 варианта, 24 варианта.

For all other numbers, including all numbers ending in 5-9, 0, and numbers ending in 11-14, the "вариантов" form is used: 5 вариантов, 6 вариантов, 7 вариантов, 8 вариантов, 9 вариантов, 10 вариантов, 11 вариантов, 12 вариантов, 13 вариантов, 14 вариантов.

Screenshots image

Additional context

xxDRV commented 1 month ago

+1 There should be third locale line in UA/RU/BE

Example locale lines to use in CIS languages: RU: "download_options_one": "{{count}} вариант загрузки", "download_options_other": "{{count}} вариантов загрузки", "download_options_cisother": "{{count}} варианта загрузки", UA: "download_options_one": "{{count}} варіант завантаження", "download_options_other": "{{count}} варіантів завантаження", "download_options_cisother": "{{count}} варіанти завантаження", BE: "download_options_one": "{{count}} варыянт сьцягваньня", "download_options_other": "{{count}} варыянтаў сьцягваньня", "download_options_cisother": "{{count}} варыянты сьцягваньня",

"download_options_cisother" line may also exist in other locales and stay the same as "download_options_other" if there's no need to change it

The same line needs to be added to: "repack_count_one": "{{count}}", "repack_count_other": "{{count}}"

zamitto commented 1 month ago

I added this issue to the roadmap. The main collaborators are not so free right now, so feel free to work on it if you can.

Documentation about the library used for i18n on the project: https://www.i18next.com/translation-function/plurals

piradata commented 1 month ago

https://www.i18next.com/translation-function/plurals#interval-plurals could work fine, but it is a lot of intervals.

Image

BTW, interesting to know there are these intrincacies in RU/UK tho, remembered me about how frech counts from 60 to 99 heheh https://www.lawlessfrench.com/vocabulary/numbers-and-counting-2/