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

Properly handle Dutch year numbers #183

Merged
merged 5 commits into from
Oct 16, 2022

Conversation

mvz
Copy link
Contributor

@mvz mvz commented Oct 14, 2021

Changes the handling of, e.g., 1984, to use nineteenhundred-style instead of one thousand nine hundred.

This solution is slightly hacky at the moment. If this logic makes sense for other languages (English and German, perhaps?) I can create some helper methods.

@jlduran
Copy link
Collaborator

jlduran commented Oct 14, 2021

Great!

At least for English, I would add an option to pass (e.g. shortened: tue or informal), we do not want a check to bounce because of that 🙃

Copy link
Collaborator

@jlduran jlduran left a comment

Choose a reason for hiding this comment

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

This is OK.

I commented about my preferred style, but it is not compulsory. If there are no objections, I should commit it over the weekend.

Comment on lines 29 to 36
if figures.number_in_capacity(1) == 1
if figures.hundreds
teen_hundreds = @figures[2, 2].to_figures
[([@translations.teens(teen_hundreds), translate(:hundreds, 1)] + simple_number_to_words).join]
else
simple_number_to_words + [translate(:mega, 1)]
end
else
super
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is just a personal preference, how about?:

return super unless figures.number_in_capacity(1) == 1

if figures.hundreds
  teen_hundreds = @figures[2, 2].to_figures
  [([@translations.teens(teen_hundreds), translate(:hundreds, 1)] +
    simple_number_to_words).join]
else
  simple_number_to_words + [translate(:mega, 1)]
end

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's better. Updated.

Changes the handling of, e.g., 1984, to use nineteenhundred-style instead
of one thousand nine hundred.
@mvz mvz force-pushed the fix-dutch-teenhundreds branch from 09deac6 to 42dd709 Compare October 16, 2021 07:51
@mvz
Copy link
Contributor Author

mvz commented Oct 16, 2021

I'm going to do do a bit of research on whether in Dutch this change is always good, or only for years.

@mvz
Copy link
Contributor Author

mvz commented Oct 16, 2021

I'm going to update this PR make this an option.

@mvz mvz force-pushed the fix-dutch-teenhundreds branch from 7cb9051 to c7c27d4 Compare October 16, 2021 14:20
@mvz
Copy link
Contributor Author

mvz commented Oct 16, 2021

The teenhundreds style is generally used with years, not so much with other numbers. Still to do:

  • Use this also for later years, like 2183
  • Think of a better option name since this one is bad for 2183

This style of pronunciation is mostly used for years.
@mvz mvz force-pushed the fix-dutch-teenhundreds branch from c7c27d4 to 78b0bef Compare October 16, 2021 15:04
@mvz mvz force-pushed the fix-dutch-teenhundreds branch from 78b0bef to af86e9d Compare October 16, 2021 15:06
@mvz
Copy link
Contributor Author

mvz commented Oct 16, 2021

Maybe :years or :year_numbers could be a good option name?

@mvz mvz changed the title Properly handle Dutch teenhundreds Properly handle Dutch year numbers Oct 16, 2021
@jlduran
Copy link
Collaborator

jlduran commented Oct 17, 2021

Maybe :years or :year_numbers could be a good option name?

Yes, if I understand what this commit is about. Based on (US) English:

  • 1,984 should be spelled out by default: one thousand nine hundred eighty-four.
  • 1984 plus an option (could be :years) could be spelled out: nineteen eighty-four. I believe this option may have its uses in some sort of text-to-speech application, as not many manuals of style recommend it.
  • 1,984 plus an option (could be :keep_spelling_hundreds_instead_of_thousands 🙃) could be spelled out: nineteen hundred eighty-four.

Or poke the CMOS for more inspiration.

If I understand correctly, you are trying to implement the second option?

@mvz
Copy link
Contributor Author

mvz commented Oct 18, 2021

If I understand correctly, you are trying to implement the second option?

I'm trying to implement the third option for Dutch. Both the second and third options are possible in Dutch.

@dblock
Copy link
Collaborator

dblock commented Jul 23, 2022

@mvz want to finish this? or should we merge as is?

@mvz
Copy link
Contributor Author

mvz commented Jul 25, 2022

@dblock I'll take another look and hopefully finish this in the coming weekend.

@dblock
Copy link
Collaborator

dblock commented Jul 31, 2022

@mvz can take a look on green

@mvz mvz force-pushed the fix-dutch-teenhundreds branch from eeb3d78 to 8627483 Compare July 31, 2022 17:47
@mvz
Copy link
Contributor Author

mvz commented Jul 31, 2022

@dblock it's ready now as far as I'm concerned. I've renamed the option to tens_of_hundreds.

@jlduran
Copy link
Collaborator

jlduran commented Jul 31, 2022

This just needs an entry in the CHANGELOG, maybe also an addition to the README with the additional option. But that could be committed afterwards. I’ll leave it with @dblock. Thank you @mvz!

Copy link
Collaborator

@dblock dblock left a comment

Choose a reason for hiding this comment

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

@mvz care to please add to the change log/readme so we don’t forget? There’s no rush to merge. Thanks for contributing!

@jlduran
Copy link
Collaborator

jlduran commented Oct 11, 2022

If there are no objections, I can add the missing CHANGELOG entry this weekend and commit. Thank you!

@jlduran jlduran merged commit 5059bae into kslazarev:master Oct 16, 2022
jlduran added a commit that referenced this pull request Apr 23, 2023
Release 0.11.12 (April 22, 2023)

Features:

- Add support for Ruby 3.1. \[[#187](https://github.com/kslazarev/numbers_and_words/pull/187)\]
- Drop support for Ruby 2.5. \[[#180](https://github.com/kslazarev/numbers_and_words/pull/180)\]
- Drop support for Ruby 2.6. \[[#190](https://github.com/kslazarev/numbers_and_words/pull/190)\]
- Add support for Ruby 3.2. \[[#193](https://github.com/kslazarev/numbers_and_words/pull/193)\]

Bugs:

- Properly handle Dutch year numbers. \[[#183](https://github.com/kslazarev/numbers_and_words/pull/183)\] \([@mvz](https://github.com/mvz)\)
- Remove pluralization rules for French. \[[#195](https://github.com/kslazarev/numbers_and_words/pull/195)\]
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.

3 participants