Author image Steffen Winkler
and 1 contributors

NAME

Locale::TextDomain::OO::Util::JoinSplitLexiconKeys - Handle lexicon and message key

VERSION

4.001

$Id: JoinSplitLexiconKeys.pm 715 2018-06-04 15:08:31Z steffenw $

$HeadURL: svn+ssh://steffenw@svn.code.sf.net/p/perl-gettext-oo/code/Locale-TextDomain-OO-Util/trunk/lib/Locale/TextDomain/OO/Util/JoinSplitLexiconKeys.pm $

SYNOPSIS

    use Locale::TextDomain::OO::Util::JoinSplitLexiconKeys;

    my $keys_util = Locale::TextDomain::OO::Util::JoinSplitLexiconKeys->instance;

DESCRIPTION

Module to handle the lexicon and message key.

SUBROUTINES/METHODS

method instance

see SYNOPSIS

method join_lexicon_key

    $lexicon_key = $keys_util->join_lexicon_key({
        category => 'LC_MESSAGES', # default q{}
        domain   => 'TextDomain',  # default q{}
        language => 'de-de',       # default 'i-default' = developer English
        # mostly not needed
        project  => 'myProject',   # default not exists
    });

method split_lexicon_key

This method is the reverse implementation of method join_lexicon_key.

    $hash_ref = $keys_util->split_lexicon_key($lexicon_key);

method join_message_key

    $message_key = $keys_util->join_message_key({
        msgctxt      => 'my context',
        msgid        => 'simple text or singular',
        msgid_plural => 'plural',
    });

JSON format

    $message_key = $keys_util->join_message_key(
        {
            msgctxt      => 'my context',
            msgid        => 'simple text or singular',
            msgid_plural => 'plural',
        },
        'JSON',
    );

method split_message_key

This method is the reverse implementation of method join_message_key.

    $hash_ref = $keys_util->split_message_key($message_key);

JSON format

    $hash_ref = $keys_util->split_message_key($message_key, 'JSON');

method join_message

This method puts all data into the message_ref

    $message_ref = $keys_util->join_message(
        $message_key,       # joined msgctxt, msgid, msgid_plural
        $message_value_ref, # all other as hash reference
    );

JSON format

    $message_ref = $keys_util->join_message(
        $message_key,       # joined msgctxt, msgid, msgid_plural
        $message_value_ref, # all other as hash reference
        'JSON',
    );

method split_message

This method splits the message reference into a message key and the rest

    ( $message_key, $message_value_ref )
        = $keys_util->split_message($message_ref);

JSON format

    ( $message_key, $message_value_ref )
        = $keys_util->split_message($message_ref, 'JSON');

EXAMPLE

Inside of this distribution is a directory named example. Run this *.pl files.

DIAGNOSTICS

none

CONFIGURATION AND ENVIRONMENT

none

DEPENDENCIES

Locale::TextDomain::OO::Util::Constants

namespace::autoclean

INCOMPATIBILITIES

not known

BUGS AND LIMITATIONS

none

SEE ALSO

Locale::TextDoamin::OO

AUTHOR

Steffen Winkler

LICENSE AND COPYRIGHT

Copyright (c) 2014 - 2018, Steffen Winkler <steffenw at cpan.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.