Humanizr / Humanizer

Humanizer meets all your .NET needs for manipulating and displaying strings, enums, dates, times, timespans, numbers and quantities

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DateTimeOffset.Humanize(culture: newCulture) doesn't emit translated text

mrbelk opened this issue · comments

I am trying to use the DateTimeOffset.Humanize() method in a Xamarin.Forms application and specifying a cultureinfo that's different from the current OS culture (in this case "es," and "fr") but when I "Humanize" a DateTime or DateTimeOffset, the resulting text is in the default culture "en-US".

Is this a known bug? Is there any additional setup I have to perform in order to "register" the other languages? I have added the culture specific Humanizer.Core.fr and Humanizer.Core.es Nuget packages in addition to the base Humanizer.Core package. All of the versions are the same.

Thanks,
Matthew

I forked the repo and added a simple test to the DateHumanizerDefaultStrategyTests and the TimeSpanHumanizerTests to pass a CultureInfo object to the .Humanize() extension method and it appears to work correctly. That would seem to indicate a problem in my code, but I can't for the life of me figure out what the problem is. I guess my next step will be to directly reference the Humanizer project from my app's project.

when I directly reference the Humanizer project in my xamarin.forms app, everything seems to work as expected. It would appear there's something up with the nuget packages when I add just the 2 languages that I need. When I added the "catch-all" Humanizer project, which includes all of the cultures, I still get the default culture translation, not the actual culture specified in the CultureInfo object passed in to the Humanize method.