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

TJ Hunter tjhunter at gmail.com
Thu Jun 2 16:57:14 MDT 2005


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.

-TJ

On 6/2/05, Mac Newbold <mac at macnewbold.com> wrote:
> Today at 2:17pm, TJ Hunter said:
> 
> > On 6/1/05, Victor Villa <vvilla at gmail.com> wrote:
> >> The Utah PHP User group yesterday held it's first framework project
> >> meeting at Code Greene.
> >
> > Have you guys thought about i18n at all?
> >
> > PHP has some gettext function that I think work great, but it's easier
> > to start the project with i18n in mind than trying to retrofit it
> > later.
> 
> I haven't given it a single thought. Is it important to anyone involved at
> this point? Is there something easy we can do to be ready for it without
> doing all the hard parts?
> 
> Mac
> 
> --
> Mac Newbold             MNE - Mac Newbold Enterprises, LLC
> mac at macnewbold.com      http://www.macnewbold.com/
>




More information about the UPHPU mailing list