summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2009-09-04 11:36:17 +0200
committerYorhel <git@yorhel.nl>2009-09-04 11:36:17 +0200
commit029bd46a0d06ac59a004ed69bc6e41ecbd28604b (patch)
treebff882e07e65dd35a10c0620dfb42cff991432cf
parent3aec82f35e8202340560c2581856f2afcd1492f1 (diff)
L10N: Implemented framework for translation of the doc pages
When a [docname].[langauge tag] file is available for the user language, that is used instead of the main [docname] file.
-rw-r--r--lib/VNDB/Handler/Misc.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm
index f1e1b774..187f1b0c 100644
--- a/lib/VNDB/Handler/Misc.pm
+++ b/lib/VNDB/Handler/Misc.pm
@@ -260,7 +260,10 @@ sub history {
sub docpage {
my($self, $did) = @_;
- open my $F, '<', sprintf('%s/data/docs/%d', $VNDB::ROOT, $did) or return 404;
+ my $l = '.'.$self->{l10n}->language_tag();
+ my $f = sprintf('%s/data/docs/%d', $VNDB::ROOT, $did);
+ my $F;
+ open($F, '<:utf8', $f.$l) or open($F, '<:utf8', $f) or return 404;
my @c = <$F>;
close $F;
@@ -274,7 +277,8 @@ sub docpage {
qq|<h3><a href="#$sec" name="$sec">$sec. $1</a></h3>\n|
}eg;
s{^:INC:(.+)\r?\n$}{
- open $F, '<', sprintf('%s/data/docs/%s', $VNDB::ROOT, $1) or die $!;
+ $f = sprintf('%s/data/docs/%s', $VNDB::ROOT, $1);
+ open($F, '<:utf8', $f.$l) or open($F, '<:utf8', $f) or die $!;
my $ii = join('', <$F>);
close $F;
$ii;