Reply to Re: gettext vs custom ways

Your name:

Reply:


Posted by shimmyshack on 05/11/07 01:10

On May 11, 1:02 am, Mike P2 <sumguyovrt...@gmail.com> wrote:
> Hi. Does anyone here have experience with PHP gettext functions? I'd
> like to know how they work better. Also, is gettext more efficient
> than serializing the language strings into language files and
> unserializing them at each request?
>
> I found this on Google saying that some guy sped up gettext, but I
> have no idea how fast it was in the first place:http://savannah.nongnu.org/forum/forum.php?forum_id=3648
>
> I was planning to just unserialize the appropriate language file at
> each page request and then use the strings kind of like phpBB does
> (language strings are assigned to constants and the needed strings are
> assigned to the template engine per-page). It seems to me that this
> would be easier to deal with than using _() and an English string to
> encode every string before sending it to the template engine.
>
> -Mike PII

I personally don't use _() because of that, although it doesn look
great, I just use the phpmyadmin way (which has a good lang detect
script) - as you suggest,

obtain user language preference (auto/deliberate choice via post/
cookie)
set it app wide in session
use it in html files, paths and so on
select one of a number of predefined language php files
---en--
$_LANG['please_login'] = 'Please Login'
$_LANG['username'] = 'username';
....

---de---
#allow string to be inserted where appropriate
$_LANG['user_already_exists'] = 'Der Benutzer %s existiert bereits!';

and so on
all files have names such as en_GB-utf-8.php
and are properly encoded - I just stick to utf8.

PhpMyAdmin or another large internationalised app can provide many
translations for you already.

Allow your users to help with translation through http://www.translingo.org,
or using the firefox addon "phplangeditor" and others....

as you say _('heres something that needs to be translated') seems
strange to me as well because although it certainly makes the code
readable, so do well chosen variable names.
I would be grateful for your thoughts should you change your mind

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация