NAME

Time::Duration::Locale - time duration module chosen by locale

SYNOPSIS

use Time::Duration::Locale;
print "next update ",duration(150),"\n";

DESCRIPTION

Time::Duration::Locale has the same interface as Time::Duration but chooses a language according to the user's locale settings.

As of June 2009 the available language modules on CPAN include

Time::Duration        English
Time::Duration::ja    Japanese
Time::Duration::sv    Swedish

If the user's locale setting is not one of these then the fallback is the English module.

EXPORTS

Like Time::Duration, the following functions are exported by default

later     later_exact
earlier   earlier_exact
ago       ago_exact
from_now  from_now_exact
duration  duration_exact
concise

EXTRA FUNCTIONS

The following extra functions are provided by Time::Duration::Locale and are not exported.

Time::Duration::Locale::setlocale ()

Set the language from the current locale environment variables etc.

This is called automatically the first time one of the duration functions is called. Call it explicitly if you change the environment variables later and want Time::Duration::Locale to follow the new values.

$lang = Time::Duration::Locale::language ()
Time::Duration::Locale::language ($lang)
$module = Time::Duration::Locale::module ()
Time::Duration::Locale::module ($module)

Get or set the language to use, either in the form of a language code like "en" or "ja", or a module name like "Time::Duration" or "Time::Duration::ja".

undef means a language has not been chosen yet. When setting the language the necessary module must exist and is loaded if not already loaded.

SEE ALSO

Time::Duration::LocaleObject, Time::Duration, Time::Duration::ja Time::Duration::sv

HOME PAGE

http://user42.tuxfamily.org/time-duration-locale/index.html

COPYRIGHT

Copyright 2009 Kevin Ryde

Time-Duration-Locale is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Time-Duration-Locale is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Time-Duration-Locale. If not, see <http://www.gnu.org/licenses/>.