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

Croatian localization of TimeSpan fails with >1 day #597

Closed
lzybkr opened this issue Nov 21, 2016 · 2 comments
Closed

Croatian localization of TimeSpan fails with >1 day #597

lzybkr opened this issue Nov 21, 2016 · 2 comments

Comments

@lzybkr
Copy link

lzybkr commented Nov 21, 2016

My repro is using PowerShell, but there is a null reference exception when the number of days is > 1 and the culture is hr.

#32 PS> [Humanizer.TimeSpanHumanizeExtensions]::Humanize([timespan]::new(1,1,1,1,1), 5, [CultureInfo]'hr')
1 dan, 1 sat, 1 minuta, 1 sekunda, 1 milisekunda

#33 PS> [Humanizer.TimeSpanHumanizeExtensions]::Humanize([timespan]::new(2,1,1,1,1), 5, [CultureInfo]'hr')
Exception calling "Humanize" with "3" argument(s): "Value cannot be null.
Parameter name: format"
At line:1 char:1
+ [Humanizer.TimeSpanHumanizeExtensions]::Humanize([timespan]::new(2,1, ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException
@hangy
Copy link
Contributor

hangy commented Nov 22, 2016

Interesting. There seem to be some special resources for different plurals in the Croatian language (see

private const string DualTrialQuadralPostfix = "_DualTrialQuadral";
). There is no TimeSpanHumanize_MultipleDays resource in https://github.com/Humanizr/Humanizer/blob/a204909f36c18bfed2d9b399a5b2f55e9fe41dda/src/Humanizer/Properties/Resources.hr.resx though, so that the resolved format is null and thus the call to string.Format fails.
I suppose it should work for timespans of ie. 15 days ..? Do you know if these different plural forms are even required for days?

@lzybkr
Copy link
Author

lzybkr commented Nov 29, 2016

I don't know Croatian. I found this experimenting with all possible languages to help produce this comment: PowerShell/PowerShell#2689 (comment)

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

No branches or pull requests

2 participants