windows 10 pro office 2019 pro office 365 pro windows 10 home windows 10 enterprise office 2019 home and business office 2016 pro windows 10 education visio 2019 microsoft project 2019 microsoft project 2016 visio professional 2016 windows server 2012 windows server 2016 windows server 2019 Betriebssysteme office software windows server instagram takipçi instagram beğeni instagram görüntüleme instagram otomatik beğeni facebook beğeni facebook sayfa beğenisi facebook takipçi twitter takipçi twitter beğeni twitter retweet youtube izlenme youtube abone instagram

Configure template loader to pass extra parameters

Asked By: Anonymous

I’m working on i18n of my Aurelia components. I want to render the translations server-side because our translations are stored in a CMS and can be updated post-deploy. I’ve succesfully written a Java WebFilter that intercepts requests to Aurelia templates and translates strings before returning the template.

All this works very well, until the user switches language. This is implemented as a full page refresh, and the preferred language is stored in the server-side session. So the template parser does pick up the language change. The problem is that the Aurelia templates have already been cached client-side with the wrong translations in them.

One workaround that I’ve gone with for now is to disable caching for the templates. But ideally, I’d like the browser to cache the templates, until the language changes at which point the templates should be requested again.

A simple solution would be to add the language to the URL of the template request. That way the cached template won’t be used once the language has changed. (And if the users decides to change the language back, we can load them from cache again. Hurray!)

I’ve tried to implement this, however I can’t find any documentation on the (default) loader. Can I configure it to add language as a parameter to the template URL? Or can I create a custom loader to add this behaviour?


Answered By: Anonymous

Try adding this to your main.js to monkey patch the template loader with the language query string logic:

import {TextTemplateLoader} from 'aurelia-loader-default';

// capture the standard logic in a new "standardLoadTemplate" method.
TextTemplateLoader.prototype.standardLoadTemplate = TextTemplateLoader.prototype.loadTemplate;
// intercept calls to "loadTemplate" and add the query string before calling the standard method.
TextTemplateLoader.prototype.loadTemplate = function(loader, entry) {
  entry.address += '?' + 'en-US'; // todo: set based on currently selected language
  return this.standardLoadTemplate(loader, entry);

export function configure(aurelia) {

Here’s an example:

techinplanet staff

Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno
Alanya escort Manavgat escort Fethiye escort Kemer escort Didim escort Gaziantep escort Denizli escort Adana escort Hatay escort Aydın escort İzmir escort Ankara escort Antalya escort Bursa escort İstanbul escort Kocaeli escort Konya escort Muğla escort Malatya escort Kayseri escort Mersin escort Samsun escort Sinop escort Tekirdağ escort Eskişehir escort Yalova escort Rize escort Amasya escort Balıkesir escort Çanakkale escort Bolu escort Erzincan escort Şırnak escort Van escort Yozgat escort Zonguldak escort Afyon escort Adıyaman escort Bilecik escort Aksaray escort Ağri escort Bitlis escort Siirt escort Çorum escort Burdur escort Diyarbakir escort Edirne escort Düzce escort Erzurum escort Kırklareli escort Giresun escort Kilis escort Kars escort Karabük escort Kırıkkale escort Mardin escort Kırşehir escort Maraş escort Manisa escort Muş escort Kastamonu escort Ordu escort Nevşehir escort Sakarya escort Osmaniye escort Şanliurfa escort Sivas escort Trabzon escort Tokat escort Ardahan escort Bartın escort Karaman escort Batman escort Bayburt escort Bingöl escort Elaziğ escort Gümüşhane escort Hakkari escort Isparta escort Uşak escort Igdır escort