1

How can I make multi-language website? in this url there is some information but it is not more clear about multilingual.

we want to build a multilingual site in php. where we have article, menu, book and many more table

all the table will have multilingual unlimited language, we will assign language in the database . and then the new language will show in the insert form like

Insert Article

tab-English / tab-France / tab-Bengali /....etc

I am thinking like this.

language

id_language
language_name

article - table

id_article
date

article_language

id_article_language
id_article
id_language
article_title
article_description

so when i enable a new language for a table then a tab will appear in the right and a query string will appear like ln=English so it will insert English language data in article.

Is any one have better idea how to mange this multilingual site.

Community
  • 1
  • 1
arifur rahman
  • 264
  • 4
  • 10

1 Answers1

4

It seems like you have the database end worked out pretty well. It looks good to me.

On the client side, you shouldn't need to append the language to the query string. This creates more work for you because you need to append that query string to every link dynamically because it will be different for each site.

Some sites use top level directories like http://www.example.com/en/ and http://www.example.com/de/, but the best way in my opinion would be to buy country code TLDs (ccTLDs) so the different languages of your site will be on different domains: www.google.com, www.google.com.es, www.google.de. Then, you can use the HTTP Accept-Language header to determine to which domain to redirect. You can use a language like PHP to parse a user's Accept-Language header.

I would encourage the use of ccTLDs or top level directories over the query strings for your sanity but also to make things easier on search engines. Some spiders won't understand the correlation between the ln=en in your query string and the language returned. Using a ccTLD will inform the spider without any intervention from you that the content is being served in a specific language for a specific locale.

That reminds me, you should also be serving the proper HTTP Content-Language header in your response. In php, that would look like:

header('Content-Language: en-US'); //or en-GB, or es-ES

You can use any of these country codes which comply to RFC1766.

EDIT: As @RepWhoringPeeHaa pointed out, you can also specify the language in the <head> tag of all of your HTML files with:

<META HTTP-EQUIV="Content-Language" Content="en" />
Bailey Parker
  • 15,599
  • 5
  • 53
  • 91