document changes in International.pm API

This commit is contained in:
Colin Kuskie 2006-01-12 21:21:15 +00:00
parent 64048c0846
commit 45b03a03c3
2 changed files with 33 additions and 6 deletions

View file

@ -836,6 +836,29 @@ perl -pi.bak -e 's!WebGUI\:\:Subscription\-\>new\(!WebGUI::Subscription->new(\$s
perl -pi.bak -e 's!WebGUI\:\:TabForm\-\>new\(!WebGUI::TabForm->new(\$self->session,!g' fileNameGoesHere
5.23.24 WebGUI::International API Refactored
The WebGUI::Paginator API was changed to use the session API, and was
changed to be solely object oriented, where before it would work in
either subroutine or OO modes. The latter change precludes writing
a script to make the changes.
The changes are summarized here. For complete details, please read the POD
documentation in lib/WebGUI/International.pm
WebGUI::International::get('key','namespace');
my $i18n = WebGUI::International->new($session, 'namespace');
$i18n->get('key');
WebGUI::International::getLanguage('English', 'property');
my $i18n = WebGUI::International->new($session);
$i18n->getLanguage('key');
WebGUI::International::getLanguages();
my $i18n = WebGUI::International->new($session);
$i18n->getLanguages();
6. Automatic list of Assets in Help System.
-------------------------------------

View file

@ -53,7 +53,9 @@ These functions/methods are available from this package:
=head2 get ( internationalId [ , namespace, language ] )
Returns the internationalized message string for the user's language. If there is no internationalized message, this method will return the English string.
Returns the internationalized message string for the user's language.
If there is no internationalized message, this method will return
the English string.
=head3 internationalId
@ -73,8 +75,8 @@ my $safeRe = qr/[^\w\d\s\/]/;
sub get {
my ($self, $id, $namespace, $language) = @_;
$namespace = $namespace || $_[0]->{_namespace} || "WebGUI";
$language = $language || $_[0]->{_language} || $self->session->user->profileField("language") || "English";
$namespace = $namespace || $self->{_namespace} || "WebGUI";
$language = $language || $self->{_language} || $self->session->user->profileField("language") || "English";
$id =~ s/$safeRe//g;
$language =~ s/$safeRe//g;
$namespace =~ s/$safeRe//g;
@ -170,7 +172,7 @@ Specify a default language. Defaults to user preference or "English".
sub makeUrlCompliant {
my ($self, $url, $language) = @_;
$language = $language || $_[0]->{_language} || $self->session->user->profileField("language") || "English";
$language = $language || $self->{_language} || $self->session->user->profileField("language") || "English";
my $cmd = "WebGUI::i18n::".$language;
my $load = "use ".$cmd;
eval($load);
@ -184,9 +186,11 @@ sub makeUrlCompliant {
#-------------------------------------------------------------------
=head2 new ( [ namespace, language ] )
=head2 new ( session, [ namespace, language ] )
The constructor for the International function if using it in OO mode.
The constructor for the International function if using it in OO mode. Note
that namespace and languages are defaults; they may be overridden in
all accessor methods, (get, getLanguage).
=head3 session