Re: Multi-language support for PHP
| From: | Rasmus Lerdorf | Date: | Sun, 04 Jun 2000 19:05:38 +0000 |
| Subject: | Re: Multi-language support for PHP | ||
| References: | 1 | Groups: | php.i18n |
| Request: | Send a blank email to php-i18n+get-8@lists.php.net to get a copy of this message | ||
Carl, you can get a CVS account and submit your changes yourself, but
there are a couple of other people working on stuff related to this, so it
would be a good idea to hash it out on this list and get a concensus for
how it should be done. It sounds like you are further ahead than anybody
else so it may just be a matter of everyone understanding exactly what you
have done and then using that as a base.
One note, the /en-us/ directory naming style which triggers the different
locales in your setup is very similar to the built-in Apache Multiviews
feature. Have you looked at that at all? It would be cool if the
browser's Accept-Language header setting could also be used to trigger the
correct locale. With Multiviews you would create files like:
test.php3.en
test.php3.kr
test.php3.es
and then when people configure their browsers to define the language
preference order which results in the browser sending a header like:
Accept-Language: kr en
Multiviews ends up selecting the test.php3.kr file when the browser
requests test.php3
-Rasmus
On Sun, 4 Jun 2000, Carl W. Brown wrote:
> 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
>
>
>
>
>
>