Locale-TextDomain-OO

 view release on metacpan or  search on metacpan

t/23_localize_mo_utf-8.t  view on Meta::CPAN

#!perl -T

use strict;
use warnings;
use utf8;

use Test::More tests => 9;
use Test::NoWarnings;
use Test::Differences;

BEGIN {
    require_ok('Locale::TextDomain::OO');
    require_ok('Locale::TextDomain::OO::Lexicon::File::MO');
}

Locale::TextDomain::OO::Lexicon::File::MO
    ->new(
        logger => sub { note shift },
    )
    ->lexicon_ref({
        search_dirs => [ './t/LocaleData' ],
        decode      => 1,
        data        => [
            '*::' => '*/LC_MESSAGES/test.mo',
        ],
    });

my $loc = Locale::TextDomain::OO->new(
    language => 'ru',
    plugins  => [ qw( Expand::Maketext::Localize ) ],
    logger   => sub { note shift },
);
is
    $loc->localize(
        'book',
    ),
    'книга',
    'localize';
is
    $loc->localize(
        '§ book',
    ),
    '§ книга',
    'localize, umlaut';
is
    $loc->localize_mp(
        'appointment',
        'date',
    ),
    'воссоединение',
    'localize_mp';
is
    $loc->Nlocalize(
        'book',
    ),
    'book',
    'Nlocalize';
eq_or_diff
    [
        $loc->Nlocalize_mp(
            'appointment',
            'date',
        ),
    ],
    [
        'appointment',
        'date',
    ],
    'Nlocalize_mp';



( run in 0.779 second using v1.01-cache-2.11-cpan-39bf76dae61 )