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


Manual Reference Pages  -  ROSE::HTML::OBJECT::MESSAGE::LOCALIZED (3)

.ds Aq ’

NAME

Rose::HTML::Object::Message::Localized - Localized message object.

CONTENTS

SYNOPSIS



  use Rose::HTML::Form::Field::Integer;
  Rose::HTML::Form::Field::Integer->load_all_messages;

  use Rose::HTML::Object::Messages qw(NUM_INVALID_INTEGER);

  $localizer = Rose::HTML::Object->default_localizer;

  $msg =
    Rose::HTML::Object::Message::Localized->new(
      localizer => $localizer,
      id        => NUM_INVALID_INTEGER,
      args      => { label => XYZ });

  print $msg->localized_text; # XYZ must be an integer.

  $msg->locale(fr);

  print $msg->localized_text; # XYZ doit e\k:^tre un entier.



DESCRIPTION

Rose::HTML::Object::Message::Localized objects encapsulate a localized text message with an integer id and an optional set of name/value pairs to be used to fill in any placeholders in the message text.

This class inherits from Rose::HTML::Object::Message. See the Rose::HTML::Object::Message documentation for more information.

OVERLOADING

Stringification is overloaded to call the localized_text method. In numeric and boolean contexts, Rose::HTML::Object::Message::Localized objects always evaluate to true.

CLASS METHODS

<B>default_locale [LOCALE]B> Get or set the default locale. Defaults to en.
<B>default_localizer [LOCALIZER]B> Get or set the default Rose::HTML::Object::Message::Localizer-derived localizer object. Defaults to the default_localizer of the generic object class for this HTML object class hierarchy (Rose::HTML::Object, by default).

CONSTRUCTOR

<B>new [ PARAMS | TEXT ]B> Constructs a new Rose::HTML::Object::Message::Localized object. If a single argument is passed, it is taken as the value for the text parameter. Otherwise, PARAMS name/value pairs are expected. Any object method is a valid parameter name.

OBJECT METHODS

<B>args [ PARAMS | HASHREF ]B> Get or set the name/value pairs to be used to fill in any placeholders in the localized message text. To set, pass a list of name/value pairs or a reference to a hash of name/value pairs. Values must be strings, code references, or references to arrays of strings or code references. Code references are evaluated each time a message with placeholders is constructed.

See the LOCALIZED TEXT section of the Rose::HTML::Object::Message::Localizer documentation for more information on message text placeholders.

<B>id [INT]B> Get or set the message’s integer identifier.
<B>locale [LOCALE]B> Get or set the locale string for this message. If no locale is set but a parent is defined and has a locale, then the parent’s locale() is returned. If the parent doesn’t exist or has no locale set, the default_locale is returned.
<B>localizer [LOCALIZER]B> Get or set the Rose::HTML::Object::Message::Localizer-derived object used to localize message text. If no localizer is set but a parent is defined, then the parent’s localizer() is returned. Otherwise, the default_localizer is returned.
<B>localized_textB> Asks the localizer to produce the localized version of the message text for the current locale and args. The localized text is returned.
<B>parent [OBJECT]B> Get or set a weakened reference to a parent object. This parent must have a localizer() method that returns a Rose::HTML::Object::Message::Localizer-derived object and a locale() method that returns a locale string.

AUTHOR

John C. Siracusa (siracusa@gmail.com)

LICENSE

Copyright (c) 2010 by John C. Siracusa. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 ROSE::HTML::OBJECT::MESSAGE::LOCALIZED (3) 2015-03-17

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