Time::Duration::Locale - time duration string chosen by user's language preferences
use Time::Duration::Locale; print "next update ",duration(150),"\n";
Time::Duration::Locale has the same interface as
Time::Duration but chooses a language according to the user's locale settings. See examples/simple.pl in the Time-Duration-Locale sources for a complete program printing a duration in the locale language.
As of January 2013 available language modules on CPAN include
Time::Duration English Time::Duration::fr French Time::Duration::id Indonesian Time::Duration::ja Japanese Time::Duration::pt Portuguese Time::Duration::sv Swedish
If the user's locale setting is not one of these then the fallback is the English module.
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()
The following extra functions are provided by
Time::Duration::Locale and are not exported.
Set the language from the current locale environment variables etc. The current implementation uses
This is done automatically the first time one of the duration functions is called. But call it explicitly if you change the environment variables etc later and want
Time::Duration::Locale to follow the new values.
$lang = Time::Duration::Locale::language ()
$module = Time::Duration::Locale::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.
LC_MESSAGES etc, as per
Copyright 2009, 2010, 2011, 2013 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/>.