switch to Goldstein's idea of $lang/$dir/$page to keep all languages in

their own subdir, rather than spread throughout the site.
This commit is contained in:
Andrew Lewman 2010-07-14 19:39:08 +00:00
parent f452432855
commit 236d67ee1d
3 changed files with 11 additions and 10 deletions

View File

@ -48,7 +48,7 @@ sub translation_get_masterrevision() {
sub translation_get_basedonrevision_langfile($$$) {
my ($dir, $lang, $page) = @_;
my $translation = getMetadata("$dir/$lang/$page");
my $translation = getMetadata("$lang/$dir/$page");
if (exists $translation->{'Based-On-Revision'}) {
return $translation->{'Based-On-Revision'};
@ -67,7 +67,7 @@ sub translation_current() {
sub file_is_obsolete($$$) {
my ($dir, $lang, $page) = @_;
my $translation = getMetadata("$dir/$lang/$page");
my $translation = getMetadata("$lang/$dir/$page");
return (exists $translation->{'Status'} && ($translation->{'Status'} eq 'obsolete'))
};

View File

@ -69,7 +69,7 @@
$dir = '.' unless defined $dir;
# translated version
if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
if (-e "$(DOCROOT)/$lang/$dir/$base.wml") {
printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
}
@ -82,7 +82,8 @@
elsif ($key =~/^http/) {
printf '<li><a href="%s">%s</a></li>'."\n", $key, $navigation{$key};
} else {
warn "$WML_SRC_FILENAME has a [page $key] (parses to docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
warn "$WML_SRC_FILENAME has a [page $key] (parses to
docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$lang/$dir/$base.wml), but that doesn't exist.";
}
}
}:>
@ -118,7 +119,7 @@
$dir = '.' unless defined $dir;
# try to use a translated version
if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
if (-e "$(DOCROOT)/$lang/$dir/$base.wml") {
printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
}
@ -127,7 +128,7 @@
printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $calltoaction{$key};
} else {
warn "$WML_SRC_FILENAME has a [page $key] (parses to docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
warn "$WML_SRC_FILENAME has a [page $key] (parses to docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$lang/$dir/$base.wml), but that doesn't exist.";
}
}
}:>

View File

@ -23,14 +23,14 @@
my ($page, $lang) = @_;
my ($dir, $base) = $page =~ m,^(?:(.*)/)?(.*?)$,;
$dir = '.' unless defined $dir;
if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
if (-e "$(DOCROOT)/$lang/$dir/$base.wml") {
return stripDotSlashs("$(DOCROOT)/$dir/$base.html.$lang");
} elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
return stripDotSlashs("$(DOCROOT)/$dir/$base.html");
} elsif ($page =~ /^http/) {
return $page;
} else {
warn "$WML_SRC_FILENAME has a [page $page] (parses to docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
warn "$WML_SRC_FILENAME has a [page $page] (parses to docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$lang/$dir/$base.wml), but that doesn't exist.";
};
}
:>
@ -43,10 +43,10 @@
$dir = '.' unless defined $dir;
if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
print stripDotSlashs("$(DOCROOT)/$dir/$base.html.$lang");
} elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
} elsif (-e "$(DOCROOT)/en/$dir/$base.wml") {
print stripDotSlashs("$(DOCROOT)/$dir/$base.html");
} else {
warn "$WML_SRC_FILENAME has a [page $page] (parses to docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
warn "$WML_SRC_FILENAME has a [page $page] (parses to docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$lang/$dir/$base.wml), but that doesn't exist.";
};
}:>
</define-tag>