But it seems, by using middleware, it is not possible to change the value. Because everything compiled and I get the old data only. I don’t know exactly what happens.
Right now, I have created a new package to handle i18n (local package is also named as i18n. I have to think and rename it)
I have implemented the translate method for that package
I pass the i18n struct to all my templates. Inside the templates, I call the function `translate
{{translate "login"}} //translated to Login
I made it working somehow.
//if you really need the code, I can create a simple go chi middleware and share the code.like changing the value of a string. I tried that, That is also not working. (even after passing the address) Old value is printed
Hi,
wondering if a better approach would be that the middleware adds the localizer to request’s Context instead of modifying the global appConfig.
I think thos would be a better approach to avoid that multiple requests change the global appConfigg in concurrent way