Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* implemented english localization for BBBikeCalc::localize_direction

  • Loading branch information...
commit f2ded53e15c090ea284de6e237b24170818b0e5b 1 parent 4d756dd
@eserte authored
Showing with 20 additions and 5 deletions.
  1. +19 −1 BBBikeCalc.pm
  2. +1 −4 t/bbbikecalc.t
View
20 BBBikeCalc.pm
@@ -209,6 +209,24 @@ sub localize_direction {
'NW' => 'Nordwesten',
'NNW' => 'Nordnordwesten',
}->{uc($dir)};
+ } else {
+ $dir = { 'N' => 'north',
+ 'NNE' => 'north-northeast',
+ 'NE' => 'northeast',
+ 'ENE' => 'east-northeast',
+ 'E' => 'east',
+ 'ESE' => 'east-southeast',
+ 'SE' => 'southeast',
+ 'SSE' => 'south-southeast',
+ 'S' => 'south',
+ 'SSW' => 'south-southwest',
+ 'SW' => 'southwest',
+ 'WSW' => 'west-southwest',
+ 'W' => 'west',
+ 'WNW' => 'west-northwest',
+ 'NW' => 'northwest',
+ 'NNW' => 'north-northwest',
+ }->{uc($dir)};
}
$dir;
}
@@ -216,7 +234,7 @@ sub localize_direction {
sub localize_direction_abbrev {
my($dir, $lang) = @_;
if ($lang eq 'de') {
- $dir =~ tr{eE}{oO};
+ $dir =~ s{E}{O}i;
}
$dir;
}
View
5 t/bbbikecalc.t
@@ -21,10 +21,7 @@ BEGIN {
plan tests => 4;
-{
- local $TODO = "lang=en NYI";
- is BBBikeCalc::localize_direction('E', 'en'), 'east';
-}
+is BBBikeCalc::localize_direction('E', 'en'), 'east';
is BBBikeCalc::localize_direction('E', 'de'), 'Osten';
is BBBikeCalc::localize_direction_abbrev('E', 'en'), 'E';
Please sign in to comment.
Something went wrong with that request. Please try again.