Php uses gettext for internationalization! I used to come in and discuss it ~~ My Environment: ubuntuserver + xampp php code is output in simplified Chinese. now I want to convert the output of simplified Chinese to English or traditional Chinese. Use gettext. Php uses gettext for internationalization! I used to come in and discuss it ~~
My Environment: ubuntu server + xampp suite
The output in php code is output in simplified Chinese. now we need to convert the output in simplified Chinese to English or traditional Chinese.
Use gettext.
Symptom: conversion fails!
However, if you replace Chinese with English characters in the code, update it in the. po file, and generate the. mo file, the conversion will be normal!
That is to say, when the string to be converted in the po file is Chinese, it cannot be converted!
That is, Chinese -- other languages, not successful!
English -- other languages, you can succeed !!
Let's discuss why ?!
------ Solution --------------------
:
Http://sourceforge.net/projects/gnuwin32/files/gettext/0.14.4/gettext-0.14.4-src.zip/download
PHP code
Step 1: Write a PHP program
Step 2: xgettext.exe-d test-l php -- from-code = UTF-8 index. step 3: modify test. po :#:.. /index. php: 8 msgid "Hello! "Msgstr" Hello! "#: ../Index. php: 9 msgid" World! "Msgstr" world! "#: ../Index. php: 10 msgid" Hello World! "Msgstr" Hello, world! "Step 4: msgfmt-o zh_CN/test.mo zh_CN/test. step 5 of po generation test.mo File: create the locale \ zh_CN \ LC_MESSAGES directory and put test.mo in this directory Step 6: restart apache and Access index. php to see the effect
------ Solution --------------------
Try UTF-8 encoding