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

Add support for ru_RU #68

Closed
fabienwarniez opened this issue Feb 26, 2016 · 11 comments · Fixed by #112
Closed

Add support for ru_RU #68

fabienwarniez opened this issue Feb 26, 2016 · 11 comments · Fixed by #112
Labels

Comments

@fabienwarniez
Copy link

I want to use this bundle for my project, but I need support for Russian.

I am currently investigating adding support for that locale.

Is anyone else interested in helping?

@fightbulc
Copy link
Owner

Hey Fabien,

thanks for taking the initiative. It should be possible to use momentjs's locale file:
https://github.com/moment/moment/blob/develop/locale/ru.js

Time wise is tough for me at the moment. Maybe I find an hour over the weekend but not so sure about it.

Maybe somebody else got an hour?

@fightbulc
Copy link
Owner

also, there was already once the try: #56

@fabienwarniez
Copy link
Author

Hi Tino,

It is unfortunately not as simple as creating another locale file, as Russian is more complex than most locales. The core code will have to be updated to support accusative / nominative.

As mentioned, someone else started adding support for Russian, maybe you could create a Russian branch and accept partial PRs so that we can collaboratively add support?

@fightbulc
Copy link
Owner

Hey Fabien. @wormen added the Russian locale. Not quite sure if all works out but its a start. Any possibility for you to have a look?

The pull: #70

@lukas-pierce
Copy link

in Russian language for plural forms use 3 different endings
Examples:
days - 1 день, 4 дня, 5 дней
hours - 1 час, 4 часа, 5 часов

/**
 * returns ending for plural form of word by number and array of variants (1, 4, 5)
 * example variants for apples ['яблоко', 'яблока', 'яблок']
 */
function getNumEnding($number, $endingArray) {
  $number = $number % 100;
  if ($number >= 11 && $number <= 19) {
    $ending = $endingArray[2];
  } else {
    $i = $number % 10;
    switch ($i) {
      case (1):
        $ending = $endingArray[0];
        break;
      case (2):
      case (3):
      case (4):
        $ending = $endingArray[1];
        break;
      default:
        $ending = $endingArray[2];
    }
  }
  return $ending;
}

and for ru_RU.php

"relativeTime" => array(
  //...
  "dd" => function ($number) {
    // return "%d дней"; - not correct
    return getNumEnding($number, array("%d день", "%d дня", "%d дней"));
  },
  //...
),

@fightbulc
Copy link
Owner

Thanks @kosha-industry. Implemented the fix in the last release: 28c3765

@lukas-pierce
Copy link

lukas-pierce commented Jun 8, 2016

@fightbulc Nice job, but add for others:

mm: ['%d минуту', '%d минуты', '%d минут']
hh: ['%d час', '%d часа', '%d часов']
MM: ['%d месяц', '%d месяца', '%d месяцев']
yy: ['%d год', '%d года', '%d лет']

@fightbulc
Copy link
Owner

up and live

@astax-t
Copy link

astax-t commented Dec 5, 2016

Ordinal suffixes are still not exactly correct. For the format "jS F Y", which produces "5th December 2016" in English, Russian gives "5ый декабря 2016". "5ый" uses masculine suffix "ый", while months names in Russian have neuter grammatical gender and all numbers should use the same suffux "е" - such as "1е декабря", "5е декабря", "12е июля".

@fightbulc
Copy link
Owner

@astax-t would be great if you could improve it

@dypa
Copy link
Contributor

dypa commented Jul 21, 2017

would be great if you could improve it

@fabienwarniez fixed in #112

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants