=pod
=head1 NAME
Bot::Cobalt::Lang - Bot::Cobalt language set loader
=head1 SYNOPSIS
use Bot::Cobalt::Lang;
## Load 'english.yml' from language dir:
my $english = Bot::Cobalt::Lang->new(
lang => 'english',
lang_dir => $path_to_lang_dir,
);
## Access loaded RPL hash:
my $str = $english->rpls->{$rpl};
## Fall back to core set:
my $language = Bot::Cobalt::Lang->new(
use_core => 1,
lang => $language,
lang_dir => $lang_dir,
);
## Use an absolute path:
my $language = Bot::Cobalt::Lang->new(
lang => "mylangset",
absolute_path => $path_to_my_lang_yaml,
);
## Load only the core (built-in) set:
my $coreset = Bot::Cobalt::Lang->new(
lang => 'coreset',
use_core_only => 1,
);
=head1 DESCRIPTION
Bot::Cobalt::Lang provides language set loading facilities to
L<Bot::Cobalt> and extensions.
This is primarily used by L<Bot::Cobalt::Core> to feed the core
B<lang()> hash.
B<new()> requires a 'lang' option and either a 'lang_dir' or
'absolute_path' -- if an absolute path is not specified, the named
'lang' is (attempted to be) loaded from the specified 'lang_dir' with an
extension of ".yml".
The 'use_core' option will load the built-in language set.
'use_core_only' will not attempt to load anything except the built-in
set.
If the load fails, an exception is thrown.
=head2 rpls
The B<rpls> attribute accesses the loaded RPL hash:
my $this_str = $language->rpls->{$rpl} // "Missing RPL $rpl";
=head2 spec
The B<spec> attribute returns the SPEC: definition for the loaded
language set.
=head1 AUTHOR
Jon Portnoy <avenj@cobaltirc.org>
=cut