File Coverage

blib/lib/Locale/Maketext/Utils/Phrase/Norm/BeginUpper.pm
Criterion Covered Total %
statement 12 12 100.0
branch 2 2 100.0
condition n/a
subroutine 3 3 100.0
pod 0 1 0.0
total 17 18 94.4


line stmt bran cond sub pod time code
1             package Locale::Maketext::Utils::Phrase::Norm::BeginUpper;
2              
3 4     4   3016 use strict;
  4         9  
  4         187  
4 4     4   23 use warnings;
  4         6  
  4         828  
5              
6             sub normalize_maketext_string {
7 67     67 0 179 my ($filter) = @_;
8              
9 67         227 my $string_sr = $filter->get_string_sr();
10              
11 67 100       130 if ( ${$string_sr} !~ m/\A(?:[A-Z]|(?:\[[^\]]+)|(?: …)|“)/ ) {
  67         452  
12              
13             # ${$string_sr} = "[comment,beginning needs to be upper case ?]" . ${$string_sr};
14 4         21 $filter->add_warning('Does not start with an uppercase letter, ellipsis preceded by space, or bracket notation.');
15             }
16              
17             # TODO (phrase obj?) If it starts w/ bracket notation will it be appropriately begun when rendered?
18              
19 67         230 return $filter->return_value;
20             }
21              
22             1;
23              
24             __END__
25              
26             =encoding utf-8
27              
28             =head1 Normalization
29              
30             We want to make sure phrases begin correctly and consistently.
31              
32             =head2 Rationale
33              
34             Correct beginning case makes the meaning clearer to end users.
35              
36             Clearer meaning makes it easier to make a good translation.
37              
38             Consistent beginning case makes it easier for developers to work with.
39              
40             Consistent beginning case is a sign of higher quality product.
41              
42             Incorrect beginning case could be a sign that partial phrases are in use or an error has been made.
43              
44             =head1 possible violations
45              
46             None
47              
48             =head1 possible warnings
49              
50             =over 4
51              
52             =item Does not start with an uppercase letter, ellipsis preceded by space, opening curly quote, or bracket notation.
53              
54             Problem should be self explanatory.
55              
56             If it is legit you could address this by adding a [comment] or [asis] to the beginning for clarity and to make it harder to use as a partial phrase.
57              
58             [comment,lc because …]lowercase this must be for some reason.
59              
60             [asis,brian d foy] is really cool!
61              
62             =back