Multi-language support for PHP
| From: | Carl W. Brown | Date: | Sun, 04 Jun 2000 17:48:36 +0000 |
| Subject: | Multi-language support for PHP | ||
| Groups: | php.i18n | ||
| Request: | Send a blank email to php-i18n+get-7@lists.php.net to get a copy of this message | ||
I am working on a PHP3 module that adds Multi-lingual support to PHP. It al
lows you to write scripts in different languages and support different local
es. (More than 80)
You can write scripts using different character sets. It selects the charac
ter sets automatically based on the file directory and user configurable def
ault browser codepages.
/en-us/test.php3 will show US settings
/ko-kr/test.php3 will show Korean settings
/xxxx/pt-br/zzzzz/test.php3 will show Brazilian settings
It supports date/time, number, currency & percent formats. It supports 4 l
evels of culturally correct compares. It has upper, lower and title case st
ring converters.
The date/time routine supports 6 formats: full, long, medium, short, date on
ly, and numeric date. The order of fields separator characters , the day na
mes, month names and abbreviations are all locale dependent.
For example the following evaluates to true in en-us:
if (intl_collate("Black-bird","==?","blackbird "):
intl_collate will handle things like French collating sequence, Spanish lett
ers like ch & ll etc. it will normalize the text and allow you to match on l
etters only, case insensitive, case sensitive or exact.
The case converter handles converting the German sharp-s to "SS" fixes the G
reek ending sigma and handles the Turkish dotted and dotless i depending on
locale.
It will work either in code-page or with UTF-8 scripts.
Currently it is only working with Apache Unix systems.
I have taken the IBM ICU (International Components of Unicode) and converted
them to an Apache module. I am talking to them about contributing my chang
es an integrating them into ICU. This makes ICU plus my ICU extensions (XIC
U) available to Apache applications other than PHP as well.
The international extensions to PHP3 are a different class of application.
They are linked with the XICU DSO but they are handled by PHP almost as a re
sident module.
This application provides services to mod_php.c, main.c and other applicatio
ns. It sets the locale and default character set in the per directory confi
guration records. It sets the locale environment for ICU and builds the ICU
code converter objects (if needed) for each transaction. It also provides f
ull Unicode and UTF-8 converters for applications.
This could also be made to support CGI because it uses a special linking pro
cess that should be NT compatible.
The per dir configuration code is not working with PHP3 on Apache now so I h
ad to implement a work around. Any changed made to global variables after t
he initial settings are discarded. and the configuration merge code in mod_
php3.c is never call by Apache.
Who should I contact to coordinate efforts to integrate this into the PHP4 p
roduct? It does not look like this should be too difficult.
Carl