October 7th, 2006
PHP i18n strives to be the definitive source for information about internationalization on the PHP platform. It will provide reviews, code snippets, tutorials, news, and opinions on frameworks, strategies, and books related to PHP internationalization.
Posted in News | No Comments »
October 7th, 2006
The PEAR I18N Package is a useful collection of classes that help with the task of internationalizing your PHP applications. The Description from the PEAR site is as follows:
This package supports you to localize your applications.
Multiple ways of supporting translation are implemented
and methods to determine the current users (browser-)language.
Localizing Numbers, DateTime and currency is also implemented.
Link: http://pear.php.net/package/I18N
Posted in Libraries (Links) | No Comments »
October 7th, 2006
The PEAR I18Nv2 Package focuses on higher level application logic for PHP internationalized applications, such as HTTP language negotiation (obtaining the proper default language for the user), language and country names, international area codes number and date formatting, and more.
Link: http://pear.php.net/package/I18Nv2
Posted in Libraries (Links) | No Comments »
October 13th, 2006
Dataface is a rich framework that allows developers to create full-featured data-driven web applications based on PHP and MySQL very quickly. It is multifaceted, but it contains powerful internationalization support at its core.
You can take any existing PHP/MySQL application, install Dataface as a library, and start adding multilingual features to your application easily, and without having to modify the application’s architecture very much.
Dataface is distributed with PEAR_I18Nv2 to help with some of the internationalization duties, but much of it is specific to Dataface. For example, it adds some smarty tags and functions to be able to provide multiple translations for static text in the templates or error messages - storing the translations in simple INI files.
It also contains a query translator that will actually translate a standard SQL query at run-time into a query that will return the same results, but in the desired language. It uses naming conventions for tables to be able to easily add translations to your database.
For an introduction to internationalization in Dataface see http://fas.sfu.ca/dataface/documentation/tutorial/internationalization-with-dataface-0.6
For more information about Dataface, see http://fas.sfu.ca/dataface
Posted in Tips | No Comments »
October 13th, 2006
Found a nice article by Scott Reynen on the basics of PHP and unicode. He goes over the very low level process of converting a normal PHP string into an array of unicode characters in case you want to know how it works.
http://www.randomchaos.com/documents/?source=php_and_unicode
Just so you know, you can use the PEAR_I18N_UnicodeString class to do this for you, so you don’t have to worry about the inner workings.
For a slightly more robust solution you may want to check out some of the PHP extensions that you can get to handle multi-byte string handling and converting, such as mb_string or iconv.
Posted in Tips | No Comments »
October 17th, 2006
Gettext is the standard for the localization of strings in PHP applications. It is a separate program that can be installed and used across multiple environments including PHP. If you have the gettext PHP extension installed, it will provide you with a function called gettext which you can use to wrap your strings. It will replace the strings with the correct localized version if one exists. You provide the localized versions using .po and .mo files in a specific location of the file system.
For more information about the gettext extension, see here.
Posted in Libraries (Links) | No Comments »
October 17th, 2006
If you are new to the internationalization game, you may not fully understand what all of this Unicode talk is about. By some descriptions, you may be under the impression that in order to internationalize an application, you need to use Unicode.
This is not true in general.
Unicode is required to correctly encode asian languages and other languages that use non-latin glyphs. However, if you are creating an application that is available in French, Spanish, and English, you can quite easily use the simpler Latin-1 encoding (ISO 8859-1)
What difference does it make?
If you don’t need to use Unicode, then it will probably make your life easier to simply use Latin-1. This is because Latin-1 is a single-byte per character encoding, which PHP supports natively. Unicode uses 2 bytes per character and PHP does not natively handle this properly. Many of the string manipulation functions, for example, will not work correctly with multi-byte character strings.
This is where extensions such as mb_string and iconv, and libraries such as PEAR I18N_UnicodeString come in handy, as they provide functions to work with Multi-bytes strings properly.
It is easier just to stick with Latin-1 if you can.
However, don’t let this scare you away from Unicode too much. If there is ever a chance of porting your application to more exotic languages like Chinese or Korean, then Unicode can be very empowering. Also, even though PHP doesn’t properly support multi-byte strings, you can still do most things in Unicode using the normal php string functions, as long as the parameters don’t contain “funny” characters.
Posted in Tips | No Comments »
December 12th, 2008
I attended a talk on Wednesday by Jim Dela Hunt, a Vancouver-based software engineer and consultant who specializes in “world-ready” business and technology development. He certainly is an authority on the subject of internationalization.
It is worth checking out his article from the May 2007 issue of php|architect entitled “Unicode and PHP: A Gentle Introduction”. He also gave a talk on the same topic to the Vancouver PHP Conference.
Posted in Uncategorized | No Comments »
January 6th, 2009
I attended a talk in December hosted by the IIMA (International Internet Marketing Association) on internationalization - specifically multilingual web sites. The talk, given by Jim De La Hunt, touches on most (perhaps all) or the issues involved in internationalizing your web site. The very informative slides are available to download for free here.
I recommend going through these slides before delving into any particular technology as it will give you a good grounding on the subject and help to you to decide your direction.
Posted in Uncategorized | No Comments »