[or-cvs] r22640: {website} switch to Goldstein's idea of $lang/$dir/$page to keep all l (website/branches/web20/include)

Andrew Lewman andrew at torproject.org
Wed Jul 14 19:39:08 UTC 2010


Author: phobos
Date: 2010-07-14 19:39:08 +0000 (Wed, 14 Jul 2010)
New Revision: 22640

Modified:
   website/branches/web20/include/functions.wmi
   website/branches/web20/include/head.wmi
   website/branches/web20/include/links.wmi
Log:
switch to Goldstein's idea of $lang/$dir/$page to keep all languages in
their own subdir, rather than spread throughout the site.


Modified: website/branches/web20/include/functions.wmi
===================================================================
--- website/branches/web20/include/functions.wmi	2010-07-14 14:45:49 UTC (rev 22639)
+++ website/branches/web20/include/functions.wmi	2010-07-14 19:39:08 UTC (rev 22640)
@@ -48,7 +48,7 @@
 
 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 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'))
 };
 

Modified: website/branches/web20/include/head.wmi
===================================================================
--- website/branches/web20/include/head.wmi	2010-07-14 14:45:49 UTC (rev 22639)
+++ website/branches/web20/include/head.wmi	2010-07-14 19:39:08 UTC (rev 22640)
@@ -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.";
               }
             }    
           }:>

Modified: website/branches/web20/include/links.wmi
===================================================================
--- website/branches/web20/include/links.wmi	2010-07-14 14:45:49 UTC (rev 22639)
+++ website/branches/web20/include/links.wmi	2010-07-14 19:39:08 UTC (rev 22640)
@@ -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>



More information about the tor-commits mailing list