Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
684 views
in Technique[技术] by (71.8m points)

php - How to install gettext on MacOS X

How do I install gettext on mac?

I get this error on one of my php pages:

Fatal error: Call to undefined function bindtextdomain()

and it's because I don't have gettext installed.

I can't find good instructions on how to install it. I've tried using:

brew install gettext

and it puts some files here:

/usr/local/Cellar/gettext/0.18.2

but I don't know what to do with that.

Update: Instead of trying to use homebrew, now I tried this method unsucessfully using wget:

Download with wget

cd ~/Downloads
wget http://ftp.gnu.org/gnu/gettext/gettext-0.18.2.tar.gz
tar -zxvf gettext-0.18.2.tar.gz
cd gettext-0.18.2
./configure
make

make check is optional to run self-tests

make check

Errors I got:

make[3]: *** [check-TESTS] Error 1

make[2]: *** [check-am] Error 2

make[1]: *** [check-recursive] Error 1

sudo make install

That installs it here: /usr/local/share/gettext

And the documentation here: /usr/local/share/doc/gettext

but how do I make my php pages be able to use gettext and the bindtextdomain() function?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can use brew to link gettext after installing it

brew install gettext
brew link --force gettext

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...