From 236d67ee1dfe5bf1fe780124ec199ee8ee3a0120 Mon Sep 17 00:00:00 2001 From: Andrew Lewman Date: Wed, 14 Jul 2010 19:39:08 +0000 Subject: [PATCH] switch to Goldstein's idea of $lang/$dir/$page to keep all languages in their own subdir, rather than spread throughout the site. --- include/functions.wmi | 4 ++-- include/head.wmi | 9 +++++---- include/links.wmi | 8 ++++---- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/include/functions.wmi b/include/functions.wmi index 19e9dcc6..72de7cf2 100644 --- a/include/functions.wmi +++ b/include/functions.wmi @@ -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')) }; diff --git a/include/head.wmi b/include/head.wmi index df4ea6a1..60164cf7 100644 --- a/include/head.wmi +++ b/include/head.wmi @@ -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 '
  • %s
  • '."\n", stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key}; } @@ -82,7 +82,8 @@ elsif ($key =~/^http/) { printf '
  • %s
  • '."\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 ''."\n", stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key}; } @@ -127,7 +128,7 @@ printf ''."\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."; } } }:> diff --git a/include/links.wmi b/include/links.wmi index 172b0194..be03b0b5 100644 --- a/include/links.wmi +++ b/include/links.wmi @@ -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."; }; }:>