Home >Backend Development >PHP Tutorial >How to use gettext to achieve internationalization in PHP?

How to use gettext to achieve internationalization in PHP?

WBOY
WBOYOriginal
2016-07-06 13:51:48737browse

DEMO project structure

How to use gettext to achieve internationalization in PHP?

Problem Description

When I set the value of the variable $lang to zh_CN, the text corresponding to zh.CN.mo in the zh_CN folder can be displayed normally, but when I change the value of $lang to ja_JP or en_US, the page will be output as is,

But when I move the ja_JP under the ja_JP.mo folder to the zh_CN folder and rename it to zh_CN.mo, I set the value of the variable $lang to zh_CN and the Japanese text can be displayed normally. , why?

Reply content:

DEMO project structure

How to use gettext to achieve internationalization in PHP?

Problem Description

When I set the value of the variable $lang to zh_CN, the text corresponding to zh.CN.mo in the zh_CN folder can be displayed normally, but when I change the value of $lang to ja_JP or en_US, the page will be output as is,

But when I move the ja_JP under the ja_JP.mo folder to the zh_CN folder and rename it to zh_CN.mo, I set the value of the variable $lang to zh_CN and the Japanese text can be displayed normally. , why?

It runs normally under Linux and does not display translation under Windows environment

How to use gettext to achieve internationalization in PHP?

The specific reason is unknown

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn