Re: do we need i18n when serving static files ?

Marcus Priesch <[email protected]> Thu, 28 Apr 2022 17:42:51 +0200
Newsgroups gmane.comp.bug-tracking.roundup.devel
Organization priesch.co.at - open source consulting
Message-ID <[email protected]>
Hi John,

 > 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 ;)

you probably can achieve roundup translated javascript by attaching it
it (or its messages) to the templated web page

 > 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 ?

 > 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.

 > 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.

 > I don't see an advantage to trying to do a translation in javascript
 > as you would have two sets of translation files (web and javascript
 > for rest or xmlrpc for that matter) that need to be maintained/synced
 > etc.

sorry, i dont understand that part ... ?

 > But maybe I do not understand your proposal.

hopefully it is clearer now ;)

regards,
marcus.