List of I18N implementation
| From: | Hironori Neal Sato | Date: | Fri, 16 Jun 2000 22:15:21 +0000 |
| Subject: | List of I18N implementation | ||
| Groups: | php.i18n | ||
| Request: | Send a blank email to php-i18n+get-20@lists.php.net to get a copy of this message | ||
Hi gangs
With help of Japanese PHP I18N team, I have listed suggestions for
Internationalization of PHP. This is merely a recommendation, so
go ahead, complain/suggest/laugh. James, is this list anything
close to what you got planning?
I have to admit, almost all of these ideas came from Java. It's safe
to say that they are well ahead of anyone in terms of I18N, and we
can learn alot from Java's effort. In the list below, I have listed
equivalent Java class for reference.
Two main points to Internationalizing PHP.
1) provide PHP users with tools for internationalizing their scripts
2) provide APIs for PHP developers to easily internationalize their module
With these two points in mind, here are items we need to consider. Notice,
many of these still require to be refined and have details worked out.
---------------------------------------
o Locale
- identifier for particular combination of language and region
- should not assign global locale, but make available of default locale
- how should PHP implement this?
- Java: java.util.Locale
o Resource
- two parts: resources within PHP and resources for PHP scripts
- 1) localized PHP error/warning message resource management
-> separate settings for HTTP output and log file?
- 2) allow script programmer to group resources by locale
- in both case, dettach resource definitions from core program
- Java: java.util.ResourceBundle
o Format
- locale specific formatting of data output
- Date, Message, Number, etc...
- Java: java.text.[Format | DateFormat | NumberFormat | MessageFormat]
o Locale specific String Manipulation
- collation, text iterator
- most PHP string functions needs to be modified
- possibly new string operation based on ICU
- should we modify regex and/or PCRE?
- Java: java.text.Collator, java.text.BreakIterator
o Conversion
- on-demand encoding convertor for script programmer
- char and/or byte base I/O stream convertor?
o I/O Encoding Handler
- source code encoding
-> some front end to convert script encoding before parsing by Zend
-> consistently use UTF-8 internally (good for compiled code)
- http input requires detection and conversion of encoding
- configurable output of non UTF-8 encoding via http
- encoding auto detection routine for all I/O
- ability to add user defined custom conversion
- independ module may require to use specific encoding instead of UTF-8
-> eg. MySQL. need encoding convertor API for these modules?
- java.io.[InputStream | OutputStream], java.io.[Reader | Writer]
o Data Types
- how does Zend handle data type?
- APIs for internal data handling?
- java.lang.character
---------------------------------------
ICU already contain most of mechanism for above implementations. Rui
mentioned Li18nux member recommended the use of ICU. I also agree, ICU
can definitely save our time. I'm looking forward to see Carl's work.
Also, Rui recommended using Mozilla International Library. I haven't
look at their code yet, but they do have extensive list of auto detection
of encoding and encoding convertors. As long as license allows us to
use it for PHP, we should take a look at their library.
Whatever the aproach we use to Internationalize PHP, we have alot
of work. What we may need to do now is to list every possible I18N
implementation now, then priotize what we can do now.
At last, I am no expert in I18N, and admit that everyday is learning
process for me. So, feel free to critisize my comment!
Hiro
---------------------------------------
Here are references that I used:
[1] Perl, Unicode and I18N FAQ
http://rf.net/~james/perli18n.html
[2] Non-western Character sets, Languages, and Writing Systems by W3C
http://www.w3.org/International/
[3] How to make a Multilinugal Web server
http://vancouver-webpages.com/multilingual/howto.html
[4] i18N: HTML Character set issues beyond HTML 3.2
http://ppewww.ph.gla.ac.uk/~flavell/charset/
[5] Java 2 SDK, Internationalization by SUN
http://java.sun.com/j2se/1.3/docs/guide/intl/index.html
[6] Programming for Internationalization FAQ
http://www.cs.ruu.nl/wais/html/na-dir/internationalization/programming-faq.html
[7] Java Internationalization & Multilingualization (Japanese)
http://www.ingrid.org/java/i18n/
[8] Mozilla Internationalization & Localization Guidelines
http://www.mozilla.org/docs/refList/i18n/
[9] International Components for Unicode by IBM
http://oss.software.ibm.com/icu/
--
Hironori Neal Sato <satoh@yyplanet.com>
Japanese Network - http://www.jpnnet.com/