<?php
header("Content-type: text/html; charset=utf-8");
$lng = $_GET['lng'] ? $_GET['lng'] :'zh_TW';
$domain = 'test';
putenv('LANG='.$lng);
setlocale(LC_ALL, $lng); // 指定要用的语系,如:en_US、zh_CN、zh_TW
bindtextdomain($domain, '/home/dfct/test');
bind_textdomain_codeset($domain, 'UTF-8');
textdomain($domain);
//($_ENV);
// E:/wwwroot/test/zh_TW/LC_MESSAGES/test.mo
echo _("中文");
E:\wwwroot\test\en_US\LC_MESSAGES\test.mo
生成po 和pot文件用 poedit 比较方便