| 1 | 1 | ▶ | use Map::Metro::Standard::Moops; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | our $VERSION = '0.1985'; # VERSION | ||
| 6 | # PODNAME: Map::Metro::Plugin::Hook::Helsinki::Swedish | ||
| 7 | # ABSTRACT: Use the Swedish station names | ||
| 8 | |||
| 9 | class Map::Metro::Plugin::Hook::Helsinki::Swedish using Moose { | ||
| 10 | |||
| 11 | use Map::Metro::Hook; | ||
| 12 | use Encode qw/encode_utf8 decode_utf8/; | ||
| 13 | use utf8; | ||
| 14 | |||
| 15 | method register { | ||
| 16 | before_add_station => sub { | ||
| 17 | |||
| 18 | my $self = shift; | ||
| 19 | my $station = shift; | ||
| 20 | $station->set_name($self->station_translation($station->name)); | ||
| 21 | |||
| 22 | }; | ||
| 23 | } | ||
| 24 | |||
| 25 | method station_translation($name) { | ||
| 26 | my $to_swedish = { | ||
| 27 | 'Ruoholahti' => 'Gräsviken', | ||
| 28 | 'Kamppi' => 'Kampen', | ||
| 29 | 'Rautatientori' => 'Järnvägstorget', | ||
| 30 | 'Kaisaniemi' => 'Kajsaniemi', | ||
| 31 | 'Hakaniemi' => 'Hagnäs', | ||
| 32 | 'Sörnälnen' => 'Sörnäs', | ||
| 33 | 'Kalasatama' => 'Fiskhamnen', | ||
| 34 | 'Kulosaari' => 'Brändö', | ||
| 35 | 'Herttoniemi' => 'Hertonäs', | ||
| 36 | 'Siilitie' => 'Igelkottsvägen', | ||
| 37 | 'Itäkeskus' => 'Östra centrum', | ||
| 38 | 'Myllypuro' => 'Kvarnbäcken', | ||
| 39 | 'Kontula' => 'Gårdsbacka', | ||
| 40 | 'Mellunmäki' => 'Mellungsbacka', | ||
| 41 | 'Puotila' => 'Botby gård', | ||
| 42 | 'Rastila' => 'Rastböle', | ||
| 43 | 'Vuosaari' => 'Nordsjö', | ||
| 44 | }; | ||
| 45 | return $to_swedish->{ $name } // $name; | ||
| 46 | } | ||
| 47 | |||
| 48 | } | ||
| 49 | |||
| 50 | 1; | ||
| 51 | |||
| 52 | __END__ | ||
| 53 | |||
| 54 | =pod | ||
| 55 | |||
| 56 | =encoding UTF-8 | ||
| 57 | |||
| 58 | =head1 NAME | ||
| 59 | |||
| 60 | Map::Metro::Plugin::Hook::Helsinki::Swedish - Use the Swedish station names | ||
| 61 | |||
| 62 | =head1 VERSION | ||
| 63 | |||
| 64 | Version 0.1985, released 2015-04-26. | ||
| 65 | |||
| 66 | =head1 SOURCE | ||
| 67 | |||
| 68 | L<https://github.com/Csson/p5-Map-Metro-Helsinki> | ||
| 69 | |||
| 70 | =head1 HOMEPAGE | ||
| 71 | |||
| 72 | L<https://metacpan.org/release/Map-Metro-Plugin-Map-Helsinki> | ||
| 73 | |||
| 74 | =head1 AUTHOR | ||
| 75 | |||
| 76 | Erik Carlsson <info@code301.com> | ||
| 77 | |||
| 78 | =head1 COPYRIGHT AND LICENSE | ||
| 79 | |||
| 80 | This software is copyright (c) 2015 by Erik Carlsson <info@code301.com>. | ||
| 81 | |||
| 82 | This is free software; you can redistribute it and/or modify it under | ||
| 83 | the same terms as the Perl 5 programming language system itself. | ||
| 84 | |||
| 85 | =cut | ||