Chinese support of gallery?

bpeng2000

Joined: 2002-12-06
Posts: 26
Posted: Sat, 2002-12-21 04:53

Hi,

Has anyone done anything to internationalize gallery? I can try to find all strings and translate them to Chinese but there is one problem left:

In a form, if I enter Chinese, post, the display is wrong. For example, in the set up page, I enter the gallery name in Chinese, the title will not be displayed correctly. (I used correct browser encoding.)

I know this is a php related question but I am wondering if anyone has experience in it. Thank you very much in advance.

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3473
Posted: Sat, 2002-12-21 07:13

Hello. Gallery 1.x's rigid code was never intended to be translated easily (Gallery started as a much more modest endeavour!). But you can probably get it working. Perhaps you can add this PHP at the very very very top of your pages, before the <html> tag:

<?php
header("Content-Type: text/html; charset=_______");
?>

and then fill in whatever charset you need... GB2312, BIG5, etc. for your specific charset.

Gallery 2 already has implemented complete internationalisation using the GNU gettext API for native language support (though your server will have to have GNU gettext installed and your PHP will have to be compiled --with-gettext). Though it seems there's someone who's at least started doing a Chinese (simplified) translation, I'm sure your assistance would be most welcome if you're interested in helping to get Gallery 2 translated into Chinese in the weeks to come. Let us know. :smile:

Good luck with getting Gallery 1 going though!
-Beckett (

)

 
bpeng2000

Joined: 2002-12-06
Posts: 26
Posted: Sat, 2002-12-21 16:05
Quote:
Gallery 1.x's rigid code was never intended to be translated easily

Maybe I will just wait for Gallery 2. I already set everything up in English and I was just trying to introduce gallery to some of my Chinese friends.

Quote:
<?php
header("Content-Type: text/html; charset=_______");
?>

I add this to the top of albums.php but I am wondering if I need to add this to every single php file.

Quote:
I'm sure your assistance would be most welcome if you're interested in helping to get Gallery 2 translated into Chinese in the weeks to come. Let us know. :smile:

When will gallery 2 due? I will be super busy till January and would be happy to help after that.

The only thing left is the php/input/post/Chinese problem. I may just table it and see if gallery 2 can solve it.

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3473
Posted: Sat, 2002-12-21 16:17
Quote:
I add this to the top of albums.php but I am wondering if I need to add this to every single php file.

Add it at the bottom of init.php. That file is called on every Gallery page.

Quote:
When will gallery 2 due? I will be super busy till January and would be happy to help after that.

There's no rush. Gallery 2 is still months from being due, but I think anyone who's interested can get translating fairly soon. So check back in January. :smile:

Quote:
The only thing left is the php/input/post/Chinese problem. I may just table it and see if gallery 2 can solve it.

Gallery 2 will solve it! :wink:

 
bpeng2000

Joined: 2002-12-06
Posts: 26
Posted: Sat, 2002-12-21 17:46
Quote:
Add it at the bottom of init.php. That file is called on every Gallery page.

This seems to be working at first but this header interfere with many other
header("Location...) and makes lots of trouble. I am not that familiar with php to let two headers co-exist.

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3473
Posted: Sat, 2002-12-21 18:02

Oh right. I forgot about those header("Location... bits (they're just redirects).

Hmm. Okay. Yeah. You'll want to put it in in front of every <html> tag then, =/
grep -d skip "<html>" * should give you a list.

 
bpeng2000

Joined: 2002-12-06
Posts: 26
Posted: Sun, 2002-12-22 01:39
Quote:
You'll want to put it in in front of every <html> tag then, .

Noop. I add it to albums.php. The first display is OK, then, after I go back rom somewhere else, I get:

Warning: Cannot add header information - headers already sent by (output started at /var/www/html/gallery/albums.php:32) in /var/www/html/gallery/albums.php on line 67

I tried to use <META ... > but that did not work either.

 
bpeng2000

Joined: 2002-12-06
Posts: 26
Posted: Tue, 2002-12-24 06:57

I tried to solve this problem on the server side.

Strangely, the content type is consistently iso-8859 even after I set

AddType "text/html; charset=GB2312" php

at .hataccess. Since I can set the mime type for other extensions so I assume my .htaccess is working OK.

Finally, I have to modify conf/httpd.conf and set GB2312 as the default charset for the whole server. This is not exactly what I want but it is the best solution yet.

I would like to use .htaccess method if anyone can tell me why it does not work.

Thanks.

 
bpeng2000

Joined: 2002-12-06
Posts: 26
Posted: Wed, 2002-12-25 16:17

Hi All,

I finallly find out what I should do, which is simple enough:

put
php_value default_charset "GB2132"

This can be done on a directory basis so I do not have to worry about my non-Chinese pages.

Note:that /etc/httpd/conf/httpd.conf need to have this directory as
AllowOverwrite Options (or ALL)

As far as I can tell, the Chinese input and display are correct too.

 
bpeng2000

Joined: 2002-12-06
Posts: 26
Posted: Wed, 2002-12-25 16:20

Sorry, I missed something:

put
php_value default_charset "GB2312"

in the .htaccess file in /var/www/html/gallery , or any directory that need Chinese support.
This is also the directory that should be listed in httpd.conf with AllowOverwrite Options.