Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-27 Thread Per Jessen
Bastien Koert wrote:

 No, as all of our users have to authorized to use the app, we store
 the desired language in a field in the user record. However, we also
 supply functionality via a drop down to allow the user to change the
 language if desired.

Okay, that's very similar to my approach.  For first-time users (of
which I will have a lot), the language is set by their browser's
language setting.  Most users won't be changing it.

 I agree its difficult to separate the language and the code, but if
 you create xslt / html files for each language then its a much simpler
 matter, and far less resouce intensive, to direct the user to that
 page in their desired language. 

I leave that to Apache and the 'prefer-language' environment variable -
I guess my main issue is to do with e.g. error-messages from PHP code
(please complete this field correctly etc) and from javascript ditto. 

I guess for error-messages, it's back to gettext(), which does make some
sense. 

 Again, you and just use PHP and handle the labels and option (drop
 downs, radios etc) variables in real time  but I never see the point
 in doing the same thing over and over again when its much cleaner (if
 more management intensive)  to direct the user to a static resource
 and pass in an XML string with the data in it.

Totally agree. 

 At work, we don't use gettext() since :
 a) its an classic ASP shop (  :-(  ), therefore no Linux and no PHP

Ah. :-)

 b) the db current doesn't support multi-byte charsets
 

The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-27 Thread Jan Kaštánek
Per Jessen:

  The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.

It supports. We use it. But only in MsgStr (translation), not in MsgId
(original strings).

-- 
toby

http://toby.cz/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-27 Thread Per Jessen
Jan Kaštánek wrote:

 Per Jessen:

  The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.
 
 It supports. We use it. But only in MsgStr (translation), not in MsgId
 (original strings).
 

Yeah, I found out too.  (from the GNU gettext docu).


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-27 Thread Phpster

Sorry guys,

I meant that the current application database is not configured for  
utf-8


Bastien

Sent from my iPod

On Jan 27, 2009, at 6:04, Per Jessen p...@computer.org wrote:


Jan Kaštánek wrote:


Per Jessen:


The gettext db doesn't support UTF8??? Uh oh, that's a show-stopper.


It supports. We use it. But only in MsgStr (translation), not in  
MsgId

(original strings).



Yeah, I found out too.  (from the GNU gettext docu).


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-26 Thread Per Jessen
Phpster wrote:

 Dunno if it's a best practice, but I store all the translations in the
 db for easy manipulation and extraction to a file for others to
 translate. That obviously involves both import and export utilities.

Hi Bastien

interesting - does this mean you're also coding for language-awareness
yourself?  I mean, you must have your own gettext() functionality?

 A number of pup apps take the approach of storing the label
 translations in variables inside language folders ( phpmyadmin has
 this ). That is also not a bad approach but is slightly slower and I
 can't help but feeling that serving up a static page created by code
 is a better solution. 

That's part of what we're thinking of doing, but it's difficult to
separate the language and code completely.  Which is where gettext()
comes in. 

Does anyone on this list use gettext() ?


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-26 Thread Bastien Koert
On Mon, Jan 26, 2009 at 12:21 PM, Per Jessen p...@computer.org wrote:

 Phpster wrote:

  Dunno if it's a best practice, but I store all the translations in the
  db for easy manipulation and extraction to a file for others to
  translate. That obviously involves both import and export utilities.

 Hi Bastien

 interesting - does this mean you're also coding for language-awareness
 yourself?  I mean, you must have your own gettext() functionality?

  A number of pup apps take the approach of storing the label
  translations in variables inside language folders ( phpmyadmin has
  this ). That is also not a bad approach but is slightly slower and I
  can't help but feeling that serving up a static page created by code
  is a better solution.

 That's part of what we're thinking of doing, but it's difficult to
 separate the language and code completely.  Which is where gettext()
 comes in.

 Does anyone on this list use gettext() ?


 /Per Jessen, Zürich


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


No, as all of our users have to authorized to use the app, we store the
desired language in a field in the user record. However, we also supply
functionality via a drop down to allow the user to change the language if
desired.

