What we learned launching our first multilingual PJAX web site
Recently we launched a web site which needed to be multilingual as we expected around 20 % of users not to speak any German at all. And this foreign users shouldn’t be left behind.
Sure, you could send that information in your response header, but that didn’t work for us in our production environment. Perhaps we could’ve fixed that somehow, but we decided to go the other way and just update our <head> on every single PJAX page request.
Sounds silly? Sounds like we could’ve just removed PJAX? Of course we didn’t want to update the whole <head>. Just the parts which needed an update. That’s why we added a data attribute to every html element in <head> which needed an update. And removed that on every single PJAX request, replacing with new ones from our fresh PJAX view fragment. Simple as that. And Google seems to like it.