cldr2def tool: Fix alternative month generation
authorJohn Marino <draco@marino.st>
Fri, 24 Jul 2015 15:46:02 +0000 (17:46 +0200)
committerJohn Marino <draco@marino.st>
Fri, 24 Jul 2015 15:55:18 +0000 (17:55 +0200)
For some locales defined in tools/tools/locale/etc/charmaps.xml,
there are alternative month names defined in CDATA.  When they are
not present, the POSIX months are just repeated, otherwise this CDATA
set is returned.

The problem is that the spaces and approximately half of the double
quotes were retained as part of the names.  This modification will
strip off the white space and quotes to fix alternative month
definitions.

tools/tools/locale/tools/cldr2def.pl

index b9462fc..b595689 100755 (executable)
@@ -199,7 +199,15 @@ sub callback_altmon {
        my $s = shift;
 
        if (defined $alternativemonths{$callback{data}{l}}{$callback{data}{c}}) {
-               return $alternativemonths{$callback{data}{l}}{$callback{data}{c}};
+               my @altnames = split(";",$alternativemonths{$callback{data}{l}}{$callback{data}{c}});
+               my @cleaned;
+               foreach (@altnames)
+               {
+                       $_ =~ s/^\s+//;
+                       $_ =~ s/\s+$//;
+                       push @cleaned, $_;
+               }
+               return join(";",@cleaned);
        }
 
        return $s;