Re: I18N (New Class: Locale)
| From: | Stig S. Bakken | Date: | Mon, 11 Feb 2002 12:34:46 +0000 |
| Subject: | Re: I18N (New Class: Locale) | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-4603@lists.php.net to get a copy of this message | ||
Just a small comment, there was a bug report recently saying that the
format "en_US" is not RFC-compliant (I haven't checked, but I assume it
is correct), but "en-US" is. "en_US" is the form used by Unix locale
implementations. You may want to keep this discintion in mind.
- Stig
On Mon, 2002-02-11 at 13:28, Wolfram Kriesing wrote:
> On Monday 11 February 2002 11:24, Naoki Shima wrote:
> > >Wolfram Kriesing is putting together a set of I18N classes. We
> > > don't need both, I guess you two should talk together. :-)
> > >
> > > - Stig
> >
> > I don't think my classes(phpLocale project) comflict with Wolfram
> > Kriesing's proposal so that
> > my classes could be merged into I18N(?) branch of PEAR if nobody
> > has different idea.
>
> OK, so here is my suggestion how this I18N-stuff might work in
> general:
>
> Once you set up an I18N-object you have to define the current
> language and/or Locale you are currently working with and a default
> and/or fallback language. And if we use the translate mechanism i
> suggested in my Language class we would also need a source-language,
> from which we want to translate.
> This way a call to i.e. "I18N_Message::translate" would know that it
> has to translate into the current language. And you dont have to pass
> an additional parameter which tells the language to translate into,
> but it is optional too.
> And i.e. a method "I18N_Paper::getSizes" would know for which locale
> it has to return the currently available paper sizes.
> or should this be something the application handles, and it should
> always pass the parameter locale/language?
>
> code example:
> // tell that we are working in german and with the locale stuff for
> // germany :-)
> $paper = new I18N_Paper( 'de_DE' );
> // gets all paper sizes for Germany
> $paper->getSizes();
>
> $messages = new I18N_Messages( 'de_DE' );
> // translate a string from the source language into german.
> // (source language is english by default,
> // IF we decide to use it at all)
> $messages->translate( 'Hi guys, i am happy to be here' );
>
> $time = new I18N_Time( 'de_DE' );
> // convert date properly
> $time->convert( $aMillisecondTimeStamp );
>
> how does that look?
>
>
> This might not be too important, but is there some common agreement
> in PEAR if method names are singular or plural? Since I18N_Messages
> is plural, but I18N_Paper is singular. I experienced sticking to
> singular makes things easier, i dont have to look up how the class
> name was, either "Messages" or "Message".
>
> --
> Wolfram
>
> ... translating template system ...
> http://wolfram.kriesing.de/SimpleTemplate
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc