- if (m/^\s*(yesexpr|noexpr)\s+(.+)$/) {
- my $type = $1;
- my $regex = uxx_to_utf8($2);
- unless ($regex =~ m/^"\^/) {
- error "LC_MESSAGES: $type missing '^' prefix: $regex";
- }
- unless ($regex =~ m/\[.+\]|\(.+\)/) {
- error "LC_MESSAGES: $type missing '[.+]|(.+)' content: $regex";
- }
- if ($regex =~ m/\.\*"$/) {
- warning "LC_MESSAGES: $type have '.*' postfix: $regex";
- }
- if ($regex =~ m/[0-9]/) {
- warning "LC_MESSAGES: $type have numbers in regex: $regex";
- }
- if ($type eq "yesexpr" && ($regex !~ m/y/ ||
- $regex !~ m/Y/)) {
- warning "LC_MESSAGES: $type missing 'yY' in content: $regex";
- }
- if ($type eq "noexpr" && ($regex !~ m/n/ ||
- $regex !~ m/N/)) {
- warning "LC_MESSAGES: $type missing 'nN' in content: $regex";
- }
- }
+ if (m/^\s*(yesexpr|noexpr)\s+(.+)$/) {
+ my $type = $1;
+ my $regex = uxx_to_utf8($2);
+ unless ($regex =~ m/^"\^/) {
+ error "LC_MESSAGES: $type missing '^' prefix: $regex";
+ }
+ unless ($regex =~ m/\[.+\]|\(.+\)/) {
+ error "LC_MESSAGES: $type missing '[.+]|(.+)' content: $regex";
+ }
+ if ($regex =~ m/\.\*"$/) {
+ warning "LC_MESSAGES: $type have '.*' postfix: $regex";
+ }
+ if ($regex =~ m/[0-9]/) {
+ warning "LC_MESSAGES: $type have numbers in regex: $regex";
+ }
+ if ($type eq "yesexpr" && ($regex !~ m/y/ ||
+ $regex !~ m/Y/)) {
+ warning "LC_MESSAGES: $type missing 'yY' in content: $regex";
+ }
+ if ($type eq "noexpr" && ($regex !~ m/n/ ||
+ $regex !~ m/N/)) {
+ warning "LC_MESSAGES: $type missing 'nN' in content: $regex";
+ }
+ }
+ }
+}
+
+sub check_order {
+ my @blocks = @_;
+ my @order= qw(LC_IDENTIFICATION
+ LC_CTYPE
+ LC_COLLATE
+ LC_MONETARY
+ LC_NUMERIC
+ LC_TIME
+ LC_MESSAGES
+ LC_PAPER
+ LC_NAME
+ LC_ADDRESS
+ LC_TELEPHONE
+ LC_MEASUREMENT);
+ my $pos = 0;
+ for my $section (@blocks) {
+ if ($section eq $order[$pos]) {
+ $pos++;
+ } else {
+ $pos = 0;
+ $pos++ while ($order[$pos] ne $section);
+ warning "$section: not following section $order[$pos-1]";
+ }
+ }
+}
+
+sub check_charset {
+ my @blocks = @_;
+ for my $section (@blocks) {
+ if ($section =~ m/^%\s*[Cc]arset:\s*$/) {
+ return;
+ }