js gettext

test.php
1
<?php 2 $locale='zh_CN'; 3 if(isSet($_GET["locale"]))$locale = $_GET["locale"]; 4 ?> 5 <html> 6 <head> 7 <link rel="gettext" type="application/x-po" href="./locale/<?php echo $locale ?>/LC_MESSAGES/messages.po" /> 8 <script type="text/javascript" src="Gettext.js"></script> 9 <script type="text/javascript" src="jquery-1.8.2.min.js"></script> 10 <script type="text/javascript" > 11 window.onload = function init(){ 12 var gt = new Gettext({ 'domain' : 'messages' }); 13 $('#hw').html(gt.gettext('Hello world')); 14 } 15 </script> 16 </head> 17 <body> 18 <span id='hw'>Hello world</span> 19 </body> 20 </html>
1 messages.po
2 
3 #: /var/www/zjtest/test.php:18
4 msgid "Hello world"
5 msgstr "こんにちは世界"

posted @ 2013-06-18 15:43  尹少爷  阅读(2177)  评论(0编辑  收藏  举报