liberapay.com icon indicating copy to clipboard operation
liberapay.com copied to clipboard

Widget i18n is skewed by bad HTTP caching

Open Changaco opened this issue 8 years ago • 3 comments

CloudFlare only respects Accept-Encoding in the Vary header (What headers can I vary the cache on?), we use Accept-Language.

Changaco avatar Jun 20 '16 14:06 Changaco

An alternative solution to using Cloudflare Workers could be to send all the translations to the browser and use JavaScript to pick one of them based on NavigatorLanguage. It would be cheaper but less efficient.

Edit: this alternative requires JavaScript on the client, whereas a Cloudflare Worker can generate an SVG.

Changaco avatar Jun 15 '20 08:06 Changaco

This is kinda annoying, maybe it should indeed be done client-side.

Avamander avatar Jul 27 '22 18:07 Avamander

Screenshot from 2023-12-13 14-35-25

that doesn't look right next to the paypal widget. This is with java script enabled. would it not be better to define the default language right in the widget string?

Firefox preferred language is english, the website language is the important part though, if that is english, the button should be english, if it is french then the button should be french (regardless of browser preference, or geo location)

Translating the website using the google translate widget i get:

Screenshot from 2023-12-13 14-43-03

Somehow I feel that the LibreDonate button should be more of a marketing tool and the librepay or donate button text is sortof a trademark, best not to change it at all (similar to paypal).

CaptainMorgan12 avatar Dec 13 '23 22:12 CaptainMorgan12

I've fixed this issue by adding a (no-)caching rule to Cloudflare. This solution doesn't scale, but the current rate of requests for widgets seems to be low enough for the webapp and database to handle without any caching.

Changaco avatar Jan 21 '24 17:01 Changaco