Posts Tagged ‘gettext’

I’d like to share my favorite xgettext command to scan recursively the entire folder and its sub folders.
xgettext -o ../script.pot --from-code=utf-8 --keyword=_t --width=300 --no-wrap $(find . -name "*.php") |
You may want to remove unnecessary parameters like –keyword=_t (I use my own _t() instead of _()), –width=300 really not necessary, and –no-wrap, useful for me to write my own .po file parse. In my case, I need to convert it in array.

I need to run xgettext to parse gettext string with my osx. Although osx is build based on BSD a unix variant, it is not easy to get gettext and other gnu tools running on osx.
…until I discover FINK. If you familiar with apt-get in ubuntu, then I feel that fink is something similar.
If you use snow leopard, you should download and compile it yourself, perhaps you need xcode .. or gcc .. haha … don’t ask me how. Fortunately I use leopard, so I use binary package in .dmg file
After fink installed, open terminal and type
fink install gettext-tool |
Enter your osx password when it ask for password. After installation finished, you can use xgettext and msgfmt as usual.