I agree its difficult to separate the language and the code, but if you
create xslt / html files for each language then its a much simpler matter,
and far less resouce intensive, to direct the user to that page in their
desired language. Again, you and just use PHP and handle the labels and
option (drop downs, radios etc) variables in real time  but I never see the
point in doing the same thing over and over again when its much cleaner (if
more management intensive)  to direct the user to a static resource and pass
in an XML string with the data in it.

At work, we don't use gettext() since :
a) its an classic ASP shop (  :-(  ), therefore no Linux and no PHP
b) the db current doesn't support multi-byte charsets

My personal projects (or work on the side) are, of course, all php but so
far there has been no requirements for multi language support, though the
two projects that I am starting will both require it. Not sure if I will use
gettext(), I will research some more, but it will definitely support
multi-language and the db is unicode.


-- 

Bastien

Cat, the other other white meat


RE: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-26 Thread Boyd, Todd M.
 -Original Message-
 From: Bastien Koert [mailto:phps...@gmail.com]
 Sent: Monday, January 26, 2009 12:23 PM
 To: Per Jessen
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] best practice wrt multi-lingual websites, gettext()
 etc.

---8---
 
 At work, we don't use gettext() since :
 a) its an classic ASP shop (  :-(  ), therefore no Linux and no PHP
 b) the db current doesn't support multi-byte charsets

If database size (on disk, not spatially) isn't a concern, you might
consider encoding the multi-byte strings, storing them encoded, and then
decoding them when that language is requested. There will be overhead
involved in the codec operations, obviously, but you could help to curb
that with client- or server-side caching.

Just a thought. It might not be feasible for your situation at all...


// Todd

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-25 Thread Phpster
Dunno if it's a best practice, but I store all the translations in the  
db for easy manipulation and extraction to a file for others to  
translate. That obviously involves both import and export utilities.


At work we to the translation in real time thru a render page that  
combined  the data for the form as well as the labels and buttons.  
Personally I disagree with this approach and feel that caching out the  
page to either HTML or XML is quicker and cleaner. But that's just me.


A number of pup apps take the approach of storing the label  
translations in variables inside language folders ( phpmyadmin has  
this ). That is also not a bad approach but is slightly slower and I  
can't help but feeling that serving up a static page created by code  
is a better solution. It will be heavier on the management side, but  
my experience is that this mgmt activity drops off quickly after the  
first week or two of that form being in production.


Nth

Bastien

Sent from my iPod

On Jan 25, 2009, at 14:56, Per Jessen p...@computer.org wrote:


I am writing a small(ish) site which will eventually need to be
available in several different languages.  This needs to more or less
transparent to the user, so I am using Apaches content negotiation
features, which is working very well.
The issues arise once I start looking at PHP and Javascript code. I  
use

JS for client side input (pre-)validation and increased usability, and
error messages and such will obviously need to be language-sensitive.
The same goes for the PHP code.

With PHP, I've got gettext() for this sort of job, with javascript and
some DHTML, I don't seem to have many options.

One of my key concerns is - for the translation, I need to be able to
wrap everything up and ship it off to a translator, perhaps via elance
or similar.

Does anyone have any best practice suggestions or comments in general?


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-25 Thread Richard Lynch
I can't help with the bits you are asking about, but I can give this
advice:

Don't rely solely on the Apache/browser content-negotiation, please.

This one time...

I was in Paris.

I was at an Internet Cafe.

I couldn't change browser settings.

Some sites that I knew were available in English showed me only
French, and no way to change it.

Despite my using a computer with a French keyboard, my French language
skills remained somewhere around the Bonjour. Parlez-vous Englias?
level.

-- 
Some people ask for gifts here.
I just want you to buy an Indie CD for yourself:
http://cdbaby.com/search/from/lynch



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] best practice wrt multi-lingual websites, gettext() etc.

2009-01-25 Thread Per Jessen
Richard Lynch wrote:

 I can't help with the bits you are asking about, but I can give this
 advice:
 
 Don't rely solely on the Apache/browser content-negotiation, please.
 

Don't worry, the site already has a user-override option. 


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php