[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PHP4 with gettext support on Debian 3.0r0?



It works for me. I have tested it under unstable but some times ago when
woody and sid where very close.

First I don't use _() but gettext().
Here is a small working example :

<?php

   $language = 'fr_FR';
   setlocale(LC_MESSAGES, $language);

   $domain = 'mycommunity';
   $rc=bindtextdomain($domain, "./locale"); 

   echo gettext("A string to be translated would go here") . "<br>\n";
   echo(gettext("Another one"));

?>

And I have the folowing files :

./locale/es/LC_MESSAGES
./locale/es/LC_MESSAGES/mycommunity.mo
./locale/fr/LC_MESSAGES
./locale/fr/LC_MESSAGES/mycommunity.mo
./locale/source/fr.po
./locale/source/mycommunity.pot
./locale/source/Makefile
./locale/source/es.po
./index.php

Finally locale/source/Makefile is

DOMAIN=mycommunity

update-po:
   xgettext -o mycommunity.pot ../../index.php

   catalogs='fr es'; \
   for cat in $$catalogs; do \
      echo -n "$$cat: "; \
      if msgmerge $$cat.po $(DOMAIN).pot -o $$cat.new.po &> /dev/null; then \
         mv -f $$cat.new.po $$cat.po; \
         rm -f ../$$cat/LC_MESSAGES/$(DOMAIN).mo; \
         msgfmt --statistics -o ../$$cat/LC_MESSAGES/$(DOMAIN).mo $$cat.po; \
      else \
         echo "msgmerge for $$cat failed!"; \
         rm -f $$cat.new.po; \
      fi; \
   done

Hope this help,
Christophe

On Thu, Aug 08, 2002 at 11:47:57PM +0200, Jan Normann Nielsen wrote:
> Hi
> 
> Has anyone has any success getting gettext support under PHP 4 to work under
> Debian 3.0r0? My php.ini has the gettext module loaded, but the _() function
> does nothing except output its parameter. I'm using the Horde/IMP webmail
> system and it works fine with with multiple languages under Apache/PHP on
> W2K so why won't it work on Debian?
> 
> I have the following packages installed:
> 
> ii  gettext        0.10.40-5      GNU Internationalization utilities
> ii  gettext-base   0.10.40-5      GNU Internationalization utilities for the
> b
> ii  gettext-el     0.10.40-5      Emacs po-mode for editing .po files.
> ii  php4           4.1.2-4        A server-side, HTML-embedded scripting
> langu
> ii  php4-imap      4.1.2-4        IMAP module for php4
> ii  php4-mysql     4.1.2-4        MySQL module for php4
> ii  php4-pear      4.1.2-4        PEAR - PHP Extension and Application
> Reposit
> 
> Best regards,
> Jan Nielsen
> 
> 
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 

-- 
Christophe Barbé <christophe.barbe@ufies.org>
GnuPG FingerPrint: E0F6 FADF 2A5C F072 6AF8  F67A 8F45 2F1E D72C B41E

Cats are intented to teach us that not everything in nature has a
function. --Garrison Keillor

Attachment: pgpyPJVig9lZ4.pgp
Description: PGP signature


Reply to: