[Jifty-commit] r6966 - jifty/trunk/lib/Jifty/Manual

Jifty commits jifty-commit at lists.jifty.org
Sat May 9 11:38:50 EDT 2009


Author: c9s
Date: Sat May  9 11:38:50 2009
New Revision: 6966

Modified:
   jifty/trunk/lib/Jifty/Manual/Tutorial_zhtw.pod

Log:
 Tutorial_zhtw: translate the complex way section


Modified: jifty/trunk/lib/Jifty/Manual/Tutorial_zhtw.pod
==============================================================================
--- jifty/trunk/lib/Jifty/Manual/Tutorial_zhtw.pod	(original)
+++ jifty/trunk/lib/Jifty/Manual/Tutorial_zhtw.pod	Sat May  9 11:38:50 2009
@@ -314,19 +314,18 @@
 
 現在你到 C<http://localhost:8888> ,你就可以看到你所有的文章了。
 
-=head4 The complex way that gets you lots of cool toys
+=head4 酷但也比較複雜的方式
 
-The I<complex way> involves using one of Jifty's advanced features:
-I<Page regions>. These regions let your application reload page sections
-independently, either using AJAX on modern high-end browsers or regular GET
-requests with downlevel browsers such as C<lynx> and C<w3m>.
-
-The downside of this approach is that each separate region needs to live in
-its own template. Happily, this is a good design practice even without regions.
-
-The complex way starts off about the same as the easy way. Replace (or add, if
-you shied away from simplicity) the '/' template in your
-F<lib/MyWeblog/View.pm>:
+這個 I<complex way> 會使用 Jifty 的進階功能之一:  頁面區塊 I<Page regions>
+不論你是用現在高階網頁瀏覽器來使用 AJAX 或是使用低階瀏覽器如 C<lynx> 或 C<w3m> 
+來做一般的 GET 要求,這些區塊可以讓你的應用程式只單獨對你頁面中的小部份區塊獨立更新
+
+這種方式的下層其實是每個分開的區塊都需要存在在它所屬的樣板 (template) 內。
+然而就算不用區塊 (regions) 這也是一個相當不錯的設計練習。
+
+這個較複雜的方式初步與上頭介紹的簡單方式是一樣的。
+取代 (or add, if you shied away from simplicity) 原本你 
+F<lib/MyWeblog/View.pm> 內的 '/' 樣板:
 
   template '/' => page {
       render_region(
@@ -335,29 +334,29 @@
       );
   };
 
-If you're on the ball, you've probably already guessed that you need to create
-a template called C</fragments/page_of_posts>. Make it contain the following:
+如果你已經了解狀況,你大概已經猜到我們需要建立一個樣板叫做 
+C</fragments/page_of_posts>。 讓這個樣板填入以下程式:
 
   template '/fragments/page_of_posts' => sub {
-      # Retrieve the current page argument, defaulting to 1.
+      # 取得目前頁數的參數,預設是 1
       my $page = get('page') || 1;
       
-      # Get all posts.
+      # 取得所有文章
       my $posts = MyWeblog::Model::PostCollection->new;
       $posts->unlimit;
       
-      # Display up to three posts on the current page.
+      # 讓設定目前頁數,並且每頁顯示三篇文章
       $posts->set_page_info(
           current_page => $page,
           per_page     => 3,
       );
   
-      # Notify the user what page they're on if there are multiple.
+      # 顯示我們在第幾頁上頭
       if ($posts->pager->last_page > 1) {
           p { "Page $page of " . $posts->pager->last_page }
       }
   
-      # Display the current page of posts.
+      # 顯示目前頁面的文章
       dl {
           attr { class => 'list' };
   
@@ -367,8 +366,7 @@
           }
       };
   
-      # Previous page link, the 'page' argument here will set a new value when
-      # this region is invoked again.
+      # 回前頁的連結, 當區塊重新被呼叫時,這裡的 'page' 參數會被設定新的數值
       if ($posts->pager->previous_page) {
           hyperlink(
               label => 'Previous Page',
@@ -380,7 +378,7 @@
           );
       }
   
-      # Next page link.
+      # 下一頁的連結
       if ($posts->pager->next_page) {
           hyperlink(
               label => 'Next Page',
@@ -393,11 +391,13 @@
       }
   };
 
-Now fire up your Jifty webserver again. Browse to C</post> and create more than
-three posts. Return to the home page and check out the nifty AJAX C<Next Page>
-and C<Previous Page> links you now have. Turn off javascript or view the page
-in C<lynx>, and notice how the AJAX automatically falls-back to page loads for
-you. All for free, thanks to Jifty!
+現在重新啟動你的 Jifty 網頁伺服器。瀏覽 C</post> 並且建立三份以上的文章。
+回到首頁,並且玩玩看 C<Next Page> 以及 C<Previous Page> 的 AJAX 連結。
+
+關掉你瀏覽器的 Javascript 或者用 C<lynx> 來瀏覽,你可注意網頁上使用的 AJAX 
+如何自動退回到使用基本載入頁面。
+
+所有都是免費並且自由的,感謝 Jifty!
 
 =head3 Hey, where'd that class come from?
 


More information about the Jifty-commit mailing list