-2

I am new to javascript. I have a static website containing HTML5,css3 and javascript(No php or server side language). Now my website is English. My question is, is that possible to change language of my website based on country(For example if someone enter my website from japan it should show in japan language and for US in English).

I saw https://stackoverflow.com/a/8199791/7997976 which provides country code but how to change language in website.

I believe there is a way to do it in javascript.Please help me in this.

Ash
  • 149
  • 1
  • 1
  • 13
  • why you don't let user decide what they want to see if all you did is google translate? – apple apple Apr 03 '18 at 06:32
  • may a better option is to display the website based the language of the browser, https://stackoverflow.com/questions/8199760/how-to-get-the-browser-language-using-javascript?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – mfadel Apr 03 '18 at 06:34
  • but It only shows which is user's browser language. But I want to change my website based on that.@mfadel – Ash Apr 03 '18 at 06:35
  • Where/how is the multi-lingual content stored? – Jon P Apr 03 '18 at 07:30
  • I added code as per link I mentioned above inside – Ash Apr 03 '18 at 12:29
  • Browsers have no inbuilt translation ability. I'm not sure where you think the translated content will come from. Most multilingual web sites have their own resources for each available language. E.g there would be an English page, Spanish page French etc. – Jon P Apr 04 '18 at 05:56
  • I used that code because @mfadel told that. But it is only showing language is en-us . I changed the default language settings in chrome. but the popup still shows language is en-us. I read somewhere it is possible via http-accept,. but no idea how to do that – Ash Apr 04 '18 at 07:25

1 Answers1

1

Please go with google and follow the instruction of google for multi language.

https://translate.google.com/manager/website/

  1. Enter the website URL which you want.

  2. Copy the code and paste in your website.

Community
  • 1
  • 1