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

Separate translations for "zero" and "zero like numbers" #3997

Closed
maro-21 opened this issue Apr 1, 2023 · 15 comments · Fixed by #4077
Closed

Separate translations for "zero" and "zero like numbers" #3997

maro-21 opened this issue Apr 1, 2023 · 15 comments · Fixed by #4077
Labels
bug Something is broken or not working as expected i18n Internationalisation - related to translation into different languages

Comments

@maro-21
Copy link

maro-21 commented Apr 1, 2023

Translatewiki knows better how something should be translated...

translation1

Translation of the text in the red box: "Plural forms should be defined as ...
This translation includes ..."

But when I remove "|zero=Brak zgłoszeń"
it allows me to upload.
translation2

Is it possible to disable this validator? Alternatively replace it with a warning (yellow color)?

@tomhughes
Copy link
Member

Translatewiki is outside our control - if you have a problem with the way it operates then you will need to address it with them.

@Nikerabbit
Copy link
Contributor

This is OSM problem in my opinion, and I believe I have reported this earlier already. The zero form should not be used in English. If you look at for example Latvian at https://unicode-org.github.io/cldr-staging/charts/37/supplemental/language_plural_rules.html you can see that the zero form is not just number 0.

For most languages this is not a problem, but for languages like Latvian, the translation is either wrong or it is impossible to provide translation for "no X".

This can be resolved in two ways:

  • Have a separate message when N is 0. This works for all languages, though it is a bit more work.
  • Hack the I18n library to add support for explicit integer forms. This was done in MediaWiki. Then you can replace zero form with 0 form.

@tomhughes
Copy link
Member

The problem is that https://cldr.unicode.org/index/cldr-spec/plural-rules is self contradictory - it both says that the zero category can sometimes cover all numbers that end in zero and also encourages treating it specially so you can do things like "No friends" in place of "0 friends".

@gravitystorm
Copy link
Collaborator

  • Have a separate message when N is 0. This works for all languages, though it is a bit more work.

I'm happy to make this change. We currently have the zero form in two places, so it's not much work to sort out.

I wasn't previously aware about the problem with using the zero form, but it makes sense to replace it with a separate translation, given the Latvian issue.

@gravitystorm gravitystorm reopened this Apr 2, 2023
@gravitystorm gravitystorm added bug Something is broken or not working as expected i18n Internationalisation - related to translation into different languages labels Apr 2, 2023
@tomhughes
Copy link
Member

Well it's not something we can do on our own - it's the i18n library that decides how to map counts to labels.

@gravitystorm gravitystorm changed the title Cannot upload correct translation Avoid using zero form in English countable translations Apr 2, 2023
@tomhughes tomhughes changed the title Avoid using zero form in English countable translations Separate translations for "zero" and "zero like numbers" Apr 2, 2023
@gravitystorm
Copy link
Collaborator

Well it's not something we can do on our own - it's the i18n library that decides how to map counts to labels.

I think we can do it ourselves like:

if count == 0
  t '.no_whatevers'
else
  t '.whatevers', :count => count
end

@tomhughes
Copy link
Member

Well obviously we can do that but I was dismissing the idea of doing that to everywhere where we lookup a counted translation as impractical and/or having way too awful an effect on the code.

I'd monkey patch the pluraliser before I did that!

@tomhughes
Copy link
Member

Already discussed at ruby-i18n/i18n#629 and https://github.com/ruby-i18n/i18n/blob/master/lib/i18n/backend/pluralization.rb#L17.

Unfortunately although they support 0 and 1 as keys for "exactly 0" and "exactly 1" the :zero key still seems to take precedence if it exists :-(

@tomhughes
Copy link
Member

I guess so long as locales that need :zero don't also want explicit zeros it works but it would be better if the lookup in i18n was reversed.

@verdy-p

This comment was marked as off-topic.

@tomhughes

This comment was marked as off-topic.

@verdy-p

This comment was marked as off-topic.

@gravitystorm
Copy link
Collaborator

I don't understand the reply made by "We're not going to invent our own I18n framework though"

If you don't understand something, then please ask for clarification.

[....] which just means that he does not want to do anything (even if it would not require lot a work

This is absolutely not what he said. I don't know why you took a statement that you say you didn't understand, and then go on for three paragraphs, making up conclusions and attributing bad intentions as you go along. It's not helpful.

Please be assured that we will fix this problem, that's why it was reopened.

@verdy-p

This comment was marked as off-topic.

@verdy-p

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken or not working as expected i18n Internationalisation - related to translation into different languages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants