Irrelon / jquery-lang-js

i18n Allow instant language switching on HTML pages without reloading the page.
https://www.irrelon.com
362 stars 132 forks source link

How to avoid the flicker after the html loaded #51

Closed headson closed 7 years ago

headson commented 9 years ago

When refresh the web after setting a non-en language,the text of web will display in English in a very short time,after which the text changes to display in cookielang! Is there any method to avoid this? Thank you !

roha69 commented 9 years ago

Performance problem. Load you some javascript before the lang is set ?

Irrelon commented 9 years ago

The other way is to load the minimal HTML to get the JS up and running, then use JS to request the rest of the page and insert it with jQuery. Because you insert with jQuery the html will be pre-translated before it even gets rendered to the screen. This however only works well if you are writing a web app or don't care about that page being indexed by google.

headson commented 9 years ago

Thanks ! Then must I add "var lang = new Lang('en');" and required JS file to the html of each iframe if I use multiple iframes in the index page?