7

I've done a simple, small site which basically only consists of a single page. Simplicity and no clutter are very intentional here and (imho) work quite well for this from a UX standpoint.

Now I'm thinking of translating what little content there is in different languages. To stick with the no clutter rule I thought about doing this only with content negotiation without even having different URIs for different languages. For the user that probably works best as they get their language without needing to configure anything but their browser, but I worry about search engines. I guess it's not likely that Google, Bing, etc. crawl a site with various different language preferences, meaning that the translated content won't get picked up by them and thus not appear in regional search results.

So do I have to include links for different languages on the page or is there another way for this?

2 Answers 2

4

An XML sitemap will show them where to find the alternative language pages. You can also put links in the footer of your pages linking to other languages. This is good usability as it allows people to easily find the language of their choice if they accidentally ended up on the page in a less-preferred language.

3
  • Well, my intention was to not give different URIs to different languages, as noted in the question. As for less-preferred languages: That might be true of technical people like us but I guess the average age of the site visitor is around 15 or so.
    – Joey
    Commented Jul 12, 2011 at 22:23
  • You can do this without permanent different URLs. You can use a query string to pass the parameter to choose the language and then set a cookie with that preference and do a 303 redirect back to the same page.
    – John Conde
    Commented Jul 12, 2011 at 23:29
  • I've solved this by now with using explicit URIs that contain the language to select, so /de is the German version, /pt Portuguese, etc. This may be contrary to my initial goals but I didn't trust Google to keep different language versions for the exact same URI. Content negotiation is still done when visiting /, though. The query string was used for something else already and while the two uses wouldn't contradict each other I was too lazy to work around that :-)
    – Joey
    Commented Sep 6, 2011 at 7:20
0

An alternative to browser locale (which may not be reliable from a BOT) you can use Geo-IP (as a module on your Apache webserver or with PHP). The Geo-IP option may also make more sense if you have a product to sell.

In your index.php for php module version of GeoIP:

include("geoip/geoip.inc");
$gi = geoip_open("location/to/geoip/GeoIP.dat",GEOIP_STANDARD);
$country=geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
geoip_close($gi);

If you want to use the Apache module:

$country=$_SERVER['GEOIP_COUNTRY_CODE'];

Thereafter you can put together a big 'if' or 'case' construct in your index.php to work with whatever code you have to render your page.

1
  • The site is static HTML with no server-side scripting language whatsoever. And selecting language based on location is something I will never, never do. It's nothing the user can control and you have too many cases where it fails. E.g. I'm in Germany and prefer English (and have stated so in my browser preferences). What do you do with people in Switzerland? German, French, Italian? People using TOR also will have the problem that they get languages assigned they can't control.
    – Joey
    Commented Sep 6, 2011 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.