- 论坛徽章:
- 0
|
目录结构:
- hello.php
- i18n
- |--zh_CN
- |--LC_MESSAGES
- |--- amp.po
- |--- amp.mo
复制代码
源码hello.php (文件编码utf-8):
- <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <?
- define("PKG","hello");
- putenv("zh_CN");
- setlocale(LC_MESSAGES,"zh_CN");
- bindtextdomain(PKG,"./i18n");
- textdomain(PKG);
- echo gettext("hello,world");
- echo "<br> super man kanaka";
- echo "<br>我爱小甜饼";
- ?>
复制代码
源码amp.po (文件编码utf-8)
- # 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 <EMAIL@ADDRESS>, YEAR.
- #
- msgid ""
- msgstr ""
- "Project-Id-Version: PACKAGE VERSION\n"
- "Report-Msgid-Bugs-To: \n"
- "POT-Creation-Date: 2005-12-29 06:52-0500\n"
- "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
- "Language-Team: LANGUAGE <LL@li.org>\n"
- "MIME-Version: 1.0\n"
- "Content-Type: text/plain; charset=UTF-8\n"
- "Content-Transfer-Encoding: 8bit\n"
- #: hello.php:7
- msgid "hello,world"
- msgstr "你好,世界"
复制代码
httpd的配置中注释掉AddDefaultLanguage,php.ini中默认的就已经注释掉default-language = iso-8859-1.
也曾试过多种默认语言配置组合,均告失败。上述源码均经过iconv转码为utf-8。
[ 本帖最后由 sniper 于 2005-12-30 11:15 编辑 ] |
|