Re: Multi-language support for PHP
| From: | Carl W. Brown | Date: | Tue, 06 Jun 2000 04:04:54 +0000 |
| Subject: | Re: Multi-language support for PHP | ||
| References: | 1 2 | Groups: | php.i18n |
| Request: | Send a blank email to php-i18n+get-13@lists.php.net to get a copy of this message | ||
James,
I first thought that I would have the application set the locale. The probl
em that I had was that some browsers such as Netscape are still code page-lo
cked because they can not always select the proper fonts. Charset is set wh
en the headers are written which is before the PHP script gains control.
Even IE 5 ships in the Far East with local code page defaulted because UTF-8
adds too much overhead when sending extended character sets. The response t
imes suffer.
I would love to go to utf-8 but there are still reasons to support code page
s.
BTW I just added full code page to utf-8 support for scripts and a utf-8 str
ing character counter. I also added code page to utf-16 and utf-16 to utf-
8 conversion for both data blocks and strings for internal PHP routines.
Applications that are written as DLs can use the full ICU API as well.
Carl
"James Byers" <jbyers@valinux.com> wrote in message news:Pine.LNX.4.04.10006
041207160.19348-100000@silicon.su.valinux.com...
> Carl,
>
> The work you've done sounds very interesting. As Rasmus
> mentioned, a few different groups are working on I18N for PHP. I'm
> leading a development effort at VA Linux to add Unicode support to PHP4.
> We're just about done with our planning process; I hope to have a proposal
> to post on the list by tomorrow.
>
> Our plan, in essence, is to modify PHP's string functions to take
> UTF-8 inputs, perform an internal conversion to UCS2/4, manipulate the
> string, and return the result back in UTF-8.
>
> This leaves a few gaps, notably:
>
> - character set conversion (handled by PHP's recode extension)
> - full locale support (extending setlocale's affected functions to handle
> all LC_ categories)
> - run-time codepage conversion for file i/o, etc. functions
> - scripts in any character set that respects ASCII in SBCS and MBCS modes
> (requires script pre- and post-processing to convert to and from UTF-8)
>
> It sounds as though you've addressed a lot of these issues
> already. Perhaps we can come up with a unified locale-setting system so
> setlocale() and friends fit in with your (X)ICU functions. It would also
> be a great win to get away from the platform and installed-locale
> dependencies of setlocale().
>
> I'm not sure about how the directory mapping you mention would fit
> into PHP-space. This seems like an extension of Multiviews / mod_rewrite,
> where Apache would parse the URI and present PHP with locale information
> by environment variable. In any case, I think PHP developers should be
> able to set language/locale/codepage independent of URI.
>
> Between these two efforts (Unicode and ICU functionality), I think
> we can provide all the building blocks developers need. I'd be very
> interested to see the code you've worked on and list of functions visible
> in PHP. I'll post our proposal as soon as I can so you can see where we're
> going.
>
> Thanks,
> James
>
> On Sun, 4 Jun 2000, Carl W. Brown wrote:
>
> > I am working on a PHP3 module that adds Multi-lingual support to PHP. I
t al
> > lows you to write scripts in different languages and support different l
ocal
> > es. (More than 80)
> >
> > You can write scripts using different character sets. It selects the ch
arac
> > 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 cas
e st
> > ring converters.
> >
> > The date/time routine supports 6 formats: full, long, medium, short, dat
e on
> > ly, and numeric date. The order of fields separator characters , the da
y 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 t
he 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 conve
rted
> > them to an Apache module. I am talking to them about contributing my c
hang
> > 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 applicatio
n.
> > 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 applic
atio
> > ns. It sets the locale and default character set in the per directory c
onfi
> > guration records. It sets the locale environment for ICU and builds the
ICU
> > code converter objects (if needed) for each transaction. It also provid
es 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 aft
er 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 PH
P4 p
> > roduct? It does not look like this should be too difficult.
> >
> > Carl
> >
>
>
>
>
>
>
> --
> PHP Internationalization Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-i18n-unsubscribe@lists.php.net
> For additional commands, e-mail: php-i18n-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>