PHP 5.3 has been recently released and one of the new features in core is the internationalization extension. It allows you to support a multitude of languages and local formats much easier than before, without having to learn all the tiny the details of local formats and rules.
This extension also provides the same functionality through the PECL module for PHP 5.2.
The extension is based on the ICU library provided by IBM
The Problems
The most frequently encountered problem when bringing an application to non-English users is not necessarily translating the text displayed by the application, but doing things like:
- Sorting textual data according to local rules.
- Displaying numbers. Characters used to represent number properties (sign, decimal point, thousand separator) vary widely.
- Date and time formatting, whether using a different calendar or using a local format to represent a base calendar
- Displaying time in the local timezone, and dealing with users in multiple timezones.
- Representing money values and currencies.
- Displaying ordinal and cardinal numbers, i.e. numbers representing order (1st, 2nd) and quantity (1 error, 2 errors).
- Rendering parameterized strings — where the values are inserted in pre-existing templates, such as printf() — according to local grammar rules.
- Breaking text into letters, words and sentences according to local rules.
There are, of course, many other things to consider, but the problem areas listed above are those most frequently encountered by Web developers.
Note that none of these issues are related to the binary representation of text. They exist independently of the problem of handling various local encodings, Unicode texts and their representation. In this article, binary representation will almost never be mentioned, but most of the functions in PHP 5 assume UTF-8 input and will produce UTF-8 ouput.
one more way to solve problem described here
.
No comments:
Post a Comment