| 1 | package Locale::TextDomain::OO::Plugin::Expand::Maketext; ## no critic (TidyCode) | ||||||||||
| 2 | |||||||||||
| 3 | 8 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 8 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 8 | ▶ | use Locale::Utils::PlaceholderMaketext; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 8 | ▶ | use Moo::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 8 | our $VERSION = '1.027'; | |||||||||
| 9 | |||||||||||
| 10 | 8 | requires qw( | |||||||||
| 11 | translate | ||||||||||
| 12 | filter | ||||||||||
| 13 | run_filter | ||||||||||
| 14 | ); | ||||||||||
| 15 | |||||||||||
| 16 | has expand_maketext => ( | ||||||||||
| 17 | is => 'rw', | ||||||||||
| 18 | 8 | ▶ | default => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 8 | return Locale::Utils::PlaceholderMaketext->new; | |||||||||
| 20 | }, | ||||||||||
| 21 | 8 | ); | |||||||||
| 22 | |||||||||||
| 23 | 23 | ▶ | sub maketext { | ||||||||
|
Subroutine
maketext: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 24 | 23 | my ($self, $msgid, @args) = @_; | |||||||||
| 25 | |||||||||||
| 26 | 23 | my $translation = $self->translate(undef, $msgid); | |||||||||
| 27 | 23 | $translation = $self->expand_maketext->expand_maketext( | |||||||||
| 28 | $translation, | ||||||||||
| 29 | @args, | ||||||||||
| 30 | ); | ||||||||||
| 31 | 23 | ▶ | $self->filter | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | and $self->run_filter(\$translation); | ||||||||||
| 33 | |||||||||||
| 34 | 23 | return $translation; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 11 | ▶ | sub maketext_p { | ||||||||
|
Subroutine
maketext_p: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 38 | 11 | my ($self, $msgctxt, $msgid, @args) = @_; | |||||||||
| 39 | |||||||||||
| 40 | 11 | my $translation = $self->translate($msgctxt, $msgid); | |||||||||
| 41 | 11 | $translation = $self->expand_maketext->expand_maketext( | |||||||||
| 42 | $translation, | ||||||||||
| 43 | @args, | ||||||||||
| 44 | ); | ||||||||||
| 45 | 11 | ▶ | $self->filter | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | and $self->run_filter(\$translation); | ||||||||||
| 47 | |||||||||||
| 48 | 11 | return $translation; | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 8 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 52 | 8 | ▶ | no warnings qw(redefine); ## no critic (NoWarnings) | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 53 | |||||||||||
| 54 | # Dummy methods for string marking. | ||||||||||
| 55 | 11 | ▶ | my $dummy = sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||
| 56 | 11 | my (undef, @more) = @_; | |||||||||
| 57 | 11 | ▶ | return wantarray ? @more : $more[0]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | 8 | }; | |||||||||
| 59 | 8 | *Nmaketext = $dummy; | |||||||||
| 60 | 8 | *Nmaketext_p = $dummy; | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | 8 | 1; | |||||||||
| 64 | |||||||||||
| 65 | __END__ | ||||||||||