switch to Goldstein's idea of $lang/$dir/$page to keep all languages in their own subdir, rather than spread throughout the site.
Andrew Lewman

Andrew Lewman commited on 2010-07-14 21:39:08
Zeige 3 geänderte Dateien mit 11 Einfügungen und 10 Löschungen.

... ...
@@ -48,7 +48,7 @@ sub translation_get_masterrevision() {
48 48
 
49 49
 sub translation_get_basedonrevision_langfile($$$) {
50 50
 	my ($dir, $lang, $page) = @_;
51
-	my $translation = getMetadata("$dir/$lang/$page");
51
+	my $translation = getMetadata("$lang/$dir/$page");
52 52
 
53 53
 	if (exists $translation->{'Based-On-Revision'}) {
54 54
 		return $translation->{'Based-On-Revision'};
... ...
@@ -67,7 +67,7 @@ sub translation_current() {
67 67
 
68 68
 sub file_is_obsolete($$$) {
69 69
 	my ($dir, $lang, $page) = @_;
70
-	my $translation = getMetadata("$dir/$lang/$page");
70
+	my $translation = getMetadata("$lang/$dir/$page");
71 71
 	return (exists $translation->{'Status'} && ($translation->{'Status'} eq 'obsolete'))
72 72
 };
73 73
 
... ...
@@ -69,7 +69,7 @@
69 69
 	            $dir = '.' unless defined $dir;
70 70
                 
71 71
               # translated version
72
-              if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
72
+              if (-e "$(DOCROOT)/$lang/$dir/$base.wml") {
73 73
                   printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
74 74
                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
75 75
               } 
... ...
@@ -82,7 +82,8 @@
82 82
               elsif ($key =~/^http/) {
83 83
                 printf '<li><a href="%s">%s</a></li>'."\n", $key, $navigation{$key};
84 84
               } else {
85
-                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.";
85
+                warn "$WML_SRC_FILENAME has a [page $key] (parses to
86
+docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$lang/$dir/$base.wml), but that doesn't exist.";
86 87
               }
87 88
             }
88 89
         }:>
... ...
@@ -118,7 +119,7 @@
118 119
 
119 120
 	          $dir = '.' unless defined $dir;
120 121
               # try to use a translated version
121
-              if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
122
+              if (-e "$(DOCROOT)/$lang/$dir/$base.wml") {
122 123
                   printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
123 124
                          stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
124 125
               } 
... ...
@@ -127,7 +128,7 @@
127 128
               	printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
128 129
                   stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $calltoaction{$key};
129 130
               } else {
130
-                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.";
131
+                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.";
131 132
               }
132 133
             }    
133 134
           }:>
... ...
@@ -23,14 +23,14 @@
23 23
  	    my ($page, $lang) = @_;
24 24
 	    my ($dir, $base) = $page =~ m,^(?:(.*)/)?(.*?)$,;
25 25
 	    $dir = '.' unless defined $dir;
26
-	    if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
26
+	    if (-e "$(DOCROOT)/$lang/$dir/$base.wml") {
27 27
 	    	return stripDotSlashs("$(DOCROOT)/$dir/$base.html.$lang");
28 28
 	    } elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
29 29
 	    	return stripDotSlashs("$(DOCROOT)/$dir/$base.html");
30 30
         } elsif ($page =~ /^http/) {
31 31
           return $page;
32 32
 	    } else {
33
-	    	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.";
33
+	    	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.";
34 34
 	    }; 
35 35
     }
36 36
 :>
... ...
@@ -43,10 +43,10 @@
43 43
 	$dir = '.' unless defined $dir;
44 44
 	if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
45 45
 		print stripDotSlashs("$(DOCROOT)/$dir/$base.html.$lang");
46
-	} elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
46
+	} elsif (-e "$(DOCROOT)/en/$dir/$base.wml") {
47 47
 		print stripDotSlashs("$(DOCROOT)/$dir/$base.html");
48 48
 	} else {
49
-		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.";
49
+		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.";
50 50
 	};
51 51
 }:>
52 52
 </define-tag>
53 53