tavanogui
tavanogui12mo ago

How can I access req object inside a render() function from fresh plugin?

Is it possible?
7 Replies
razzi
razzi12mo ago
I'd get what you need from the request and put it in app state, then pass the relevant app state thru to the render Could you add some more information like the fresh plugin so we can get a better idea of the use case?
lucis
lucis12mo ago
We're using the plugin as a gateway to attach the string translations to the web page, so that it can be used by both backend and frontend code A better i18n approach would be cool as well, haven't looked into that for a while
tavanogui
tavanoguiOP12mo ago
yes, we would like to listen popular approachs for i18n but, in general line we are doing something like:
tavanogui
tavanoguiOP12mo ago
No description
marvinh.
marvinh.12mo ago
I think we're missing that in our API. I feel like we should change it so that the ctx object should match other areas of the plugin API Filed https://github.com/denoland/fresh/issues/2220 so that we don't forget about it. (It's difficult for me to keep track of bug reports or feature requests in discord compared to github)
tavanogui
tavanoguiOP12mo ago
nice! started something here: https://github.com/denoland/fresh/pull/2224
Per
Per2mo ago
It seems there really is no convenient way of just sending out only the relevant translation strings for a given page/component/island?

Did you find this page helpful?