diff options
author | Yorhel <git@yorhel.nl> | 2009-08-15 09:05:48 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2009-08-17 16:27:14 +0200 |
commit | c000490dcdf208e235a05358668dbb6fb70d5168 (patch) | |
tree | 010eaf25e66f7b7aeeac972d796c843669df1159 /lib | |
parent | 4b918796f8d85d40d55dbf2674a2b691d802ff02 (diff) |
Added language switcher to the main menu
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VNDB/L10N.pm | 4 | ||||
-rw-r--r-- | lib/VNDB/Util/LayoutHTML.pm | 11 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/VNDB/L10N.pm b/lib/VNDB/L10N.pm index cbf6a239..5540c710 100644 --- a/lib/VNDB/L10N.pm +++ b/lib/VNDB/L10N.pm @@ -8,6 +8,10 @@ use warnings; sub fallback_languages { ('en') }; + # used for the language switch interface, language tags must + # be the same as in the languages hash in global.pl + sub languages { ('en', 'ru') } + # can be called as either a subroutine or a method sub loadfile { my %lang = ( diff --git a/lib/VNDB/Util/LayoutHTML.pm b/lib/VNDB/Util/LayoutHTML.pm index b5813330..a932c5a1 100644 --- a/lib/VNDB/Util/LayoutHTML.pm +++ b/lib/VNDB/Util/LayoutHTML.pm @@ -54,7 +54,16 @@ sub _menu { div id => 'menulist'; div class => 'menubox'; - h2 'Menu'; + h2; + span; + for (grep $self->{l10n}->language_tag() ne $_, $self->{l10n}->languages()) { + a href => "?l10n=$_"; + cssicon "lang $_", $self->{languages}{$_}; + end; + } + end; + txt mt 'Menu'; + end; div; a href => '/', 'Home'; br; a href => '/v/all', 'Visual novels'; br; |