Well, thanks to Konstantin, I was able to finish the gettext.php file last
night. Here's what I did:
1) I edited i18n.php to do a different sort of check for gettext.
1.a) If it was found (--with-gettext), I use that.
1.b) If gettext wasn't found at all, I include gettext.php and use the PHP-
1.c) If some sort of broken install (one or two of the three functions
were found), I try to patch the install, but it will not translate. We
used to to just 1.a and 1.c, but I inserted (sorta) 1.b.
2) gettext.php stores a TON of stuff in the session.
2.a) What the current language is, where the language file is, etc.
2.b) The strings from squirrelmail.po (I can't figure out how to read .mo)
3) On every language change, all of the strings are cleared and the new
language is used.
4) When trying to translate a string, it ...
4.a) Tries to find an exact match. If successful, returns the translated
4.b) Tries to find a pretty good match (80% match or better). If
successful, stores the match in the session (so 4.a finds it) and returns
the translated string.
4.c) Realizes that there's no good translation. It stores the
untranslated string (so 4.a finds it next time) and returns the input
I think we should have a FAQ or something saying how to speed up
SquirrelMail. One of those things would be to use the built-in --with-
gettext in PHP instead of the one that will automatically load in 1.1.1 and
later. We can also point to the UW FAQs and have other miscellaneous tips
From: Konstantin Riabitsev <icon@mr...> - 2001-04-27 17:16:57
On Fri, 27 Apr 2001, Tyler Akins wrote:
> Well, thanks to Konstantin, I was able to finish the gettext.php file last
> night. Here's what I did:
Man, You are my personal hero! I think I'll tattoo your name on my
shoulder or something... :))
I can finally see some strings thranslated in Russian which were
_always_ in the .po file, but completely ignored by gettext. It's a tad
slower, but I'm about to upgrade my box to a GHz, so that shouldn't be
Thanks a ton!
0> Konstantin Riabitsev
/ ) http://www.mricon.com/
~ bash-2.04# httpd &
> I can finally see some strings thranslated in Russian which were
> _always_ in the .po file, but completely ignored by gettext. It's a tad
> slower, but I'm about to upgrade my box to a GHz, so that shouldn't be
> much difference.
Remember, gettext built into PHP (--with-gettext) is MUCH faster than
Also, the fuzzy matching that I do may or may not be performed by gettext
(system version) unless the fuzzy attribute was specified.
will match my gettext.php's "English string" (missing the :), but may not
match the system's gettext's "English string" (also missing the :).
This is caused by the translation file being out of date. Time to have it
translated again! I just wanted gettext.php to be awesome, and that's why
I added the fuzzy stuff.