NAME

Wikibase::Datatype::Value::Monolingual - Wikibase monolingual value datatype.

SYNOPSIS

use Wikibase::Datatype::Value::Monolingual;

my $obj = Wikibase::Datatype::Value::Monolingual->new(%params);
my $language = $obj->language;
my $type = $obj->type;
my $value = $obj->value;

DESCRIPTION

This datatype is string class for representation of translatable string.

METHODS

new

my $obj = Wikibase::Datatype::Value::Monolingual->new(%params);

Constructor.

Returns instance of object.

  • language

    Language shortcut. Parameter is optional. Value is checked to ISO 639-1 language code. Default value is 'en'.

  • value

    Value of instance. Parameter is required.

language

my $language = $obj->language;

Get language shortcut.

Returns string.

type

my $type = $obj->type;

Get type. This is constant 'monolingualtext'.

Returns string.

value

my $value = $obj->value;

Get value.

Returns string.

ERRORS

new():
        From Wikibase::Datatype::Value::new():
                Parameter 'value' is required.
        From Wikibase::Datatype::Utils::check_language():
                Language code '%s' isn't ISO 639-1 code.
                Language with ISO 639-1 code '%s' doesn't exist.

EXAMPLE

use strict;
use warnings;

use Wikibase::Datatype::Value::Monolingual;

# Object.
my $obj = Wikibase::Datatype::Value::Monolingual->new(
        'language' => 'en',
        'value' => 'English text',
);

# Get language.
my $language = $obj->language;

# Get type.
my $type = $obj->type;

# Get value.
my $value = $obj->value;

# Print out.
print "Language: $language\n";
print "Type: $type\n";
print "Value: $value\n";

# Output:
# Language: en
# Type: monolingualtext
# Value: English text

DEPENDENCIES

Mo, Wikibase::Datatype::Value.

SEE ALSO

Wikibase::Datatype::Value

Wikibase datatypes.

REPOSITORY

https://github.com/michal-josef-spacek/Wikibase-Datatype

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© 2020-2024 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.34