Make WordPress Core


Ignore:
Timestamp:
02/28/2010 11:43:04 AM (17 years ago)
Author:
dd32
Message:

Better internationalisation for TwentyTen. Props filosofo. Fixes #12384

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyten/loop.php

    r13255 r13498  
    1 <?php if ( $wp_query->max_num_pages > 1 ) { ?>
     1<?php if ( $wp_query->max_num_pages > 1 ) : ?>
    22        <div id="nav-above" class="navigation">
    33                <div class="nav-previous"><?php next_posts_link(__( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' )); ?></div>
    44                <div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' )); ?></div>
    55        </div><!-- #nav-above -->
    6 <?php } ?>
     6<?php endif; ?>
    77
    88<?php if ( ! have_posts() ) : ?>
     
    1717
    1818<?php while ( have_posts() ) : the_post(); ?>
    19 <?php if ( in_category( 'Gallery' ) ) { ?>
    20         <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    21                 <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__('Permalink to %s', 'twentyten'), the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
     19        <?php if ( in_category( 'Gallery' ) ) : ?>
     20                <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     21                        <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__('Permalink to %s', 'twentyten'), the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    2222
    23                 <div class="entry-meta">
    24                         <span class="meta-prep meta-prep-author"><?php _e( 'Posted on ', 'twentyten' ); ?></span>
    25                         <a href="<?php the_permalink(); ?>" title="<?php the_time(); ?>" rel="bookmark"><span class="entry-date"><?php echo get_the_date(); ?></span></a>
    26                         <span class="meta-sep"> <?php _e( 'by ', 'twentyten' ); ?> </span>
    27                         <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( get_the_author_meta('ID') ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php the_author(); ?></a></span>
    28                 </div><!-- .entry-meta -->
     23                        <div class="entry-meta">
     24                                <?php
     25                                        printf(__( '<span class="meta-prep meta-prep-author">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s">%6$s</a></span>', 'twentyten'),
     26                                                get_permalink(),
     27                                                esc_attr( get_the_time() ),
     28                                                get_the_date(),
     29                                                get_author_posts_url( get_the_author_meta('ID') ),
     30                                                sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
     31                                                get_the_author()
     32                                        );
     33                                ?>
     34                        </div><!-- .entry-meta -->
    2935
    30                 <div class="entry-content">
    31                         <div class="gallery-thumb">
    32                                 <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php
    33                                 $images =& get_children( array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999) );
    34                                 $total_images = count($images);
    35                                 $image = array_shift($images);
    36                                 echo wp_get_attachment_image( $image->ID, 'thumbnail' );
    37                                 ?></a>
    38                         </div>
    39                         <p><em><?php printf( __('This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten'), 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__('Permalink to %s', 'twentyten'), the_title_attribute('echo=0') ) . '" rel="bookmark"', $total_images ); ?></em></p>
     36                        <div class="entry-content">
     37                                <div class="gallery-thumb">
     38                                        <a class="size-thumbnail" href="<?php the_permalink(); ?>"><?php
     39                                        $images = get_children( array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999) );
     40                                        $total_images = count($images);
     41                                        $image = array_shift($images);
     42                                        echo wp_get_attachment_image( $image->ID, 'thumbnail' );
     43                                        ?></a>
     44                                </div>
     45                                <p><em><?php printf( __('This gallery contains <a %1$s>%2$s photos</a>.', 'twentyten'),
     46                                                'href="' . get_permalink() . '" title="' . sprintf( esc_attr__('Permalink to %s', 'twentyten'), the_title_attribute('echo=0') ) . '" rel="bookmark"',
     47                                                $total_images
     48                                        ); ?></em></p>
    4049
    41                         <?php the_excerpt( '' ); ?>
    42                 </div><!-- .entry-content -->
     50                                <?php the_excerpt( '' ); ?>
     51                        </div><!-- .entry-content -->
    4352
    44                 <div class="entry-utility">
    45                         <?php
    46                                 $category_id = get_cat_ID( 'Gallery' );
    47                                 $category_link = get_category_link( $category_id );
    48                         ?>
    49                         <a href="<?php echo $category_link; ?>" title="<?php esc_attr_e('View posts in the Gallery category', 'twentyten'); ?>"><?php _e('More Galleries', 'twentyten'); ?></a>
    50                         <span class="meta-sep"><?php _e( ' | ', 'twentyten' ); ?></span>
    51                         <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    52                         <?php edit_post_link( __( 'Edit', 'twentyten' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t\n" ); ?>
    53                 </div><!-- #entry-utility -->
    54         </div>
     53                        <div class="entry-utility">
     54                                <?php
     55                                        $category_id = get_cat_ID( 'Gallery' );
     56                                        $category_link = get_category_link( $category_id );
     57                                ?>
     58                                <a href="<?php echo $category_link; ?>" title="<?php esc_attr_e('View posts in the Gallery category', 'twentyten'); ?>"><?php _e('More Galleries', 'twentyten'); ?></a>
     59                                <span class="meta-sep"> | </span>
     60                                <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
     61                                <?php edit_post_link( __( 'Edit', 'twentyten' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t\n" ); ?>
     62                        </div><!-- #entry-utility -->
     63                </div>
    5564
    5665
    57 <?php } elseif ( in_category( 'asides' ) ) { ?>
    58         <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    59 <?php if ( is_archive() || is_search() ) : //Only display Excerpts for archives & search ?>
    60                 <div class="entry-summary">
    61                         <?php the_excerpt( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
    62                 </div><!-- .entry-summary -->
    63 <?php else : ?>
    64                 <div class="entry-content">
    65                         <?php the_content( __( 'Continue&nbsp;reading&nbsp;<span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
    66                 </div><!-- .entry-content -->
    67 <?php endif; ?>
     66        <?php elseif ( in_category( 'asides' ) ) : ?>
     67                <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     68        <?php if ( is_archive() || is_search() ) : //Only display Excerpts for archives & search ?>
     69                        <div class="entry-summary">
     70                                <?php the_excerpt( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
     71                        </div><!-- .entry-summary -->
     72        <?php else : ?>
     73                        <div class="entry-content">
     74                                <?php the_content( __( 'Continue&nbsp;reading&nbsp;<span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
     75                        </div><!-- .entry-content -->
     76        <?php endif; ?>
    6877
    69                 <div class="entry-utility">
    70                         <span class="meta-prep meta-prep-author"><?php _e( 'Posted on ', 'twentyten' ); ?></span>
    71                         <a href="<?php the_permalink(); ?>" title="<?php the_time(); ?>" rel="bookmark"><span class="entry-date"><?php echo get_the_date(); ?></span></a>
    72                         <span class="meta-sep"> <?php _e( ' by ', 'twentyten' ); ?> </span>
    73                         <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( get_the_author_meta('ID') ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php the_author(); ?></a></span>
    74                         <span class="meta-sep"><?php _e( ' | ', 'twentyten' ); ?></span>
    75                         <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    76                         <?php edit_post_link( __( 'Edit', 'twentyten' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t\n" ); ?>
    77                 </div><!-- #entry-utility -->
    78         </div><!-- #post-<?php the_ID(); ?> -->
     78                        <div class="entry-utility">
     79                                <?php
     80                                        printf(__( '<span class="meta-prep meta-prep-author">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s">%6$s</a></span>', 'twentyten'),
     81                                                get_permalink(),
     82                                                esc_attr( get_the_time() ),
     83                                                get_the_date(),
     84                                                get_author_posts_url( get_the_author_meta('ID') ),
     85                                                sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
     86                                                get_the_author()
     87                                        );
     88                                ?>
     89                                <span class="meta-sep"> | </span>
     90                                <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
     91                                <?php edit_post_link( __( 'Edit', 'twentyten' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t\n" ); ?>
     92                        </div><!-- #entry-utility -->
     93                </div><!-- #post-<?php the_ID(); ?> -->
    7994
    8095
    81 <?php } else { ?>
    82         <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    83                 <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__('Permalink to %s', 'twentyten'), the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
     96        <?php else : ?>
     97                <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     98                        <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__('Permalink to %s', 'twentyten'), the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    8499
    85                 <div class="entry-meta">
    86                         <span class="meta-prep meta-prep-author"><?php _e('Posted on ', 'twentyten'); ?></span>
    87                         <a href="<?php
    88 the_permalink(); ?>" title="<?php the_time(); ?>" rel="bookmark"><span class="entry-date"><?php echo get_the_date(); ?></span></a>
    89                         <span class="meta-sep"><?php _e( ' by ', 'twentyten' ); ?></span>
    90                         <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( get_the_author_meta('ID') ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php the_author(); ?></a></span>
    91                 </div><!-- .entry-meta -->
     100                        <div class="entry-meta">
     101                                <?php
     102                                        printf(__( '<span class="meta-prep meta-prep-author">Posted on </span><a href="%1$s" title="%2$s" rel="bookmark"><span class="entry-date">%3$s</span></a> <span class="meta-sep"> by </span> <span class="author vcard"><a class="url fn n" href="%4$s" title="%5$s">%6$s</a></span>', 'twentyten'),
     103                                                get_permalink(),
     104                                                esc_attr( get_the_time() ),
     105                                                get_the_date(),
     106                                                get_author_posts_url( get_the_author_meta('ID') ),
     107                                                sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
     108                                                get_the_author()
     109                                        );
     110                                ?>
     111                        </div><!-- .entry-meta -->
    92112
    93 <?php if ( is_archive() || is_search() ) : //Only display Excerpts for archives & search ?>
    94                 <div class="entry-summary">
    95                         <?php the_excerpt( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
    96                 </div><!-- .entry-summary -->
    97 <?php else : ?>
    98                 <div class="entry-content">
    99                         <?php the_content( __( 'Continue&nbsp;reading&nbsp;<span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
    100                         <?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'twentyten' ) . '&after=</div>'); ?>
    101                 </div><!-- .entry-content -->
    102 <?php endif; ?>
     113        <?php if ( is_archive() || is_search() ) : //Only display Excerpts for archives & search ?>
     114                        <div class="entry-summary">
     115                                <?php the_excerpt( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
     116                        </div><!-- .entry-summary -->
     117        <?php else : ?>
     118                        <div class="entry-content">
     119                                <?php the_content( __( 'Continue&nbsp;reading&nbsp;<span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
     120                                <?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'twentyten' ) . '&after=</div>'); ?>
     121                        </div><!-- .entry-content -->
     122        <?php endif; ?>
    103123
    104                 <div class="entry-utility">
    105                         <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php echo twentyten_cat_list(); ?></span></span>
    106                         <span class="meta-sep"><?php _e( ' | ', 'twentyten' ); ?></span>
    107                         <?php $tags_text = twentyten_tag_list(); ?>
    108                         <?php if ( !empty($tags_text) ) : ?>
    109                         <span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links"><?php echo $tags_text; ?></span></span>
    110                         <span class="meta-sep"><?php _e( ' | ', 'twentyten' ); ?></span>
    111                         <?php endif; //$tags_text ?>
    112                         <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    113                         <?php edit_post_link( __( 'Edit', 'twentyten' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t\n" ); ?>
    114                 </div><!-- #entry-utility -->
    115         </div><!-- #post-<?php the_ID(); ?> -->
     124                        <div class="entry-utility">
     125                                <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php echo twentyten_cat_list(); ?></span></span>
     126                                <span class="meta-sep"> | </span>
     127                                <?php $tags_text = twentyten_tag_list(); ?>
     128                                <?php if ( !empty($tags_text) ) : ?>
     129                                <span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links"><?php echo $tags_text; ?></span></span>
     130                                <span class="meta-sep"> | </span>
     131                                <?php endif; //$tags_text ?>
     132                                <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
     133                                <?php edit_post_link( __( 'Edit', 'twentyten' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t\n" ); ?>
     134                        </div><!-- #entry-utility -->
     135                </div><!-- #post-<?php the_ID(); ?> -->
    116136
    117         <?php comments_template( '', true ); ?>
     137                <?php comments_template( '', true ); ?>
    118138
    119 <?php } ?>
     139        <?php endif; // if different categories queried ?>
    120140<?php endwhile; ?>
    121141
    122 <?php if (  $wp_query->max_num_pages > 1 ) { ?>
     142<?php if (  $wp_query->max_num_pages > 1 ) : ?>
    123143                                <div id="nav-below" class="navigation">
    124144                                        <div class="nav-previous"><?php next_posts_link(__( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' )); ?></div>
    125145                                        <div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' )); ?></div>
    126146                                </div><!-- #nav-below -->
    127 <?php } ?>
     147<?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.