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: Plural support for Romanian translations #8936

Merged
merged 3 commits into from Apr 10, 2021
Merged

Conversation

@kneekoo
Copy link
Contributor

@kneekoo kneekoo commented Apr 3, 2021

Description

This PR adds plural support for Romanian translations.

Details

The second plural form always - without exception - has the preposition "de". Examples:

0 beers = 0 beri
1 beer = 1 bere
20 beers = 20 de beri
99 beers = 99 de beri
420 beers = 420 de beri

This can be formatted as: {P bere beri "de beri"}

Is there a better way to format these plurals?

@kneekoo kneekoo changed the title Add Romanian plural support Add: Romanian plural support Apr 3, 2021
@kneekoo kneekoo changed the title Add: Romanian plural support Add: Plural support for Romanian translations Apr 3, 2021
* Used in:
* Romanian */
case 14:
return n == 1 ? 0 : (n == 0 || (n % 100 > 0 && n % 100 < 20)) ? 1 : 2;
Copy link
Contributor

@glx22 glx22 Apr 3, 2021

Choose a reason for hiding this comment

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

Doesn't seem to match the comment.
3 cases, as I read the code, are

  • 1
  • 0, *1-*19 but not 1
  • everything else

Copy link
Contributor Author

@kneekoo kneekoo Apr 3, 2021

Choose a reason for hiding this comment

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

My comment doesn't include the first plural (for non-zero numbers), but everything checks out - the code is used in gettext and it's correct.

First plural form:

7 beers = 7 beri
314 beers = 314 beri

Copy link
Contributor Author

@kneekoo kneekoo Apr 3, 2021

Choose a reason for hiding this comment

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

Wait, there are three noun forms, not three plural forms. First, there's the singular form, then two plural forms.

Copy link
Member

@frosch123 frosch123 Apr 4, 2021

Choose a reason for hiding this comment

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

The code matches http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html?id=l10n/pluralforms#l
But the comment is off. Only "0" is special, not numbers ending in "00".

Copy link
Contributor Author

@kneekoo kneekoo Apr 5, 2021

Choose a reason for hiding this comment

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

I see what you meant now. The ending in [2-9][0-9] refers to the final two digits as a regular expression. These have the same plural form as all numbers ending in 00 (100, 1000, 100000, etc).

And as a Romanian native I confirm it all works out as exemplified here: https://output.jsbin.com/kagomig

@frosch123
Copy link
Member

@frosch123 frosch123 commented Apr 4, 2021

This depends on OpenTTD/eints#40
Deployment order:

  1. Merge OpenTTD/eints#40
  2. Rebase OpenTTD/eints/openttd-github
  3. Merge this + Tag OpenTTD/eints/openttd-github

@kneekoo
Copy link
Contributor Author

@kneekoo kneekoo commented Apr 5, 2021

This depends on OpenTTD/eints#40
Deployment order:

As I'm insufficiently familiar with git and github to confidently take those steps myself, please make the change in src/strings.cpp as well. Thank you.

@kneekoo kneekoo requested a review from frosch123 Apr 5, 2021
@LordAro
Copy link
Member

@LordAro LordAro commented Apr 6, 2021

Wasn't intended for you :)

Have fixed the comment, will wait for @frosch123 to finish up the deployment

@kneekoo
Copy link
Contributor Author

@kneekoo kneekoo commented Apr 6, 2021

Have fixed the comment, will wait for @frosch123 to finish up the deployment

Please note that the comment was correct. 0 and *00 use different forms.

0 beers = 0 beri
100 beers = 100 de beri
10000 beers = 10000 de beri

The line of code can be checked against the three forms here: https://output.jsbin.com/kagomig

@LordAro
Copy link
Member

@LordAro LordAro commented Apr 6, 2021

Yes, but there's nothing special about *00. The plural forms are (according to the code and the reference provided, I know nothing about Romanian) :

  • 0
  • *01-19
  • everything else

I suppose you might argue that the comment is a bit backwards...

@kneekoo
Copy link
Contributor Author

@kneekoo kneekoo commented Apr 6, 2021

Yes, but there's nothing special about *00. The plural forms are (according to the code and the reference provided, I know nothing about Romanian) :

  • 0
  • *01-19
  • everything else

I suppose you might argue that the comment is a bit backwards...

The original comment was correct

Three forms: special case for numbers ending in 00 or [2-9][0-9].

The new comment is wrong because it says "special cases for A or B", but "00" is not included in either.

Three forms: special cases for 0 or numbers ending in 20 to 99.

I'm not sure why you'd want to change the original comment, though.

@frosch123 frosch123 merged commit d4c3d01 into OpenTTD:master Apr 10, 2021
1 of 12 checks passed
LordAro added a commit to LordAro/OpenTTD that referenced this issue Apr 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants