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

Mixed languages in TimeToClockNotation (ITimeOnlyToClockNotationConverter implementations do not forward the culture to ToWord) #1519

Open
acidbubbles opened this issue Jun 13, 2024 · 0 comments

Comments

@acidbubbles
Copy link

When using

Examples:

This results in mixed languages.

Repro

var time = Configurator
  .TimeOnlyToClockNotationConverters.ResolveForCulture(new CultureInfo("fr-FR"))
  .Convert(new TimeOnly(19, 35), ClockNotationRounding.NearestFiveMinutes);

This results in jeudi 3 février 2022, nineteen heures fifteen

Same for es-ES: ... las seven y ten de la tarde PM

I did not validate for further languages.

Solution

I'm guessing, forwarding the culture to e.g. EsTimeOnlyToClockNotationConverter so it can then forward it to ToWord would be the sensible solution, but it is an API change that I wouldn't be comfortable submitting, since it would affect potentially multiple files.

Workaround

Setting the CultureInfo.CurrentUICulture works, but it is not a desirable solution because it requires locking the string creation in multi-threaded environment, and we don't want to affect the UI culture necessarily.

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