php-gettext

Use PHP Gettext without having to install locales

a 夏天 提交于 2019-12-03 12:20:51
I've been looking at options for internationalizing an open source project: Gettext, which everyone seems to recommend, apparently needs locales to be "installed on your system" to be used. See this note on the PHP manual, which reflects exactly my situation. This SO question also asks about the same problem. This isn't suitable for an open source project because I can't trust that the end users have the appropriate locales installed on their system. Besides, it's very very weird that you have to install locales just to use strings that you've translated (IMO). Zend_Translate is also

Online editing gettext files? [closed]

﹥>﹥吖頭↗ 提交于 2019-12-03 11:11:04
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Online editing gettext files, is it possible? I use gettext for all my PHP projects, but sides with a minor problem, want to mine user may translate my language from as Danish to Norwegian, but in this case it enste I know is that I need to export my file from Poedit there is any. other software that can export

Online editing gettext files? [closed]

寵の児 提交于 2019-12-03 01:36:15
Online editing gettext files, is it possible? I use gettext for all my PHP projects, but sides with a minor problem, want to mine user may translate my language from as Danish to Norwegian, but in this case it enste I know is that I need to export my file from Poedit there is any. other software that can export / import my files? for Poedit can I do with export as. hope i could help me a little. I used SimplePo recently, works great. You need to export the edited .po file then use command line gettext tools or POEdit to build .mo. This question is high on Google and the answer is a little

PHP gettext doesn't works

廉价感情. 提交于 2019-12-02 03:20:54
问题 Apache 2.4 + PHP 5.5 putenv('LC_ALL=ru_RU'); setlocale(LC_ALL, 'ru_RU'); bindtextdomain('mydomain', '/absolute/path/to/messages'); textdomain('mydomain'); I'm absolutely sure, than I've mydomain.po and mydomain.mo files in /absolute/path/to/messages/ru_RU/LC_MESSAGES/ . Also I gave these files to my colleague on OS X Maverics - worked fine. I can't make php gettext working. I've googled/stackoverflowed for about couple of hours, tried various solutions - still not working. What I do wrong? I

PHP gettext doesn't works

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 01:25:26
Apache 2.4 + PHP 5.5 putenv('LC_ALL=ru_RU'); setlocale(LC_ALL, 'ru_RU'); bindtextdomain('mydomain', '/absolute/path/to/messages'); textdomain('mydomain'); I'm absolutely sure, than I've mydomain.po and mydomain.mo files in /absolute/path/to/messages/ru_RU/LC_MESSAGES/ . Also I gave these files to my colleague on OS X Maverics - worked fine. I can't make php gettext working. I've googled/stackoverflowed for about couple of hours, tried various solutions - still not working. What I do wrong? I restart apache every time I change something to ensure gettext files is being reloaded. Here is my

Can't get gettext (php) on Ubuntu working

强颜欢笑 提交于 2019-11-30 01:59:29
The following example works on Mac OS X with Apache, i.e. I get the translated string echoed back. But on Ubuntu with lighttpd I get the original text 'Inactive account'. I've tried all sorts of combinations of environment varialbes without any luck. It's not file permissions either because I can echo out the contents of the .mo file. <?php //$locale = 'sv_SE.UTF-8'; $locale = 'sv_SE'; $dir = dirname(__FILE__); // File permission is apparantly not a problem as this works... //echo file_get_contents($dir . '/sv_SE/LC_MESSAGES/flattr.mo'); putenv("LANG=$locale"); putenv("LANGUAGE=$locale");

How to clear php's gettext cache without restart Apache nor change domain?

只愿长相守 提交于 2019-11-26 16:33:43
问题 This is a little code snippet from php manual: putenv('LC_ALL=zh_CN'); setlocale(LC_ALL, 'zh_CN'); bindtextdomain('domain', './locale'); textdomain('domain'); echo gettext('Hello'); Which will output 你好 as defined in domain.mo file, but the problem is as long as the Apache is running, gettext() always return the cached result. If I change the translation of Hello to 您好 in domain.mo , it will still output 你好 . However there is a fix for this by changing the domain argument of bindtextdomain()