Skip to content

Issue with 11..19 and n1 numbers and polish locale #13

Closed
@jcubic

Description

@jcubic

I've created Polish locale (will create PR) but have problems. In polish
"1 month" ago is "1 miesiąc temu"
"%s months ago" is "%s miesięce temu"
but for numbers 11..19, 21 31, ..., 91 is "%s miesięcy temu"

and there is no way to have this locale without modification of the library. Maybe locale be a function that accept number and unit like:

function locale(number, unit) {
   var str = number.toString();
   if (unit == 'hours') {
       if (number == 1) {
          return ['1 godzinę temu', 'za 1 godzinę'];
       } else if (str.length == 2 && str[0] == "1" || number % 10 == 1) {
          return ['%s godzin temu', 'za %s godzin'];
      } else {
        return ['%s godziny temu', 'za %s godziny'];
      }
  }
}

and the code can detect if locale is function or array.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions