Questions tagged [php-gettext]

php-gettext is a library for emulating gettext (a widely used framework for internationalization) in PHP.

Gettext is a widely used framework for internationalization. The php-gettext library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

81 questions
4
votes
1 answer

php gettext directory structure on different environments

I'm using gettext for internationalization for my php files. I have two servers; a sandbox server and a release server. in sandbox server a directory like locale/LC_MESSAGES/en does not work and I should use locale/LC_MESSAGES/en_GB instead. But…
MKoosej
  • 3,405
  • 3
  • 21
  • 29
2
votes
1 answer

Docker PHP5.6 Call to undefined function bindtextdomain()

Problem: I have a Docker compose with an nginx service and a PHP service. When I try to open a page of my dev project, I encounter this error: Fatal error: Call to undefined function bindtextdomain() in…
darckcrystale
  • 1,582
  • 2
  • 18
  • 40
2
votes
1 answer

PhpMyAdmin Error 500 PHP-GETTEXT

I updated my server today and actually when i'm going to mywebsite.com/phpmyadmin/ => I got an error 500 Error.log: PHP Warning: require_once(): open_basedir restriction in effect. File(/usr/share/php/php-php-gettext/gettext.inc) is not within the…
pomme
  • 23
  • 1
  • 4
2
votes
1 answer

How can I use ngettext() of php-gettext when the singular and plural form are the same?

I'm using using library php-gettext to workaround the missing gettext extension on Google Cloud AppEngine. When the singular and plural form are the same in English, but different in other languages. ngettext("%d correct", "%d correct", $n) The…
Roel Vermeulen
  • 594
  • 7
  • 15
2
votes
1 answer

Syntax error in gettext.php library saying "unexpected '!=' (T_IS_NOT_EQUAL)"

I am using the library gettext.php (not the standard php_gettext extension) and the error PHP Parse error: syntax error, unexpected '!=' (T_IS_NOT_EQUAL) in /base/data/home/apps/.../libs/gettext/gettext.php(387) : eval()'d code on line 1 PHP…
Roel Vermeulen
  • 594
  • 7
  • 15
2
votes
1 answer

Gettext in PHP requires setlocale(LC_MESSAGES, NULL) to be called

When using PHP 5.5.9 on Ubuntu, gettext isn't working although everything is set up correctly. The lines that I use to set up gettext are the following ones: putenv('LANG=es_ES.utf8'); setlocale(LC_MESSAGES, 'es_ES'); bindtextdomain('messages',…
caw
  • 30,999
  • 61
  • 181
  • 291
2
votes
1 answer

php gettext translation not working on Debian

(I've seen the other questions, but their answers didn't help me) I have an application that uses php gettext for translations, and has been working for years on OSX and FreeBSD. When I tried to port it to Debian 7.6 32bit (Linux debian32bit…
Roel Harbers
  • 1,014
  • 1
  • 9
  • 18
2
votes
4 answers

Yii: GetText _() vs Yii::t()

When translating strings in Yii with GetText, do we have to use Yii::t($category,'message') or gettext's _('message') syntax? And then how do we pull the strings into a PO file?
mae
  • 14,947
  • 8
  • 32
  • 47
2
votes
1 answer

PHP gettext doesn't works

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…
Miraage
  • 3,334
  • 3
  • 26
  • 43
2
votes
4 answers

How do you use gettext on server (Apache) you can’t restart?

I asked this question on serverfault but I didn't get any response. I try here... I developped a site on my web server at home. When I modify the translation files, I have to restart the web server Apache. /etc/init.d/httpd graceful Easy... Suppose…
Luc M
  • 16,630
  • 26
  • 74
  • 89
2
votes
0 answers

PHP internationalization with intl

I'm looking for a good way to internationalize an PHP application. My conclusions so far, is that I'll not use gettext (keeps failing randomly, bad implementation of cache with lighttpd I guess) and Zend is not a option to me. I'm very interested in…
cvsguimaraes
  • 12,910
  • 9
  • 49
  • 73
2
votes
1 answer

PHP gettext Simplified Chinese support?

I'm trying to support traditional chinese in one of my PHP projects, but I can't get it to show any chinese characters. Here's my gettext setup: putenv("LC_ALL=zh_CN.utf8"); setlocale(LC_ALL, "zh_CN.utf8"); bindtextdomain("wpsmessages",…
oschloebe
  • 386
  • 1
  • 2
  • 16
2
votes
2 answers

Gettext: Translation of strings with HTML inside?

My current implementation, which is array based stores keys and values in a dictionary, example: $arr = array( 'message' => 'Paste a flickr URL below.', ); I realize that it was probably a bad idea storing html…
meder omuraliev
  • 183,342
  • 71
  • 393
  • 434
2
votes
2 answers

How can I translate with gettext and some complex variables inside

we are translating our site with Gettext, but recently we found some problems with our translate team. we have some string like... Hi Bob this evening you win *three* red *balloons* and we get something like this... sprintf("Hi %s this %s you %s…
aaronroman
  • 820
  • 1
  • 6
  • 10
1
vote
3 answers

poedit fails with "Updating the catalog failed"

I am using gettext for a large PHP project. I have successfully setup everything, entered a few translations (in two languages) to test if translations work and started coding. From time to time I even updated the translations using poEdit. Now, for…
johndodo
  • 17,247
  • 15
  • 96
  • 113