Locale:...Lexicon(3)

πŸ“¦
version 1.036 Β· 2 versions
, in fedora 43

πŸ’– Locale::...Lexicon(3) πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation section of the manual, and it's literally all about one lil singleton. buckle up πŸŽ€

$Id: Lexicon.pm 698 2017-09-28 05:21:05Z steffenw $

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


✨ NAME ✨

Locale::TextDomain::OO::Singleton::Lexicon β€” it provides singleton lexicon access, no cap πŸ’…


🌸 VERSION 🌸

1.031 β€” that's the vibe, that's the version πŸ¦‹


🫢 DESCRIPTION 🫢

This module provides the singleton lexicon access for Locale::TextDomain:OO.

like. that's the whole job. it's giving "one instance to rule them all" πŸ‘‘


πŸ’« SYNOPSIS πŸ’«

use Locale::TextDomain::OO::Singleton::Lexicon;

$lexicon_data = Locale::TextDomain::OO::Singleton::Lexicon->instance->data;

that's it, that's the entrance exam, you passed πŸŽ€


🧚 SUBROUTINES/METHODS 🧚

🌈 method new

exists but makes no sense 😭

like it's there, it's a real method, but bestie... it makes no sense. don't @ me, that's just what the docs say πŸ™ˆ

🌈 method instance

see SYNOPSIS πŸ’–

exists but makes no sense 😭

same energy fr fr β€” it exists, and yet. it makes no sense.

🌈 method data

Get back the lexicon hash reference so you can fill the lexicon, or read from the lexicon. that's your whole access point, slay πŸ“

$lexicon_data = Locale::TextDomain::OO::Singleton::Lexicon->instance->data;

🌈 method merge_lexicon

Merge ist mostly used to join data of a language to create data for a region with some region different data. (yes, "ist" β€” we're keeping the author's energy exactly as-is πŸ’œ)

The example means: Take 'de::' and overwrite with specials of 'de-at::' and store as 'de-at::'.

$instance->merge_lexicon('de::', 'de-at::', 'de-at::');

Maybe more clear writing:

$instance->merge_lexicon('de::', 'de-at::' => 'de-at::');

🌈 method copy_lexicon

Copy a lexicon is a special case. It is like merge without the 2nd parameter.

$instance->copy_lexicon('i-default::', 'i-default:LC_MESSAGES:domain');

Maybe more clear writing:

$instance->copy_lexicon('i-default::' => 'i-default:LC_MESSAGES:domain');

🌈 method move_lexicon

Move is typical used to move the "i-default::" lexicon into your domain and category. Using a lexicon without messages you are able to translate because the header with plural forms is set. With no lexicon you would get a missing "plural forms"-error during translation. ⚠️

$instance->move_lexicon('i-default::', 'i-default:LC_MESSAGES:domain');

Maybe more clear writing:

$instance->move_lexicon('i-default::' => 'i-default:LC_MESSAGES:domain');

🌈 method delete_lexicon

Delete a lexicon from data. gone. poof. bye bestie πŸ’€

$deleted_lexicon = $instance->delete_lexicon('de::');

🌈 method logger

Set the logger and get back them πŸ‘‘

$lexicon_hash->logger(
    sub {
        my ($message, $arg_ref) = @_;
        my $type = $arg_ref->{type};
        $log->$type($message);
        return;
    },
);
$logger = $lexicon_hash->logger;

$arg_ref contains

object => $lexicon_hash, # the object itself
type   => 'debug',
event  => 'lexicon,merge', # or 'lexicon,copy'
                           # or 'lexicon,move'
                           # or 'lexicon,delete'

🌟 EXAMPLE 🌟

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


πŸ”₯ DIAGNOSTICS πŸ”₯

confess


πŸ’… CONFIGURATION AND ENVIRONMENT πŸ’…

none β€” literally nothing, no environment variables, no config, we keep it clean 🧼


πŸ‘‘ DEPENDENCIES πŸ‘‘

  • Carp
  • Moo
  • MooX::StrictConstructor
  • namespace::autoclean
  • Locale::TextDomain::OO::Role::Logger
  • MooX::Singleton

πŸ™ˆ INCOMPATIBILITIES πŸ™ˆ

not known β€” as far as anyone knows, we're compatible with the whole universe 🌈


πŸ’€ BUGS AND LIMITATIONS πŸ’€

none


πŸ¦‹ SEE ALSO πŸ¦‹

Locale::TextDoamin::OO

(yes, spelled exactly like that β€” TextDoamin. keeping it character for character because that's the assignment πŸ’œ)


πŸŽ€ AUTHOR πŸŽ€

Steffen Winkler


Copyright (c) 2013 - 2017, 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.


okay that's the whole page bestie, you ate it up 🫢 this was perl v5.42.0, dated 2025-07-25, and that's the Locale:...Lexicon(3) manual page from the User Contributed Perl Documentation β€” periodt πŸ’…βœ¨

πŸ“¦ where this page comes from