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 "こんにちは世界"

js gettext

相关文章:

  • 2021-10-12
  • 2021-08-17
  • 2021-07-18
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2022-01-06
猜你喜欢
  • 2021-08-03
  • 2021-07-07
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-25
相关资源
相似解决方案