开发者

Multi-language change without page refresh?

User selects a new language from English to German. Currently the page has to refresh each time to change the text to the language selected. This is fine for IE but on firefox it always asks the user and a bad user experience. Plus if user is in the middle of typing something then has to refresh the text is all gone. So is it possible to load new language text without a refresh? Since this is a user content site there is a lot of content per page. Backend is PHP cod开发者_JAVA百科eigniter & MySQL.


Usually you use only one language when you browse, so when your user will select one, you just have to find a way to remember it.

Even if it's a "bad user experience", it will always be better than having a ton of javascript and all the locales changed with javascript.

I don't say it isn't possible, but just think about it, does it really worth it ?


Seems like this would be an easier flow to implement:

  1. User starts typing something and realizes they're typing under the wrong language setting.
  2. User chooses a different language.
  3. The application stores what the user was typing using whatever method seems best to you, i.e. MySQL, session, cookie, whatever.
  4. The page refreshes with the correct locale and content as normal.
  5. Restore what the user was typing.

Changing the language via Ajax is certainly possible, but as others have mentioned, it may be more work to implement than it's worth.


I'm assuming by changing languages, you mean you have a drop-down or something in your web app that lets users select a language. If so... Are you using something like jQuery? You can assign a style to every span/element that has display text, and when the language is changed, cycle through all spans with that style, and update whats displayed - loading the new display text via an ajax call. This is very similar to how many desktop applications handle translation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