GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
HTML::Chunks::Local(3) User Contributed Perl Documentation HTML::Chunks::Local(3)

HTML::Chunks::Local - A simple localization layer for HTML::Chunks

1.02

This subclass of HTML::Chunks is geared for sites which deliver multi-lingual content. This works by making chunks that have a similar name but with a language or country code appended to the name (e.g. chunk_en) in your template files. When you call output(), you pass in an array reference which contains the user's language preference(s) after the chunk name. The subclass goes through that list, followed by default language codes, and finally tries no language code to find the most appropriate chunk to output. Simple.

 use HTML::Chunks::Local;
 $chunks = new HTML::Chunks::Local('chunkfile.html');
 $chunks->output('sample_chunk', [pt, sp], @data);

my $chunks = new HTML::Chunks::Local('chunkfile.html');
Create a new Chunks instance, and load up any chunk files supplied.
$chunks->output('chunkid', \@languagepref, ... );
Same as HTML::Chunks->output(), but requires an array ref with the user's language preference(s).
$chunks->setLangDefaults(\@default_language_list);
$chunks->getLangDefaults();
Accessor methods to set and retrieve the default language list. Note that is expects and returns array references.
$chunks->guessLanguage(\@languagepref);
Returns an array reference with a best guess language list. This expects to see typical HTTP header for language with country code (e.g. en-us), and returns a list of probable fallbacks, like [en_us, en]. Note that it converts the '-' into a more easily used '_', though it will accept any non-alpha character as a language/country spearator. This sub can be made to be much more intelligent, but this is a nice 80/20 solution for now.

Created, developed and maintained by Mark W Blythe and Dave Balmer, Jr. Contact dbalmer@cpan.org or mblythe@cpan.org for comments or questions.

(C)2001-2004 Mark W Blythe and Dave Balmer Jr, all rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Hey! The above document had some coding errors, which are explained below:
Around line 115:
You forgot a '=back' before '=head1'
2009-04-06 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.