php-i18n Digest 2 Dec 2002 07:02:43 -0000 Issue 135

Topics (messages 359 through 363):

Re: Multiple Languages
        359 by: Moriyoshi Koizumi
        360 by: Carl W. Brown
        362 by: Steve Vernon

Re: is there any good PHP editor for Japanese?
        361 by: . Edwin

UTF-8 or multiple charsets on a page
        363 by: a.h.s. boy

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Take a look at http://www.php.net/manual/en/ref.gettext.php
This appears exactly what you are looking for, while your idea is as good.

Moriyoshi

"Steve Vernon" <[EMAIL PROTECTED]> wrote:

> Hiya,
>     I'm working on my first international PHP project, which is a site that
> displays differently in different languages. So I guess this is the place to
> ask adive.
> 
>     Ive done the code with flags etc so people can select the country and so
> the language. But im not sure about the best way to handle the text and
> things such as meta tages.
> 
>     My origional idea was to have multiple include files named like uk.php,
> french.php with seperate variables for the text parts, or do sommat in XML
> which is basically the same.
> 
>     I cant find any sources on the net about best ways to do a site like
> this.
> 
>     Help!
> 
>     Thanks,
> 
>     Steve
> 
> 
> -- 
> PHP Internationalization Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Steve,

A couple of years ago I developed extensions for PHP that sound like what
you want.  It used ICU http://oss.software.ibm.com/icu/ to provide the i18n
services for PHP.

First it also provided an override to the Apache mod_mime services to allow
it to work like other web servers and allow you to put different language
web pages in different subdirectories rather than require a language type on
each page.  You can have it override just certain types such as .php pages
only.

This way you can have:

 ../site/en/contents/page.php
 ../site/fr/contents/page.php

or full locales

 ../site/en-uk/contents/page.php
 ../site/en-us/contents/page.php
 ../site/en-ca/contents/page.php
 ../site/fr-fr/contents/page.php
 ../site/fr-ca/contents/page.php

It sets the locale on a per transaction bases.  It will not only work with
Unicode with ICU but it will also work in code pages.

You can have a terminal using Shift-JIS and Japanese pages in EUC and access
a UTF-8 database.  The same code will work with any code page or Unicode.

You can see code that I derived from the ICU interface portion of the code
at http://www.xnetinc.com/xiua/

The PHP changes also included a way to support charset more dynamically.

Carl








> -----Original Message-----
> From: Steve Vernon [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, November 24, 2002 7:20 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-I18N] Multiple Languages
>
>
> Hiya,
>     I'm working on my first international PHP project, which is a
> site that
> displays differently in different languages. So I guess this is
> the place to
> ask adive.
>
>     Ive done the code with flags etc so people can select the
> country and so
> the language. But im not sure about the best way to handle the text and
> things such as meta tages.
>
>     My origional idea was to have multiple include files named
> like uk.php,
> french.php with seperate variables for the text parts, or do sommat in XML
> which is basically the same.
>
>     I cant find any sources on the net about best ways to do a site like
> this.
>
>     Help!
>
>     Thanks,
>
>     Steve
>
>
> --
> PHP Internationalization Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--- End Message ---
--- Begin Message ---
Hmmmm,
    This seems to be harder than I thought!

    Thanks everyone for there help!

    Carl this IBM international thing is very interesting, and many thanks
for telling me about it. Just think it is a lot of work, especially since I
want my site to be on in January, not sure I can manage this with my other
tasks. I will try and research it and maybe use it in the future.

    Im probably going to use the Get Text, that Moriyoshi mentioned. Thanks!

    Basically Im an ameture at this international stuff, Iv'e never worked
on an international project and no idea where to start. I could really do
with some advice.

    I am hosting my site in Germany, and need to know what to tell the
server admin people. What should I tell them about MySQL and Apache and PHP
set up please (on linux).

    And for my website, I assumed that you just alter the doctype say from
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN"> (im using 3.2 but had
this to hand!) to the equivalent French one. Is this wrong? Do I need to
specfy character sets and encoding??

    Many Thanks,

    Steve

