[UPHPU] PHP Framework Project Launch - Coders welcome to attend

TJ Hunter tjhunter at gmail.com
Fri Jun 3 10:06:09 MDT 2005


i'm sure there's something you could find on google, but I think I'll
write one up this weekend. I was planning to for my own documentation,
but I'll make it so others can learn too.

On 6/3/05, Tyler Gee <geekout at gmail.com> wrote:
> On 6/2/05, TJ Hunter <tjhunter at gmail.com> wrote:
> > yes. if you use gettext, just surround all of your strings with gettext().
> >
> > so instead of:
> > echo "hello, world!";
> > do this:
> > echo gettext("hello, world!");
> >
> > you can even use sprintf with gettext:
> >
> > echo sprintf(gettext("hello, %s"), $userName);
> >
> > in some languages, you'll run into things where the sprintf arguments
> > will need to be in different orders, sprintf supports this by doing
> > argument swaping:
> >
> > $format = gettext("The %2\$s contains %1\$d monkeys.
> >            That's a nice %2\$s full of %1\$d monkeys.");
> > printf($format, $num, $location);
> >
> > so then your code can stay the same, and the language translator can
> > worry about the orders of the arguments.
> >
> > later on, you can run the gettext program against all your source code
> > to generate language files that someone can use to translate your
> > code.
> >
> > if you plan on supporting funky languages (multibyte languages), you
> > might want to look at using a different charset, such as UTF-8 for all
> > your pages.
> >
> > if you don't start something like this in the beginning, you'll have
> > to go back through everything and surround your strings with
> > gettext(), so it's easier to do it to start with.
> >
> > as far as if it's important, that's up to you guys since I probably
> > won't be able to contribute too much to the project other than
> > suggestions and maybe code snippits here an there.
> >
> 
> I don't know anything about this but would be very interested to
> learn.  I have never before worried about translating (save for some
> pages I designed in spanish).  Does anyone know of a short tutorial or
> links for more information?
> 
> Thanks,
> -wtgee
>




More information about the UPHPU mailing list