Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML How to Make a Website Adding Pages to a Website Build the Contact Page

Multi-language site

What's the best practice in terms of site architecture for building a multi-language site? Is it best to make a subdirectory for each language (e.g. en, fr, de)? But what do you serve as the index page? Do you make a symlink to /en/index.html?

4 Answers

Hi, google translate integration may becomes handy in this case. But as we already know, google translate sometimes have grammatical errors, it can be a mess if your website is serving the audiences some technical sentences which can't be translated literally. If you can do some additional efforts, it's recommended to have another webpages using folders or subdomains with each has been already translated. For the main page, well, it's a little bit technical in server side, you can apply a GeoIP system in your server to check your audiences IP and redirect the audiences to the main page of another language, e.g. audiences' IP detected as spain by GeoIP will be redirected to spanish webpage, etc. You should try Maxmind GeoIP for experiments, installing their GeoIP modules and database inside your server, and declare the redirects using .htaccess.

One solution is Google's translator widget and you might also refer to their international guidelines.

Ok, thanks for the tips and references. I was thinking of making and maintaining separate pages, just for the languages I speak myself. So not using any automated translation and serving the English page by default, but giving the user the option to switch the language manually, so without any geolocation (because I often find it annoying myself).

I suppose my question was a much lower-level type one. I meant that if I saved the separate pages in their respective language directories (say in directories ./en, ./fr, ./de), then what do I need to do so that when the default page is requested (say when someone just types http://mydomain.tld/) and the index.html page is served, that that index page corresponds to /en/index.html. Do I just need to make index.html into a symbolic link or do I need to change something else?

How about redirecting to folder using .htaccess? Maybe some sort of rule like this can help you, RewriteRule ^$ /store [L]