Open myquay opened 9 months ago
@myquay Thanks for your issue and excellent suggestions. I'd very much like a PR, thanks for the offer :)
The entire culture handling in the middleware is unfortunately quite hacky (and only really useful in our own use cases), so I'd be happy to update this to a better and more generalised version that is useful to others.
I ran into an issue with how this package interacts with a solution that's already localised.
During registration of the Storyblok middleware this section was interfering with our localisation configuration causing existing sections of the application to not behave as intended.
I've made a few changes to the library so that it is able to integrate with a solution that's already been localised - here's the commit: https://github.com/myquay/Storyblok/commit/2ab0f6417c1727b826569eabcd833e3b406ff5c6
Let me know if this is something you think could help other users of your library and I'm happy to submit a PR otherwise feel free to close the issue.
The changes I made where around the three touch points below:
ApplicationBuilderExtensions.cs
remove the code that alters the localisation configuration. Add a customRequestCultureProvider
to support the Storyblok style of localization by prefixing the slug so it works nicely with the editor. Placed it at high priority so it overrides other settings but does not modify existing settings so outside of Storyblok the application behaves as before.