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

TimeSpan.Humanize always returns value 1 as words for Norwegian (nb/nb-NO) #1129

Closed
Gakk opened this issue Oct 14, 2021 · 2 comments · Fixed by #1151
Closed

TimeSpan.Humanize always returns value 1 as words for Norwegian (nb/nb-NO) #1129

Gakk opened this issue Oct 14, 2021 · 2 comments · Fixed by #1151

Comments

@Gakk
Copy link
Contributor

Gakk commented Oct 14, 2021

Looks like a misunderstand has lead to Norwegian time span being humanized to word for values of 1:

TimeSpan.FromDays(366).Humanize(); // returns "ett år" (one year)
TimeSpan.FromDays(731).Humanize(); // returns "2 år" (2 years)

TimeSpan.FromDays(31).Humanize(); // returns "en måned" (one month)
TimeSpan.FromDays(61).Humanize(); // returns "2 måneder" (two months)

The same with weeks, days, hours, minutes, seconds and milliseconds.

In my opinion numbers should be returned for value of 1, since toWords: true is not specified,

I believe the issue is because of guidance from the Norwegian language council (Norwegian: Språkrådet). They define that:

The main rule is that we write small numbers (up to twelve) in letters.

But they continue:

Within the same sentence or paragraph, we should be consistent and choose either numbers or letters. Example: children between 6 and 14 years (not «between six and 14 years»). If the text contains many small and large numbers, it may be appropriate to use numbers throughout the text.

The main trouble with the current results are when using a precision greater than 1, then words and numbers for small numbers are mixed:

TimeSpan.FromMinutes(80).Humanize(2); // returns "ett minutt og 20 sekunder" (one minute and 20 seconds)
TimeSpan.FromMinutes(121).Humanize(2); // returns "2 minutter og ett sekund" (2 minutes and one second)

This result does not look good, and I believe the words for 1 ("en/ett") should only be used when toWords: true is specified. This is also according to the language council that states that it is more important to be consistent, and that sentences with multiple values should use numbers.

Since this is a localization issue, I tag the Norwegians that have contributed to translations in the past, so they get the opportunity to express their opinion: @erlendr, @henriksen, @jenscski

I am happy to contribute by fixing this when there is consensus to follow my suggestion 😊

@henriksen
Copy link
Contributor

I agree that consistency is important, and as long as toWords is a binary operator and cannot be used to force numbers, the default option should be to print only numbers. Then the developer can have the choice of one model or the other, but never a mixed model. Seems fair.

The "words below 12" rule seems to be a particular Norwegian one, other languages have different rules, so it's probably better to leave that decision to the developer.

@clairernovotny
Copy link
Member

Thanks, merged!

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 a pull request may close this issue.

3 participants