summaryrefslogtreecommitdiff
path: root/lib/VNDB/L10N.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-10-21 09:20:56 +0200
committerYorhel <git@yorhel.nl>2009-10-21 09:20:56 +0200
commitd4a7430b0cb058c111c0f3ca36a8cbf32104f787 (patch)
treea529579c53680e964b50be004b0b783ddd2e0da5 /lib/VNDB/L10N.pm
parente88144fa2d8fb95e35ed3f34714063b11ef9dea7 (diff)
L10N-HU: Added code for Hungarian TL and minor code cleanup
Diffstat (limited to 'lib/VNDB/L10N.pm')
-rw-r--r--lib/VNDB/L10N.pm35
1 files changed, 22 insertions, 13 deletions
diff --git a/lib/VNDB/L10N.pm b/lib/VNDB/L10N.pm
index 279cbd31..8698cb74 100644
--- a/lib/VNDB/L10N.pm
+++ b/lib/VNDB/L10N.pm
@@ -11,7 +11,7 @@ use warnings;
# used for the language switch interface, language tags must
# be the same as in the languages hash in global.pl
- sub languages { ('en', 'ru', 'cs') }
+ sub languages { qw{ cs en hu ru } }
sub maketext {
my $r = eval { shift->SUPER::maketext(@_) };
@@ -22,11 +22,10 @@ use warnings;
# can be called as either a subroutine or a method
sub loadfile {
- my %lang = (
- en => \%VNDB::L10N::en::Lexicon,
- ru => \%VNDB::L10N::ru::Lexicon,
- cs => \%VNDB::L10N::cs::Lexicon,
- );
+ my %lang = do {
+ no strict 'refs';
+ map +($_, \%{"VNDB::L10N::${_}::Lexicon"}), languages
+ };
my $r = LangFile->new(read => "$VNDB::ROOT/data/lang.txt");
my $key;
while(my $l = $r->read) {
@@ -45,6 +44,7 @@ use warnings;
}
+
{
package VNDB::L10N::en;
use base 'VNDB::L10N';
@@ -128,14 +128,15 @@ use warnings;
{
- package VNDB::L10N::ru;
+ package VNDB::L10N::cs;
use base 'VNDB::L10N::en';
our %Lexicon;
sub quant {
my($self, $num, $single, $couple, $lots) = @_;
- return $single if ($num % 10) == 1 && ($num % 100) != 11;
- return $couple if ($num % 10) >= 2 && ($num % 10) <= 4 && !(($num % 100) >= 12 && ($num % 100) <= 14);
+ return $lots if ($num % 100) >= 11 && ($num % 100) <= 14;
+ return $single if ($num % 10) == 1;
+ return $couple if ($num % 10) >= 2 && ($num % 10) <= 4;
return $lots;
}
}
@@ -143,19 +144,27 @@ use warnings;
{
- package VNDB::L10N::cs;
+ package VNDB::L10N::hu;
+ use base 'VNDB::L10N::en';
+ our %Lexicon;
+}
+
+
+
+{
+ package VNDB::L10N::ru;
use base 'VNDB::L10N::en';
our %Lexicon;
sub quant {
my($self, $num, $single, $couple, $lots) = @_;
- return $lots if ($num % 100) >= 11 && ($num % 100) <= 14;
- return $single if ($num % 10) == 1;
- return $couple if ($num % 10) >= 2 && ($num % 10) <= 4;
+ return $single if ($num % 10) == 1 && ($num % 100) != 11;
+ return $couple if ($num % 10) >= 2 && ($num % 10) <= 4 && !(($num % 100) >= 12 && ($num % 100) <= 14);
return $lots;
}
}
+
1;