-1

Possible Duplicate:
How to internationalize a java web application.

greetings all i want that when the client request a page that page is automatically displayed in his locale meaning (locale is detected then switch to it) how to do so ?

Community
  • 1
  • 1
Mahmoud Saleh
  • 33,303
  • 119
  • 337
  • 498
  • misunderstood me, my question is very simple and clear i want on page load to detect the user locale and switch to it, Javascript function i guess ? – Mahmoud Saleh Dec 19 '10 at 21:48
  • So you aren't doing localization at server side? Did you check the example in the duplicate question? `${pageContext.request.locale}` and so on? Why would you ever use JS for this? – BalusC Dec 19 '10 at 22:11
  • i make the localization with spring framework.what do you mean by server side then? .and yes i checked the example but didn't find what i was looking for. i guess i will need js to detect the locale on page load and start applying localization. – Mahmoud Saleh Dec 20 '10 at 06:51

2 Answers2

1

Here is the tutorial on doing this in spring. And here is the spring reference documentation.

However, do not depend on the browser's locale as this has some issues like inconsistent way in locale handling by browsers, forces user's to switch the browser locale when you have to support multiple languages within the same country. Provide an ability for the user to switch language on the home page itself.

Aravind Yarram
  • 78,777
  • 46
  • 231
  • 327
0

Here is another example you can try.

Jama A.
  • 15,680
  • 10
  • 55
  • 88