> Steve,
>
> A couple of years ago I developed extensions for PHP that sound like what
> you want.  It used ICU http://oss.software.ibm.com/icu/ to provide the
i18n
> services for PHP.
>
> First it also provided an override to the Apache mod_mime services to
allow
> it to work like other web servers and allow you to put different language
> web pages in different subdirectories rather than require a language type
on
> each page.  You can have it override just certain types such as .php pages
> only.
>
> This way you can have:
>
>  ../site/en/contents/page.php
>  ../site/fr/contents/page.php
>
> or full locales
>
>  ../site/en-uk/contents/page.php
>  ../site/en-us/contents/page.php
>  ../site/en-ca/contents/page.php
>  ../site/fr-fr/contents/page.php
>  ../site/fr-ca/contents/page.php
>
> It sets the locale on a per transaction bases.  It will not only work with
> Unicode with ICU but it will also work in code pages.
>
> You can have a terminal using Shift-JIS and Japanese pages in EUC and
access
> a UTF-8 database.  The same code will work with any code page or Unicode.
>
> You can see code that I derived from the ICU interface portion of the code
> at http://www.xnetinc.com/xiua/
>
> The PHP changes also included a way to support charset more dynamically.
>
> Carl
>
>
>
>
>
>
>
>
> > -----Original Message-----
> > From: Steve Vernon [mailto:[EMAIL PROTECTED]]
> > Sent: Sunday, November 24, 2002 7:20 AM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP-I18N] Multiple Languages
> >
> >
> > Hiya,
> >     I'm working on my first international PHP project, which is a
> > site that
> > displays differently in different languages. So I guess this is
> > the place to
> > ask adive.
> >
> >     Ive done the code with flags etc so people can select the
> > country and so
> > the language. But im not sure about the best way to handle the text and
> > things such as meta tages.
> >
> >     My origional idea was to have multiple include files named
> > like uk.php,
> > french.php with seperate variables for the text parts, or do sommat in
XML
> > which is basically the same.
> >
> >     I cant find any sources on the net about best ways to do a site like
> > this.
> >
> >     Help!
> >
> >     Thanks,
> >
> >     Steve
> >
> >
> > --
> > PHP Internationalization Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
>
> --
> PHP Internationalization Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Hello,

"Nanae" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello all,
>
> Hello, I'm very new to PHP.
>
> I've heard that PHPEdit is free and has nice features, so I downloaded and
> play around it; however, it shows only some of Japanese character, so I
gave
> up using that editor.

What do you mean by "shows only some of Japanese"? Did you change the editor
fonts?

> What is a good editor for developing a japanese website with PHP/Perl?

If you have change the fonts and if you're using shift-jis, PHPEdit has no
problem at all.

Anyway, you can also look at

  http://www.jedit.org/ (Very popular in many platforms.)

Or,

  http://www.vim.org/ (Very popular even for SysAdmins. Needs some getting
used-to though esp. if you're not a SysAdmin and not coming form a *nix
background.)

- E
--- End Message ---
--- Begin Message --- In the process of designing a web-based publishing system that is internationalized using gettext() calls, I've run into some odd problems with the display and proper charset when there are multiple languages on a page. Here's the background:

My default charset (declared in content-type meta tag) is iso-8859-1. On the page, there is a language popup that allows users to change to any number of languages, including Greek (iso-8859-7) and Turkish (iso-8859-9). Switching to a different language changes PHP's locale settings, and also changes the META tag charset. You're welcome to poke and prod it at http://dev.dadaimc.org/.

Users input text into a form for publication. The form declares "accept-charset=" and defaults to iso-8859-1, windows-1252, utf-8, and then whatever charsets are used by available languages (e.g. iso-8859-7 and -9). The text is stored in a MySQL database (default charset iso-8859-1).

I can successfully input English, Turkish, and Greek text. And when a viewer selects "Turkish" from the language menu, the Turkish text displays fine (because META tag is set to "iso-8859-9"). The same applies to English and Greek. However, on a page which displays all three texts -- one in each language -- only one of the three will display properly (whichever one corresponds to the currently selected language). Obviously inconvenient.

I visited another site -- http://www.indymedia.org/ which also displays multiple languages on the same page. It uses "utf-8" in the META tag (which makes sense, since it encompasses all the necessary characters). The publishing form it uses declares no accept-charset parameter. But it works!

When I tried using "charset=utf-8" in my META tag, the text displays worse than before -- lots of unprintable characters.

So I'm wondering if anyone knows the magic incantation that brings this all together -- how do I get my 3 texts in English, Greek, and Turkish to ALL display properly on the page at the same time?

It can't be a simple META tag set to utf-8...that didn't work.
Is the problem in the input method? The database storage method? The display method?
Do I need to accept-charset=utf-8 ONLY on my input form?
Does the page charset on the page containing the input form need to be utf-8?
Does the database need to default to using utf-8 for storage? (It doesn't seem to be supported).

Please help!

Cheers,
spud.

-------------------------------------------------------------------
a.h.s. boy
spud(at)nothingness.org "as yes is to if,love is to yes"
http://www.nothingness.org/
-------------------------------------------------------------------

--- End Message ---

Reply via email to