Revision [522]

Last edited on 2007-05-14 04:33:39 by WikiAdmin
Additions:
{{image url="images/english.png"}}
{{image url="images/chinese.png"}}


Revision [521]

Edited on 2007-05-14 04:30:38 by WikiAdmin
Additions:
My messages.po file for traditional chinese
%%(text;messages.po)
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR , YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2007-05-14 19:04+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME \n"
"Language-Team: LANGUAGE \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: test.php:23 test.php:35
msgid "English"
msgstr "英文"
#: test.php:25
msgid "Chinese"
msgstr "中文"
#: test.php:28
msgid "Malaysia"
msgstr "馬拉文"
#: test.php:31
msgid "Thailand"
msgstr "泰文"


Revision [520]

Edited on 2007-05-14 04:28:45 by WikiAdmin
Additions:
header('Content-Type: text/html; charset=utf-8');
if (isset($_GET['lang'])) {
$language = $_GET['lang'];
} else {
$language = "en_EN";
}
$locale = setlocale(LC_ALL, $language);
$gettext_domain = 'messages';
bindtextdomain($gettext_domain, "./locale");
textdomain($gettext_domain);
?>














Deletions:
...


Revision [519]

Edited on 2007-05-14 04:27:27 by WikiAdmin
Additions:
1. Install gettext
2. Make sure php has gettext support
3. Create a directory structure like the following:
%%
test.php
locale
en_US
LC_MESSAGES
zh_TW
LC_MESSAGES
%%
Test.php should look like this
%%(php)
...
%%
Now run this to generate a messages.po and a messages.mo file:
%%(bash)
xgettext -n *.php
vi messages.po #enter the translation text, assuming chinese traditional
msgfmt messages.po
cp messages.* zh_TW/LC_MESSAGES/
%%
Now just point your browser to test.php, choose between languages and you should see chinese.


Revision [518]

The oldest known version of this page was created on 2007-05-14 04:22:49 by WikiAdmin
Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki