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

Fix pl translation #1027

Merged
merged 2 commits into from
Mar 18, 2018
Merged

Fix pl translation #1027

merged 2 commits into from
Mar 18, 2018

Conversation

skotniczny
Copy link
Contributor

pl.ini breaks selfoss 2.18.

This pull request solves it. Translation also follows polish grammar rules, which was impossible before.

lang_hours={0,plural,one {godzinę},two {# godziny},other {# godzin}} temu
lang_minutes={0,plural,one {minutę},two {# minuty},other {# minut}} temu
lang_seconds={0,plural,one {sekundę},two {# sekundy},other {# sekund}} temu
lang_hours=przed {0,plural,one {godziną},other {# godzinami}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume this is done to fix the incorrect “4 godzin temu”. Would you more expressive language files with CLDR rules support ({0,plural,one {godzinę},many {# godziny},other {# godzin}} temu) be better or does this “przed 2 godzinami” sound good enough? It is something I want to do anyway, the current system is terrible, but I can prioritize it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, selfoss 2.18 with pl language gives error TypeError: pluralValue is undefined or Uncaught TypeError: Cannot read property 'replace' of undefined; there is no two case.

And yes, it fixes incorrect "3 godzin", "4 godzin", "23 minut", "24 minut", "33 sekund", …

Would you more expressive language files with CLDR rules support ({0,plural,one {godzinę},many {# godziny},other {# godzin}} temu) be better or does this “przed 2 godzinami” sound good enough?

Yes, indeed. This case is not worth the effort, "przed 2 godzinami" probably sounds as good as "před 2 hodinami". :)

There is example how correct sentence with … temu should look:

function format(num, unit) {
  let n1 = num % 10;
  let n2 = num % 100;
  let dictionary = {
    "sekundy": ["sekundę", "sekundy", "sekund"],
    "minuty": ["minutę", "minuty", "minut"],
    "godziny": ["godzinę", "godziny", "godzin"]
  };
  unit = dictionary[unit];
  if (n2 > 4 && n2 < 22) {
      return `${num} ${unit[2]} temu`;
  }
  if (n1 > 1 && n1 <= 4) {
      return `${num} ${unit[1]} temu'`;
  }
  if (num == 1) {
      return `${unit[0]} temu`; // number omitted intentionally
  }
  return `${num} ${unit[2]} temu`;
}

for (let i = 0; i <= 60; i++) {
  console.log(format(i, "sekundy"));
  console.log(format(i, "minuty"));
  console.log(format(i, "godziny"), "\n");
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, we already have a client side implementation of pluralization rules, I agree that the effort is too high. I will add the CLDR support once we move everything to the client side.

@jtojnar jtojnar merged commit fdb6efd into fossar:master Mar 18, 2018
@jtojnar
Copy link
Member

jtojnar commented Mar 18, 2018

Thanks.

@jtojnar
Copy link
Member

jtojnar commented Nov 7, 2020

Hi @skotniczny. Previously, it was not clear if selfoss was licensed under GPL 3 only, or also any later version. Could you clarify whether you are fine with licensing your contributions under GPL-3-or-later?

Thanks again and sorry for the confusion.

@skotniczny
Copy link
Contributor Author

I'm fine with that.

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

Successfully merging this pull request may close these issues.

2 participants