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

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

Open
mrbelk opened this issue Dec 7, 2022 · 2 comments
Open

Comments

@mrbelk
Copy link

mrbelk commented Dec 7, 2022

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

@mrbelk
Copy link
Author

mrbelk commented Dec 7, 2022

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.

@mrbelk
Copy link
Author

mrbelk commented Dec 7, 2022

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.

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

1 participant