Re: gettext vs custom ways
- From: Michael Fesser <netizen@xxxxxx>
- Date: Fri, 11 May 2007 11:52:07 +0200
..oO(shimmyshack)
On May 11, 1:02 am, Mike P2 <sumguyovrt...@xxxxxxxxx> 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've used gettext a while ago, but can't really compare it with other
methods. All I can say is that it worked well and made it quite easy to
extract all translatable strings from the source code to create the
message files.
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,
[...]
---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.
gettext also works very well with UTF-8, you can even use it in the
message IDs.
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.
Given the example above that would be something like
printf($_LANG['user_already_exists'], $userName);
or
printf(_('Der Benutzer %s existiert bereits!'), $userName);
I prefer the second one. For me it's easier to read and easier to modify
if necessary.
Micha
.
- Follow-Ups:
- Re: gettext vs custom ways
- From: Mike P2
- Re: gettext vs custom ways
- References:
- gettext vs custom ways
- From: Mike P2
- Re: gettext vs custom ways
- From: shimmyshack
- gettext vs custom ways
- Prev by Date: Re: is_blank()?
- Next by Date: Re: A quick question about xml-rpc
- Previous by thread: Re: gettext vs custom ways
- Next by thread: Re: gettext vs custom ways
- Index(es):
Relevant Pages
|
Loading