The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Hades::Myths::Object - display text locally.

VERSION

Version 0.01

SYNOPSIS

Quick summary of what the module does:

use Hades::Myths::Object;

my $locales = Hades::Myths::Object->new({
	locale => 'ja_JP',
	locales => {
		stranger => {
			en_GB => 'Hello stranger',
			en_US => 'Howdy stranger',
			ja_JP => 'こんにちは見知らぬ人'
		},
	}
});

say $locales->stranger;

SUBROUTINES/METHODS

new

Instantiate a new Hades::Myths::Object object.

Hades::Myths::Object->new

_build_locale

call _build_locale method. Expects param $locale to be a Optional[Str].

$obj->_build_locale($locale)

_set_language_from_locale

call _set_language_from_locale method. Expects param $value to be a Str.

$obj->_set_language_from_locale($value)

has_language

has_language will return true if language accessor has a value.

$obj->has_language

_build_locales

call _build_locales method. Expects param $values to be a HashRef.

$obj->_build_locales($values)

convert_locale

Split a locale into locale and language.

$obj->convert_locale($locale, $fb)

add

Add an item into the locales. This method expects a reference $key that should be a Str and a locales HashRef where the keys are locales and the values are the text string.

locales->add('stranger', {
	en_US => 'Howdy stranger!'
});

string

call string method. Expects param $key to be a Str, param $locale to be a Str, param $lang to be a Str, param $fb to be a Str.

$obj->string($key, $locale, $lang, $fb)

debug_steps

call debug_steps method. Expects param $steps to be any value including undef.

$obj->debug_steps($steps)

DESTROY

call DESTROY method. Expects no params.

$obj->DESTROY()

AUTOLOAD

call AUTOLOAD method. Expects no params.

$obj->AUTOLOAD()

ACCESSORS

fb

The fallback locale/language that is used when no value in the locales hash matches the objects locale or language. You can get or set this attribute and it expects a Str value. This attribute will default to be 'en'.

$obj->fb;

$obj->fb($value);

locale

The locale that will be checked for first when stringiying. You can get or set this attribute and it expects a Str value. This attribute will default to use Posix::setlocale

$obj->locale;

$obj->locale($value);

language

The language that will be checked for second when stringifying. You can get or set this attribute and it expects a Str value. This attribute will be defaulted to be the first part of a locale.

$obj->language;

$obj->language($value);

locales

The hash reference of strings that map to each locale.

$obj->locales({ 
	stranger => {
		en_US => 'Howdy stranger!'
	}
})

AUTHOR

LNATION, <email at lnation.org>

BUGS

Please report any bugs or feature requests to bug-hades::myths::object at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Hades-Myths-Object. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Hades::Myths::Object

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2020 by LNATION.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

1 POD Error

The following errors were encountered while parsing the POD:

Around line 350:

Non-ASCII character seen before =encoding in ''こんにちは見知らぬ人''. Assuming UTF-8