CGI-Application-Plugin-I18N

 view release on metacpan or  search on metacpan

lib/CGI/Application/Plugin/I18N/Guide.pod  view on Meta::CPAN

CGI::Application script designed to get you used to using and editing .po files.
You'll need to copy this folder to your webservers public folder. It's safe to
do this by FTP is you are stuck on shared hosting. Or you can test locally,
just copy the folder to your public_html, httpdocs, wwwroot, etc. Depending on
your servers configuration you might have to put this in the cgi-bin. For the
sake of simplicity the rest of this guide refers to this folder as /tmp/potest.

=head2 Using Poedit

Download and install Poedit. When you open for the first time it'll ask for
your name and email, don't worry this is just for stamping the .po files with
your details.

Click the I<File> menu, then I<Preferences> and select the I<Parsers> tab.
You'll see that there is a Perl parser, select this and then click the I<Edit>
button.

You'll see that the list of file extensions only has I<*.pl>, extend this so
that is contains I<*.pl;*.pm;*.cgi> and any other extensions you use for your
applications Perl files. Click I<OK> and I<OK> again.

Now we are ready to create our first catalog. Click I<File-E<gt>New catalog>.
The details I entered:-
Project name: Demo
Team: po testers
Team email: not@now.com
Language: English
Country: United States
Charset: UTF-8
Source code charset: UTF-8

Then select the I<Paths> tab, click the little square graphic for I<new item>
then input the path to your script files, I've done /tmp/potest

Then select the I<Keywords> tab and add I<localtext> the same way you added the
path.

Click I<OK> to finish, a dialog will ask you where to save your .po file. I
selected /tmp/potest/I18N/en-us.po.

You should get a window titled I<Update summary> appear with a list of 4 new
strings. Click I<OK>.

If we added another localtext field to the potest example then all we need do
is click on the globe icon at the top and it'd parse the files again for new
strings.

For this example, click on the I<Colour> string, in the box at the bottom type
I<Color>. Now click the save icon. The .mo compiled version of this file is
generated automatically on each save.

=head2 Testing your demo .po file

Ok, now we are ready to test out your .po file and see it in action. Use your
browser to open the script potest.cgi.

I'm testing locally on my Vista IIS7. So /tmp/potest for me is actually
c:\inetpub\wwwroot\cgi-bin\potest, I'll be opening
http://localhost/cgi-bin/potest/potest.cgi in my browser.

You'll get a very basic HTML form asking for a locale, and showing small bits
of localized text (I do plan on an advanced version at some point). Enter in
I<en-us> and hit submit. You'll see all that has changed is I<Colour: Colour>.

Finally I wont have Americans moaning about how they can't spell colour or
cheque properly :P

If you enter in de then you'll get a german example that I've created as an
example of a more complete language pack (although my German is minimal, I used
babelfish to translate parts so it probably isn't structured correctly).

=head1 Quantifiers

I haven't used these yet... Stay tuned :)

=cut



( run in 1.006 second using v1.01-cache-2.11-cpan-ceb78f64989 )