Re: Gettext - finding translations for imported common module

From: Date: Sat, 06 Nov 2010 16:38:32 +0000
Subject: Re: Gettext - finding translations for imported common module
References: 1  Groups: php.i18n 
Request: Send a blank email to php-i18n+get-1418@lists.php.net to get a copy of this message
On 11/05/2010 01:01 PM, Gerry Reno wrote:
I am using PHP 5.2.4 and gettext. I have a common module that I import (require) into other modules. But when I do this pages (at a different level in site tree) do not show the translations for this module. /siteroot /siteroot/lib/common.php
/siteroot/lib/locale/[LANG]/LC_MESSAGES/message.po    #COMMON MODULE TRANSLATIONS ARE IN HERE
/siteroot/index.php             #require("lib/common.php")     #NO COMMON MODULE TRANSLATION OCCURS
/siteroot/locale/[LANG]/LC_MESSAGES/message.po /siteroot/page2/index.php #require("../lib/common.php") #NO COMMON MODULE TRANSLATION OCCURS /siteroot/page2/locale/[LANG]/LC_MESSAGES/message.po Right now all the regular translations work fine but the imported module is not translated even though I have the translations for it under the /siteroot/lib directory. If I put the common module translation into each po file under each /siteroot/pageN directory then the common module translations work but this requires tons of duplication. Is there a way to bind an alternate root or domain so that gettext can find both the local translations and the library translations for the imported common modules?
After some experimenting I was able to redeclare the text domain binding so that it looked in the library location for the translations and then later reset it back to what it was previously.

« previous php.i18n (#1418) next »