Reputation: 12512
I have a web-based tool, that is mainly used in English. I just received a question if it will support Thai language. Since it is mostly text based, what modifications do I need to make to support other languages, like Thai specifically?
Upvotes: 1
Views: 62
Reputation: 12721
First, you need to make sure you are using UTF8 encoding from end to end. That means in code, output, database and database connection. For PHP you should set mb_internal_encoding and mb_http_output to UTF-8.
Your output headers should be set UTF8. For example:
Content-Type:text/html; charset=UTF-8
If you are using MySQL, make sure your tables are UTF-8, you can convert them with an ALTER TABLE. For safety, you should also set your db connection to UTF-8 by running SET NAMES UTF8 as the first query on every connection.
Once you have that, then you can support most languages (i.e. not Chinese). THEN you can remove all your text from your HTML and put it in some sort of lookup system. A common solution is the gettext support in PHP. Although you may want to come up with your own solution that can search and replace in bulk.
While it's not trivial to do all this, once it's done it's easy to support more languages. You just need to translate your text. Bing has a free/cheap translation service with good terms. Google used to, but changed their policies about a year ago. Google still have a translation service, but the terms did not work for my needs.
Your question is a big topic, but this information should point you in the right direction.
Upvotes: 2