NAME

Lingua::Generic::Information::Language - module to provide information on languages

VERSION

version v0.01

SYNOPSIS

use Lingua::Generic::Information::Language;

my @languages = Lingua::Generic::Information::Language->known('wellknown');

use Lingua::Generic::Information;

my $language = Lingua::Generic::Information->lookup_language('de');

say $language->displayname;

This module proviles an interface to query language parameters in a language independent way.

Note: This all instances of thos package are registered. This means that for every language there is only one shared instance. In addition, instances of Data::Identifier relevant to languages are also registered by this module.

This package inherits from Data::Identifier::Interface::Subobjects, Data::Identifier::Interface::Known, and Data::Identifier::Interface::Simple.

METHODS

langtag

my $langtag = $language->langtag;

(since v0.01)

Returns the language tag if any.

Accepts the following universal options: as, default, no_defaults.

sid

my $sid = $language->sid;

(since v0.01)

Returns the small identifier if any.

Accepts the following universal options: as, default, no_defaults.

wd

my $sid = $language->wd;

(since v0.01)

Returns the wikidata identifier if any.

Accepts the following universal options: as, default, no_defaults.

super

my Lingua::Generic::Information::Language $super = $language->super;

(since v0.01)

Returns the super language (in terms of language tags) if any.

Accepts the following universal options: as, default, no_defaults.

query

my $value = $language->query($property, %opts);

(since v0.01)

Returns the value for the property $property. The type of the returned value depends on the property and the passed parameters. See "PROPERTIES" for details on which properties are available.

Accepts the following universal options: as, default, no_defaults.

In addition the option filter is accepted, which allows to select the value based on the context. The filter is an hashref containing of key value pairs. The key can be any aspect that is related to the given option such as a dimension. The possible values depend on the key.

If the value is not known, or no match with the given filter is found, the options default, and no_defaults control the return value and whether or not the method will die (which is the default).

PROPERTIES

Dimensions

The dimensions of a language refer to attributes words may carry. Common examples include the numerus (singular, plural, ...), or the class (noun, verb, adjective, ...).

As this highly depends on the language, and this module may not know about any detail of all languages lists containing dimensions are generally considered incomplete. The module tries to provide the most safe values.

All dimensions are valid as keys in filters, even if those dimensions are not part of the language.

Types

Most properties can return strings, booleans, or identifier-based values. The exact type to be returned can be enforced using the as-parameter.

Below identifier-based means all types "as" in Data::Identifier can convert from or to.

properties

dimensions_excluded

(since v0.01)

This property will return a list of dimensions that are safe to ignore in matching specific words. The list may not be complete. The values generally depend on values from other dimensions, so those should be added to the filter.

Supported types: string, identifier-based.

sentence_first_word_case

(since v0.01)

The case of the first word in a sentence.

Possible values: 'ucfirst', 'lcfirst', 'uc', 'lc'. undef can be returned in case no simple transformation is possible.

Supported types: enum.

sentence_preamble

(since v0.01)

The sentence preamble is a string that starts a sentence, such as a ¡. It is part of the sentence it belongs to.

Supported types: string.

sentence_separator

(since v0.01)

The sentence separator is a string that is used between two sentences, often a single space, to keep them apart. The separator is not part of any of the sentences.

Supported types: string.

sentence_terminator

(since v0.01)

The sentence terminator is a string that ends a sentence, such as a full stop (.). It is part of the sentence it belongs to.

Supported types: string.

term_scan_ahead

(since v0.01)

The number of words to look ahead to find a term (e.g. a proper name or compound).

word_separator

(since v0.01)

The word separator is a string that is used between two words within the same sentence, often a single space, to keep them apart. The separator is not part of any of the words.

Supported types: string.

KNOWN CLASSES

The following classes are defined for the use with "known" in Data::Identifier::Interface::Known.

:all

This class contains all values module is aware of.

wellknown

This class contains all languages actually known by this module.

registered

This class contains all languages for which an object was generated. This might be different from wellknown in that it may also include dynamically created objects.

AUTHOR

Philipp Schafft <lion@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2026 by Philipp Schafft <lion@cpan.org>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)