[i18n] [chora] Horde w/o Gettext, WAS: Workarounds for non-local cvsroot?

Ryan Gallagher ryan at studiesabroad.com
Wed May 28 13:38:34 PDT 2003


Quoting Eric Rostetter <eric.rostetter at physics.utexas.edu>:

> Quoting Ryan Gallagher <ryan at studiesabroad.com>:
> 
> > Has anyone set chora up to point to a non-local cvsroot?
> 
> Not that I know of.  I tried to, but gave up and just nfs mounted the
> repository.
> 
> > I'm wondering if anyone has set up some sort of nightly mirror to
> facilitate
> > chora displaying a, albeit slightly delayed, cvs repository from another
> box.
> 
> Nope.  But that could work if you don't need to be up to the minute.  Just
> a cron-based (uni-directional) rsync would work, for example.

In my case i can't even rsync the cvsroot... will have to script up a wget of
the sourceforge project-cvsroot.tar.gz nightly tarball, and extract it,
replacing the previous nights.  The concept works, just haven't automated it yet.

> > Aside: If you want to know how to set horde up without gettext (provided
> you
> > can
> > live with just the index language), i've done that.  And it only required
> > about
> > 15 lines of rather silly new code. ;-)
> 
> I've only had one request for this ever, so it doesn't seem to be a common
> request.  But I wouldn't mind seeing your solution anyway.

My solution, if you can call it that, is quite obsurd.  I simply defined my own
equivs for the various gettext functions in global space.  They may not all be
listed below as I have not done extensive testing yet.  But tossing this bit
into the top of the /horde/config/registry.php file got me off the ground and
running.  test.php appears to be the only script that "truely" checks for the
existence of the gettext module, lucky for me. =)

at first i had it in /horde/config/horde.php but for some reason that doesn't
seem to load on "every" page request.  Just tried registry.php and got lucky.

/** 
 * Hack to get around lack of gettext 
 * in a php enviorment you do not control.
 *
 * declare these in global space.  That entails
 * finding a file that gets included on EVERY
 * horde & module page request.
 *
 * For myself, /horde/config/registry.php did the
 * trick.
 *
 * Note: not a complete list.
 */
function _($string) {
    return $string;
}
function gettext($string) {
    return $string;
}
function bindtextdomain() {
    return TRUE;
}
function textdomain() {
    return TRUE;
}

I suppose i should declare each of these.  But I haven't hit some of them in the
horde code testing yet.

bind_textdomain_codeset --  Specify the character encoding in which the messages
from the DOMAIN message catalog will be returned
bindtextdomain -- Sets the path for a domain
dcgettext -- Overrides the domain for a single lookup
dcngettext -- Plural version of dcgettext
dgettext -- Override the current domain
dngettext -- Plural version of dgettext
gettext -- Lookup a message in the current domain
ngettext -- Plural version of gettext
textdomain -- Sets the default domain

-- 
Ryan T. Gallagher
ryan(at)studiesabroad.com
International Studies Abroad
http://www.studiesabroad.com
(512)480-8522




More information about the i18n mailing list