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
24
votes
6 answers

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

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…
xiaoyi
  • 6,641
  • 1
  • 34
  • 51
20
votes
2 answers

Can't get gettext (php) on Ubuntu working

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…
pthulin
  • 4,001
  • 3
  • 21
  • 23
19
votes
4 answers

Online editing gettext files?

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…
ParisNakitaKejser
  • 12,112
  • 9
  • 46
  • 66
15
votes
3 answers

Use PHP Gettext without having to install locales

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…
user1318194
12
votes
3 answers

How to internationalize a PHP third-party library

Consider writing a PHP library, that will get published through Packagist or Pear. It is addressed to peer developers using it in arbitrary settings. This library will contain some status messages determined for the client. How do I internationalize…
Boldewyn
  • 81,211
  • 44
  • 156
  • 212
7
votes
1 answer

What is bindtextdomain, textdomain in gettext?

I've been learning a bit of gettext but I can't grasp those two functions. I've been wondering if I could use multiple translations in a APP written in PHP. For an instance, I've 1) the system translation 2) extensions translations 3) theme…
allenskd
  • 1,795
  • 2
  • 21
  • 33
6
votes
3 answers

How to use po/pot files with php?

I have a .po and a .mo file in a folder whose address is /locale/nld_nld/LC_MESSAGES/. Both the files' names are messages. I've been trying to use the following code: try.php: the…
Rajat Sharma
  • 61
  • 1
  • 2
6
votes
2 answers

Php web application internationalisation with Gettext();

I am currently developping a PHP web app that needs to be available in French and English. I looked around and found that the Gettext() functionality offers the best performance. I generated my .pot file with the command xgettext…
William Fortin
  • 777
  • 1
  • 4
  • 17
5
votes
1 answer

PHP Gettext: how to change the default MO path after setting the path of the domain?

I use PHP Gettext extension for localizing a Web app. When you do: bindtextdomain("example", "/locales"); If you're setting the locale to fr_FR, it will look for the MO in: /locales/fr_FR/LC_MESSAGES/example.mo Is there a way to customize that…
gou1
  • 316
  • 3
  • 10
5
votes
1 answer

How to hide gettext infos in php

I am writing simple script using gettext PHP function. All works well but i try to monitore what is changed for what. For example when user change 2 fields Type: (old) Agreement (new) Anex Notes: (old) #empty field# (new) Agreement ID: 123 My…
Emilian
  • 80
  • 4
5
votes
4 answers

Gettext (i18n) and Smarty running erraticly

I'm developing a webapp with PHP and Smarty. I use gettext to internationalize, but I've a problem: it only works sometimes, absolutly randomly. I load a locale ('de_DE', by example) with putenv+setlocale+bindtextdomain+textdomain, reload the page,…
ARemesal
  • 2,923
  • 5
  • 24
  • 23
4
votes
1 answer

How to get gettext work on IIS/PHP

I have Windows XP + IIS + PHP (fastcgi) installed. I want to use gettext for multilanguage application. index.php: bindtextdomain('APP', './locale'); textdomain('APP'); Directory…
Kerb
  • 1,138
  • 2
  • 20
  • 39
4
votes
1 answer

php ngettext multiple variables

Copying the example from the manual, ngettext works like this: ngettext("%d window", "%d windows", 1); //'1 window'; ngettext("%d window", "%d windows", 2); //'2 windows'; But what if I want to use 2 variables, for example %d windows %d doors? Is…
periklis
  • 10,102
  • 6
  • 60
  • 68
4
votes
0 answers

Does php built in webserver support gettext?

I'm trying this on Apache running on Ubuntu 14.04 and it works fine:
Isinlor
  • 1,111
  • 1
  • 13
  • 22
4
votes
1 answer

Trying to use gettext without country code ('es' instead 'es_ES')

I have the next files in my php project: libraries/locale/es_ES/LC_MESSAGES/messages.po libraries/locale/es_ES/LC_MESSAGES/messages.mo libraries/locale/es/LC_MESSAGES/messages.po libraries/locale/es/LC_MESSAGES/messages.mo Both are the same file…
Gonzalo Cao
  • 2,286
  • 1
  • 24
  • 20
1
2 3 4 5 6