This allows the user to type zh_TW and still get Chinese from the zh-TW
authoracli <acli>
Tue, 10 Feb 2004 00:43:21 +0000 (00:43 +0000)
committeracli <acli>
Tue, 10 Feb 2004 00:43:21 +0000 (00:43 +0000)
directory.

C4/Output.pm

index a01ab51..2380af9 100644 (file)
@@ -129,10 +129,14 @@ sub themelanguage {
   THEME:
   foreach my $th (@themes) {
     foreach my $la (@languages) {
-       if (-e "$htdocs/$th/$la/$tmpl") {
-           $theme = $th;
-           $lang = $la;
-           last THEME;
+       for (my $pass = 1; $pass <= 2; $pass += 1) {
+         $la =~ s/([-_])/ $1 eq '-'? '_': '-' /eg if $pass == 2;
+         if (-e "$htdocs/$th/$la/$tmpl") {
+             $theme = $th;
+             $lang = $la;
+             last THEME;
+         }
+       last unless $la =~ /[-_]/;
        }
     }
   }