How to use gettext to achieve internationalization in PHP?

WBOY
Release: 2016-07-06 13:51:48
Original
722 people have browsed it

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

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!