Question

I'm new to using php (and its been I while since I've coded) ... but anyway, I want to create a website that uses two languages. I've been reading up on google's best practices (Multi-regional and multilingual sites), but I'm yet to find something that can help me with the actual development.

The site will contain at least 30 pages and need to be compatible with all the major browsers.

Really appreciate some advice on this. At the moment I don't no whether to create a page for each language (because lang='' doesn't appear to be compatible with all browsers), or hide and show div's on page load or dynamically load the content with php ... what is the best practice?

Apologies if this is a little generic ...

Thank you in advance!

Was it helpful?

Solution

create a page for each language

This is sensible.

(because lang='' doesn't appear to be compatible with all browsers),

Browsers don't generally need to care what language the page is written in. They just need to display the content to the user, so that doesn't matter.

Some screen readers might look at lang to determine which pronunciation guide to use, but few other tools used directly by humans will care.

Language can influence which character encoding you use (although in most cases the answer is "Just use UTF-8"), but that is specified independently of the lang attribute.

or hide and show div's on page load

This sounds like you will have a page that just jumps between languages, unless JavaScript is available in which case some of it will be hidden from the user. I wouldn't do that. Have sensible documents.

or dynamically load the content with php

Dynamically generating the content server side is one way to produce pages in multiple languages. It is still sensible to give them independent URIs so users can link to specific ones.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top