
Object::I18n - Internationalize objects

package Greeting;
sub new { my $x = $_[1]; bless \$x; }
sub greeting { @_ ? ${$_[1]} : (${$_[1]} = $_[2]) }
use Object::I18n qw(id);
__PACKAGE__->i18n->storage('Greeting::CDBI::I18n');
__PACKAGE__->i18n->register('greeting');
package main;
my $obj = Greeting->new("Hello, world\n");
print $obj->greeting;# "Hello, world\n"
$obj->i18n->language('fr');
print $obj->greeting;# exception
$obj->greeting("Bonjour, monde\n");
print $obj->greeting;# "Bonjour, monde\n"

Object::I18n overrides methods in your class to return international content. It provides one mixin method, i18n(), which returns an Object::I18n object. The object returned is different depending on whether you call it on your class or an instance of your class. See "METHODS" below.
Most methods can be either class methods or object methods but this doesn't mean what you may be accustomed to. A method is considered to act as a class method if it is called on an Object::I18n object returned from the class form of the i18n() method. It acts as an object method when called on the object returned from the object form of the i18n() method.
Returns and optionally sets the current language. If called as a class method it affects all instances of a class, except those that have set language() for themselves. If unset, methods should behave as if Object::I18n was not being used at all.
Registers the list of method names as i14able. The methods will be overridden so that they return i14ed content when language is set.
Returns and optionally set the class that controls how translations are stored.
Injects a new translation into your storage_class. The options are:
The language the translation is in. If not set then the language returned by the language() method will be used.
The attribute (method) in your class that the translation is for.
The actual translated text to be stored.
Any notes to be saved along with the translation. Requires you to have configured a history_class.

i18n.

Rick Delaney, <rick@bort.ca>

To be filled in.

Copyright (C) 2005 by Rick Delaney
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.