TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Best Structure for a Multilingual Website?

3 pointsby offskyabout 2 years ago
I am planning to translate a static website into a few other languages. I am trying to figure out the best structure for doing this. I can think of 5 ways to do it. Example using Spanish:<p>1) es.example.com&#x2F;index.html<p>2) www.example.es&#x2F;index.html<p>3) www.example.com&#x2F;es&#x2F;index.html<p>4) www.example.com&#x2F;index.html (with language set via a cookie)<p>5) www.example.com&#x2F;index.html?lang=es<p>I see a problem with #2 already because TLDs are country specific not language specific. Also expensive.<p>I think #4 has a problem with regard to search engine optimizations as both languages would have the same canonical url. I would like my content to be indexed in both languages.<p>Wikipedia does #1. Apple does #3. Google does both #2 and #4.<p>Question 1) What structure would people here recommend?<p>Question 2) Would it be best to detect the browser&#x27;s preferred language and auto-redirect people, or should I make the user do that language choice manually?

2 comments

necovekabout 2 years ago
I think Apache web server supported setting Content-Language automatically and doing content negotiation based on Accept-Language (browser-set language) for static sites if you simply used index.es.html.<p>It&#x27;s been a long time since I used this, so check the specifics.
mytailorisrichabout 2 years ago
I think #3 is the most elegant and generic, and you can still use TLDs in addition. It also works well for a static website.