make the farsi translations include sidenav, header, footer, navigation so they can use the right to left css and even look correct.
Andrew Lewman

Andrew Lewman commited on 2011-08-29 04:12:07
Zeige 5 geänderte Dateien mit 401 Einfügungen und 0 Löschungen.

... ...
@@ -0,0 +1,131 @@
1
+#!/usr/bin/env wml
2
+#use "functions.wmi"
3
+
4
+    <div id="footer">
5
+    	<div class="onion"><img src="$(IMGROOT)/onion.jpg" alt="Tor"></div>
6
+      <div class="about">
7
+	<p>"Tor" and the "Onion Logo" are registered trademarks of
8
+	<a href="<page docs/trademark-faq>">The Tor Project, Inc.</a>
9
+	Content on this site is licensed under a <a
10
+	href="http://creativecommons.org/licenses/by/3.0/us/">Creative
11
+	Commons Attribution 3.0 United States License</a>, unless
12
+	otherwise noted.</p>
13
+<!--
14
+        # This will grab the date from svn info but formatting is tedious
15
+       	# REQUIRES svn for this to work
16
+        <:{
17
+          my $svninfo = `svn info`;
18
+          if ($svninfo =~ m/Last Changed Date: (\d{4}-\d{2}-\d{2})\s(\d{2}:\d{2}:\d{2})\s(.*)\s\((.*)\)/) {
19
+            my $modifydate = "$4 $2 $3";
20
+            # remove commas from date
21
+            $modifydate =~ s/,//;
22
+            print 'Last modified: '.$modifydate."\n";
23
+          }
24
+        }:>
25
+        <:{
26
+          #my $compiledate = `date`;
27
+          my $compiledate = `date +"%a %b %d %Y %k:%M:%S %z"`;
28
+          print 'Last compiled: '.$compiledate."\n";
29
+        }:>
30
+-->
31
+      </div>
32
+      <!-- END ABOUT -->
33
+      <!-- WE HAVE NO NEWSLETTER SO REMOVE THIS
34
+      <div class="newsletter">
35
+        <form action="">
36
+          <input class="textfield" type="text" name="email" value="Sign up for our newsletter! Enter email." onClick="clearDefault(this);">
37
+          <input class="signup" type="submit" name="submit" value="Sign Up">
38
+        </form>
39
+      </div>
40
+      END NEWSLETTER -->
41
+      <div class="col first">
42
+      	<h4>About Tor</h4>
43
+        <ul>
44
+          <li><a href="<page about/overview>">What Tor Does</a></li>
45
+          <li><a href="<page about/torusers>">Users of Tor</a></li>
46
+          <li><a href="<page about/corepeople>">Core Tor People</a></li>
47
+          <li><a href="<page about/sponsors>">Sponsors</a></li>
48
+          <li><a href="<page about/contact>">Contact Us</a></li>
49
+        </ul>
50
+      </div>
51
+      <!-- END COL -->
52
+      <div class="col">
53
+      	<h4>Get Involved</h4>
54
+        <ul>
55
+          <li><a href="<page donate/donate>">Donate</a></li>
56
+          <li><a href="<page docs/documentation>#MailingLists">Mailing List</a></li>
57
+          <li><a href="<page getinvolved/mirrors>">Mirrors</a></li>
58
+          <li><a href="<page docs/hidden-services>">Hidden Services</a></li>
59
+          <li><a href="<page getinvolved/translation>">Translations</a></li>
60
+#          <li><a href="<page getinvolved/open-positions>">Careers</a></li>
61
+        </ul>
62
+      </div>
63
+      <!-- END COL -->
64
+      <div class="col">
65
+      	<h4>Documentation</h4>
66
+        <ul>
67
+          <li><a href="<page docs/tor-manual>">Manuals</a></li>
68
+          <li><a href="<page docs/documentation>">Installation Guides</a></li>
69
+          <li><a href="<wiki>">Tor Wiki</a></li>
70
+          <li><a href="<page docs/faq>">General Tor FAQ</a></li>
71
+        </ul>
72
+      </div>
73
+      <!-- END COL -->
74
+
75
+	<!-- List available languages -->
76
+	<div class="col wider">
77
+	<h4>Languages</h4>
78
+	<: if (has_translations()) {  :>
79
+		<p>
80
+		This page is also available in the following languages:
81
+		<: print list_translations() :>.<br />
82
+		How to set <a href="http://www.debian.org/intro/cn#howtoset">the default document language</a>.
83
+		</p>
84
+	<: }; :>
85
+	</div>
86
+
87
+# LANGUAGE SWITCH CGI 
88
+#      <div class="col wider">
89
+#      	<h4>Languages</h4>
90
+#        # this is a cgi trampoline to bounce us to the right page
91
+#        # alternately, if the client supports javascript we can redirect that way
92
+#        # noscript does not block onclick but clients may have disabled javascript completely
93
+#        #
94
+#        # for this to work we need to know the relative path from the document root
95
+#        # to the current directory that wml is in. 
96
+#        <form action="$(DOCROOT)/cgi-bin/languageswitch.cgi">
97
+#          <select name="Language" id="lang">
98
+#          <:{
99
+#            #import "perl-globals.wmi";
100
+#            use Cwd;
101
+#            use Cwd 'abs_path';
102
+#            use File::Spec;
103
+#            my $urlbase = File::Spec->abs2rel(getcwd(),abs_path("$(DOCROOT)"));
104
+#            my $LANGUAGES;
105
+#            my $page = $WML_SRC_FILENAME;
106
+#            opendir(DIR, getcwd()) or die $!;
107
+#            # take a look and see what language support we have
108
+#            while (my $file = readdir(DIR)) {
109
+#                if (-d $file) {
110
+#                    if (-e "$file/$page") {
111
+#                        my $url = $urlbase.'/'.$WML_SRC_BASENAME.'.html.'.$file;
112
+#                        my $url2js = $WML_SRC_BASENAME.'.html.'.$file;
113
+#                        print '<option value="'.$url.'" onclick="window.location=\''.$url2js.'\'">'.$LANGUAGES{$file}.'</option>'."\n" unless not defined $LANGUAGES{$file};
114
+#                    }
115
+#                }
116
+#            }
117
+#            closedir(DIR);
118
+#          }:>
119
+#          </select>
120
+#          <input class="go" type="submit" name="submit" value="Go">
121
+#        </form>
122
+#        <p>Questions on this? Visit <a href="http://www.debian.org/intro/cn#howtoset">how to set the default document language</a>.</p>
123
+#      </div>
124
+#
125
+    </div>
126
+    <!-- END FOOTER -->
127
+
128
+  </div>
129
+  <!-- END WRAP -->
130
+</body>
131
+</html>
... ...
@@ -0,0 +1,145 @@
1
+#! /usr/bin/wml
2
+<: use strict; :>
3
+<: use warnings; :>
4
+#use "perl-globals.wmi"
5
+#use "links.wmi"
6
+#use "versions.wmi"
7
+#use "navigation.wmi"
8
+
9
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
10
+<html>
11
+<head>
12
+  <title>$(TITLE)</title>
13
+  <link rel="shortcut icon" type="image/x-icon" href="$(IMGROOT)/favicon.ico">
14
+  <ifneq "$(REDIRECT)" "" "<meta http-equiv="refresh" content="0;url=$(DOCROOT)/$(REDIRECT)">">
15
+  <ifneq "$(REDIRECT_GLOBAL)" "" "<meta http-equiv="refresh" content="0;url=$(REDIRECT_GLOBAL)">">
16
+  <ifeq "$(ANNOUNCE_RSS)" "yes" "<link rel="alternate" title="Tor Project OR-announce" href="http://rss.gmane.org/gmane.network.onion-routing.announce"
17
+type="application/rss+xml">">
18
+
19
+  # begin WML to generate css/js paths 
20
+  <ifneq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/$(STYLESHEET)">">
21
+  <ifeq "$(STYLESHEET)" "" "<link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/master.css">">
22
+
23
+  #<link href="css/master.css" rel="stylesheet" type="text/css">
24
+  <!--[if lte IE 8]>
25
+  <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie8-and-down.css">
26
+  <![endif]-->
27
+  <!--[if lte IE 7]>
28
+  <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie7-and-down.css">
29
+  <![endif]-->
30
+  <!--[if IE 6]>
31
+  <link rel="stylesheet" type="text/css" href="$(DOCROOT)/css/ie6.css">
32
+  <![endif]-->
33
+#  <script language="javascript" type="text/javascript" src="$(DOCROOT)/global.js"></script>
34
+  # end WML to generate css/js paths 
35
+
36
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
37
+  <meta name="author" content="The Tor Project, Inc.">
38
+  <meta name="keywords" content="anonymity online, tor, tor project, censorship circumvention, traffic analysis, anonymous communications research">
39
+</head>
40
+<body>
41
+<div id="wrap">
42
+  <div id="header">
43
+    <h1 id="logo"><a href="<page index>">Tor</a></h1>
44
+      # navigation menu generation
45
+      <div id="nav">
46
+        <ul>
47
+        <:{
48
+            # create a hash and maintain order of keys
49
+            my %navigation;
50
+            my @keys;
51
+            while (@navigation) {
52
+              my $key = shift @navigation;
53
+              my $val = shift @navigation;
54
+              push @keys, $key;
55
+              $navigation{$key} = $val;
56
+            }
57
+
58
+            my $page = $WML_SRC_BASENAME;
59
+            my $lang = "$(LANG)";
60
+
61
+            for my $key (@keys) {
62
+              my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;  
63
+
64
+              # in directory of active link, set class active 
65
+              my $class;
66
+              if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
67
+                $class = 'class="active"';
68
+              } else {
69
+                $class = '';
70
+              }
71
+
72
+	            $dir = '.' unless defined $dir;
73
+                
74
+              # translated version
75
+              if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
76
+                  printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
77
+                         stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$navigation{$key};
78
+              } 
79
+              # english version
80
+              elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
81
+              	printf '<li><a '.$class.' href="%s">%s</a></li>'."\n",
82
+                  stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $navigation{$key};
83
+              }
84
+              # full url
85
+              elsif ($key =~/^http/) {
86
+                printf '<li><a href="%s">%s</a></li>'."\n", $key, $navigation{$key};
87
+              } else {
88
+                warn "$WML_SRC_FILENAME has a [page $key] (parses to
89
+docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), but that doesn't exist.";
90
+              }
91
+            }
92
+        }:>
93
+        </ul>
94
+      </div>
95
+      <!-- END NAV -->
96
+     # end navigation generation
97
+      <div id="calltoaction">
98
+        <ul>
99
+          <:{
100
+            my %calltoaction;
101
+            my @keys;
102
+            while (@calltoaction) {
103
+              my $key = shift @calltoaction;
104
+              my $val = shift @calltoaction;
105
+              push @keys, $key;
106
+              $calltoaction{$key} = $val;
107
+            } 
108
+
109
+            my $page = $WML_SRC_BASENAME;
110
+            my $lang = "$(LANG)";
111
+            for my $key (@keys) {
112
+              my ($dir, $base) = $key =~ m,^(?:(.*)/)?(.*?)$,;  
113
+
114
+              # in directory, set active 
115
+              my $class;
116
+              if ((defined $dir) and ($WML_SRC_DIRNAME =~/$dir/) or ($WML_SRC_BASENAME eq $base)) {
117
+              #if ($WML_SRC_BASENAME eq $base) {
118
+                $class = 'class="active"';
119
+              } else {
120
+                $class = '';
121
+              }
122
+
123
+	          $dir = '.' unless defined $dir;
124
+              # try to use a translated version
125
+              if (-e "$(DOCROOT)/$dir/$lang/$base.wml") {
126
+                  printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
127
+                         stripDotSlashs("$(DOCROOT)/$dir/$base.html.$(LANG)"),$calltoaction{$key};
128
+              } 
129
+              # default to english version
130
+              elsif (-e "$(DOCROOT)/$dir/en/$base.wml") {
131
+              	printf '<li class="donate"><a '.$class.' href="%s">%s</a></li>'."\n",
132
+                  stripDotSlashs("$(DOCROOT)/$dir/$base.html"), $calltoaction{$key};
133
+              } else {
134
+                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.";
135
+              }
136
+            }    
137
+          }:>
138
+        </ul>
139
+      </div>
140
+      <!-- END CALLTOACTION -->
141
+  </div>
142
+  <!-- END HEADER -->
143
+
144
+#<ifneq "$(REDIRECT)" "" "Redirecting to <a href="$(DOCROOT)/$(REDIRECT)">$(DOCROOT)/$(REDIRECT)</a>.">
145
+#<ifneq "$(REDIRECT_GLOBAL)" "" "Redirecting to <a href="$(REDIRECT_GLOBAL)">$(REDIRECT_GLOBAL)</a>.">
... ...
@@ -0,0 +1,10 @@
1
+#!/usr/bin/env wml
2
+<div class="img-shadow">
3
+  <div class="infoblock">
4
+    <h2 class="bulb">Tor Tip</h2>
5
+    <p>Tor is written for and supported by people like you. <a href="<page
6
+donate/donate>">Donate today</a>!</p>
7
+  </div>
8
+  <!-- END INFOBLOCK -->              
9
+</div>
10
+<!-- END IMG-SHADOW -->              
... ...
@@ -0,0 +1,24 @@
1
+#!/usr/bin/wml
2
+
3
+## translation metadata
4
+# Revision: $Revision: 22069 $
5
+# Translation-Priority: 1-high
6
+
7
+<:
8
+    # path                              link text
9
+    my @navigation = (
10
+        'index'                        , 'Home',
11
+        'about/overview'              , 'About Tor',
12
+        'docs/documentation'          , 'Documentation',
13
+        'projects/projects'           , 'Projects',
14
+        'press/press'                 , 'Press',
15
+        '<blog>'                      , 'Blog',
16
+        'http://printfection.com/torprojectstore' , 'Store',
17
+    );
18
+    my @calltoaction = (
19
+        'download/download'                , 'Download',
20
+        'getinvolved/volunteer'            , 'Volunteer',
21
+        'donate/donate'                    , 'Donate',
22
+    );
23
+
24
+:>
... ...
@@ -0,0 +1,91 @@
1
+#! /usr/bin/wml
2
+<: use strict; :>
3
+<: use warnings; :>
4
+#use "perl-globals.wmi"
5
+#use "links.wmi"
6
+#use "versions.wmi"
7
+#use "sidenav.wmi"
8
+<div class="img-shadow">
9
+  <div id="sidenav">
10
+    <:
11
+      # recursively search menu structure to see if it contains a given page
12
+      sub containsSub($$);
13
+      sub containsSub($$) {
14
+          my ($elements, $page) = @_;
15
+          for my $ele (@{$elements}) {
16
+              if (containsSub($ele->{'subelements'},$page)){
17
+                  return 1;
18
+              } elsif ($page eq $ele->{'url'}) {
19
+                  return 1;
20
+              }
21
+
22
+          }
23
+          return 0;
24
+      } 
25
+
26
+      # generate navigation menu
27
+      sub printNavMenu($$$);
28
+      sub printNavMenu($$$) {
29
+          my ($navmenu, $page, $lang) = @_;
30
+          print '<ul>'."\n";
31
+          for my $navmenu (@{$navmenu}) {
32
+              # this menu entry is the current (active) page
33
+              if ($navmenu->{'url'} eq $page) {
34
+      
35
+                  # the current page has nested menu elements
36
+                  if ($navmenu->{'subelements'}) { # menu has dropdown
37
+                      printf '<li class="dropdown active"><a class="active" href="%s">%s</a></li>'."\n",
38
+                             pageToURL($navmenu->{'url'}, $lang), $navmenu->{'txt'}; 
39
+      
40
+                      print '<li>'."\n";
41
+                      printNavMenu($navmenu->{'subelements'},$page,$lang); 
42
+                      print '</li>'."\n";
43
+
44
+                  # the current (active) page does not have sub elements
45
+                  } else {
46
+                      printf '<li class="active"><a class="active" href="%s">%s</a></li>'."\n",
47
+                             pageToURL($navmenu->{'url'}, $lang), $navmenu->{'txt'}; 
48
+                  }
49
+      
50
+              # a subelement of this menu item is the current (active) page
51
+              } elsif (containsSub($navmenu->{'subelements'}, $page)) {
52
+                  printf '<li class="dropdown"><a class="active" href="%s">%s</a></li>'."\n",
53
+                         pageToURL($navmenu->{'url'}, $lang), $navmenu->{'txt'};
54
+
55
+                  print '<li>'."\n"; #encapsulate subelements
56
+                  # recurse to generate the expanded menu
57
+                  printNavMenu($navmenu->{'subelements'},$page,$lang); 
58
+                  print '</li>'."\n"; #encapsulate subelements
59
+      
60
+              # the menu entry is not active and does not enclose the active page
61
+              } else {
62
+
63
+                  # if there are subelements, set collapsed style
64
+                  if ($navmenu->{'subelements'}) {
65
+                      printf '<li class="dropdown"><a href="%s">%s</a></li>'."\n",
66
+                             pageToURL($navmenu->{'url'}, $lang), $navmenu->{'txt'};
67
+                  # regular menu entry
68
+                  } else {
69
+                      printf '<li><a href="%s">%s</a></li>'."\n",
70
+                             pageToURL($navmenu->{'url'}, $lang), $navmenu->{'txt'};
71
+                  }
72
+              }
73
+          }
74
+          print '</ul>'."\n";
75
+      }
76
+
77
+      my $lang = "$(LANG)";
78
+
79
+      use Cwd;
80
+      use Cwd 'abs_path';
81
+      use File::Spec;
82
+      
83
+      # get document path from site root
84
+      my $path = File::Spec->abs2rel(getcwd(),abs_path("$(DOCROOT)"));
85
+      my $page = $WML_SRC_BASENAME; 
86
+      printNavMenu($sidenav, $path.'/'.$page, $lang);
87
+    :>
88
+  </div>
89
+  <!-- END SIDENAV -->
90
+</div>
91
+<!-- END IMG-SHADOW -->
0 92