Re: do we need i18n when serving static files ?
"John P. Rouillard" <[email protected]> Thu, 28 Apr 2022 14:30:18 -0400
| Newsgroups | gmane.comp.bug-tracking.roundup.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Marcus: In message <[email protected]>, Marcus Priesch writes: > > Would i18n processing for static assets allow me to have feedback > > messages in English in a javascript file (consider strings in a dict) > > that are translated using roundup's i18n? This way there is no need to > > add a javascript based i18n mechanism. > >no, static fiels are served as static files - hence the name ;) Ok that was what I expected. >you probably can achieve roundup translated javascript by attaching it >it (or its messages) to the templated web page Yup I have done that or written an extension to generate the js dict suitably translated. > > I have written javascript in html templates that are processed through > > roundup's i18n mechanism and then referenced by js loaded through > > script src=... references. > >yes, but i assume that this was not a @@file url ? Correct, the localized js was in an html template while the src url was an @@file reference. > > I assume you need roundup's i18n mechanism to translate things like > > status names etc. in the rest response right? > >yes, rest and xmlrpc as well as normal templates are not affected by >this - its just that for static files no locale gets loaded. Ok. I have seen people serve .css and .js static files by a front end web server rather than serving it though the roundup server, but improving the speed of file serving for static files I guess is useful. Was translation actually used in the @@file path? It would return a 404 but the 404 is not usually visible to the user as it's not the top level html file. > > So optimizing out i18n from the rest flow doesn't seem like it would > > work. > >you are right, but i dont do that, just setting the locale (if wanted at >all) at a later stage in the processing, to skip it for cases that dont >need i18n at all. Sounds good. >hopefully it is clearer now ;) It is. Your change sounds good. Have a great day. -- -- rouilj John Rouillard =========================================================================== My employers don't acknowledge my existence much less my opinions.