I want to start using gettext to handle my translations on web projects (PHP 5). Since it is a widely used standard with a good reputation it seems to be the best choice.
However, I'm also hearing things about server incompatibly and it being non-thread-safe. What does this mean for my projects that use it then? Since I build things that many people use, it's very important that my code works.
Are we talking about minor problems (like people still using PHP 4) or major problems like distribution and installation of gettext on websevers being low?
I think play some more with the php manual comments portion should revile more information....one of the comments from the manual on gettext section
http://www.php.net/manual/en/gettext.setup.php
Threads problem only apply if one uses embedded PHP (Apache's mod-php for example) and runs server that uses threads (like Apache server with worker-mpm).
So - thread safety issue does not apply to you if:
So - most people with default Apache install shouldn't worry about gettext not being thread safe, as default apache's install in most distro's uses non-threaded prefork-MPM!
P.S. also - keep in mind that Apache on Windows is threaded.
I had same problem with PHP 5.6.30 VC11 Theard Safe on Windows 10. Workaround found and fix this issue here by sirio3mil.
Apparently PHP with TS can access only Locale language folder. So when setlocale and putenv function is call with another language than system's one, folder with .mo and .po cannot be read.
Workaround is to have only one language folder with system language and multiple pairs of .mo/.po files for each translated languages. Domain will be set with wanted language.
Example with Swiss French, German and Italian:
Folder structure
Code