summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2012-03-22 07:23:03 +0100
committerYorhel <git@yorhel.nl>2012-03-22 07:28:04 +0100
commit290b3f8b5f9dc0aed65621ed57e4b5a8bd050c2f (patch)
treee9c029a0dcffe676c089e027a3f0f122dbec8cf4
parente152c1c4c1f176d6d9b3b7e1fe27828f4940cde3 (diff)
L10N: Allow interface translation for lang tags with a dash (e.g. pt-br)
-rw-r--r--lib/LangFile.pm2
-rw-r--r--lib/VNDB/L10N.pm5
-rw-r--r--lib/VNDB/Plugin/TransAdmin.pm4
3 files changed, 7 insertions, 4 deletions
diff --git a/lib/LangFile.pm b/lib/LangFile.pm
index e81f7f7a..f70ffce2 100644
--- a/lib/LangFile.pm
+++ b/lib/LangFile.pm
@@ -55,7 +55,7 @@ sub read {
}
# tl
- if(!$state && $l =~ /^([a-z_-]{2})([ *]):(?: (.+)|)$/) {
+ if(!$state && $l =~ /^([a-z_-]{2,5})([ *]):(?: (.+)|)$/) {
$lang = $1;
$sync = $2 eq '*' ? 0 : 1;
push @lines, $3||'';
diff --git a/lib/VNDB/L10N.pm b/lib/VNDB/L10N.pm
index 581e1da1..4d1c3dd8 100644
--- a/lib/VNDB/L10N.pm
+++ b/lib/VNDB/L10N.pm
@@ -24,7 +24,10 @@ use warnings;
sub loadfile {
my %lang = do {
no strict 'refs';
- map +($_, \%{"VNDB::L10N::${_}::Lexicon"}), languages
+ map {
+ (my $n = $_) =~ s/-/_/g;
+ ($_, \%{"VNDB::L10N::${n}::Lexicon"})
+ } languages
};
my $r = LangFile->new(read => "$VNDB::ROOT/data/lang.txt");
my $key;
diff --git a/lib/VNDB/Plugin/TransAdmin.pm b/lib/VNDB/Plugin/TransAdmin.pm
index c936901c..a13c95a6 100644
--- a/lib/VNDB/Plugin/TransAdmin.pm
+++ b/lib/VNDB/Plugin/TransAdmin.pm
@@ -25,7 +25,7 @@ my $langfile = "$VNDB::ROOT/data/lang.txt";
TUWF::register(
- qr{tladmin(?:/([a-z]+))?} => \&tladmin
+ qr{tladmin(?:/([a-z-]+))?} => \&tladmin
);
@@ -268,7 +268,7 @@ sub _savedoc {
sub _docs {
my($lang, $doc) = @_;
- my @d = map /\.[a-z]{2}$/ || /\/(?:8|11)$/ ? () : s{^.+\/([^/]+)$}{$1} && $_, glob "$VNDB::ROOT/data/docs/*";
+ my @d = map /\.[a-z-]{2,5}$/ || /\/(?:8|11)$/ ? () : s{^.+\/([^/]+)$}{$1} && $_, glob "$VNDB::ROOT/data/docs/*";
h2 class => 'alttitle', '...or a doc page';
div style => 'margin: 0 40px';