Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Extend l10n possibilities in Bones #226

Merged
merged 1 commit into from

5 participants

@scorchio

Hey guys,

this might be good for us - I've altered the localization several places to give translators more flexibility. (I think several languages really require that, for example Hungarian.)

I hope you'll like it! Any suggestions are welcome.

@cfoellmann

I would love to host the translations on my website!
If interested just contact me and I will import the project into my ReGlot (https://github.com/ReGlot/ReGlot) installation (http://translate.foe-services.de)

@eddiemachado

will this interfere at all with translations that are already included inside Bones?

@elron

If it does, I can re-translate it to hebrew. its not a problem.

@juricazuanovic

@scorchio this is great, but localization is still not showing up on Dashboard for 'Custom Categories' & 'Custom Tags'

@eddiemachado eddiemachado merged commit e26af31 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 19, 2012
  1. @scorchio

    Extends l10n possibilities in Bones and fixes several places where th…

    scorchio authored
    …e existing l10n wasn't sufficient.
This page is out of date. Refresh to see the latest.
View
9 archive-custom_type.php
@@ -15,15 +15,16 @@
<header class="article-header">
<h3 class="h2"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
-
- <p class="byline vcard"><?php _e("Posted", "bonestheme"); ?> <time class="updated" datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time('F jS, Y'); ?></time> <?php _e("by", "bonestheme"); ?> <span class="author"><?php the_author_posts_link(); ?></span>.</p>
+ <p class="byline vcard"><?php
+ printf(__('Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by <span class="author">%3$s</span>.', 'bonestheme'), get_the_time('Y-m-j'), get_the_time(__('F jS, Y', 'bonestheme')), bones_get_the_author_posts_link());
+ ?></p>
</header> <!-- end article header -->
<section class="entry-content clearfix">
<?php the_excerpt(); ?>
-
+
</section> <!-- end article section -->
<footer class="article-footer">
@@ -69,4 +70,4 @@
</div> <!-- end #content -->
-<?php get_footer(); ?>
+<?php get_footer(); ?>
View
7 archive.php
@@ -48,8 +48,9 @@
<header class="article-header">
<h3 class="h2"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
-
- <p class="byline vcard"><?php _e("Posted", "bonestheme"); ?> <time class="updated" datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time('F jS, Y'); ?></time> <?php _e("by", "bonestheme"); ?> <span class="author"><?php the_author_posts_link(); ?></span> <span class="amp">&</span> <?php _e("filed under", "bonestheme"); ?> <?php the_category(', '); ?>.</p>
+ <p class="byline vcard"><?php
+ printf(__('Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by <span class="author">%3$s</span> <span class="amp">&</span> filed under %4$s.', 'bonestheme'), get_the_time('Y-m-j'), get_the_time(__('F jS, Y', 'bonestheme')), bones_get_the_author_posts_link(), get_the_category_list(', '));
+ ?></p>
</header> <!-- end article header -->
@@ -104,4 +105,4 @@
</div> <!-- end #content -->
-<?php get_footer(); ?>
+<?php get_footer(); ?>
View
5 comments.php
@@ -19,8 +19,7 @@
<!-- You can start editing here. -->
<?php if ( have_comments() ) : ?>
-
- <h3 id="comments" class="h2"><?php comments_number('<span>No</span> Responses', '<span>One</span> Response', '<span>%</span> Responses' );?> to &#8220;<?php the_title(); ?>&#8221;</h3>
+ <h3 id="comments" class="h2"><?php comments_number(__('<span>No</span> Responses', 'bonestheme'), __('<span>One</span> Response', 'bonestheme'), _n('<span>%</span> Response', '<span>%</span> Responses', get_comments_number(),'bonestheme') );?> to &#8220;<?php the_title(); ?>&#8221;</h3>
<nav id="comment-nav">
<ul class="clearfix">
@@ -67,7 +66,7 @@
<?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
<div class="alert help">
- <p><?php printf( 'You must be %1$slogged in%2$s to post a comment.', '<a href="<?php echo wp_login_url( get_permalink() ); ?>">', '</a>' ); ?></p>
+ <p><?php printf( __('You must be %1$slogged in%2$s to post a comment.', 'bonestheme'), '<a href="<?php echo wp_login_url( get_permalink() ); ?>">', '</a>' ); ?></p>
</div>
<?php else : ?>
View
2  footer.php
@@ -19,4 +19,4 @@
</body>
-</html> <!-- end page. what a ride! -->
+</html> <!-- end page. what a ride! -->
View
14 functions.php
@@ -76,8 +76,8 @@
function bones_register_sidebars() {
register_sidebar(array(
'id' => 'sidebar1',
- 'name' => 'Sidebar 1',
- 'description' => 'The first (primary) sidebar.',
+ 'name' => __('Sidebar 1', 'bonestheme'),
+ 'description' => __('The first (primary) sidebar.', 'bonestheme'),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
@@ -94,8 +94,8 @@ function bones_register_sidebars() {
register_sidebar(array(
'id' => 'sidebar2',
- 'name' => 'Sidebar 2',
- 'description' => 'The second (secondary) sidebar.',
+ 'name' => __('Sidebar 2', 'bonestheme'),
+ 'description' => __('The second (secondary) sidebar.', 'bonestheme'),
'before_widget' => '<div id="%1$s" class="widget %2$s">',
'after_widget' => '</div>',
'before_title' => '<h4 class="widgettitle">',
@@ -131,8 +131,8 @@ function bones_comments($comment, $args, $depth) {
?>
<img data-gravatar="http://www.gravatar.com/avatar/<?php echo md5($bgauthemail); ?>&s=32" class="load-gravatar avatar avatar-48 photo" height="32" width="32" src="<?php echo get_template_directory_uri(); ?>/library/images/nothing.gif" />
<!-- end custom gravatar call -->
- <?php printf(__('<cite class="fn">%s</cite>'), get_comment_author_link()) ?>
- <time datetime="<?php echo comment_time('Y-m-j'); ?>"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php comment_time('F jS, Y'); ?> </a></time>
+ <?php printf(__('<cite class="fn">%s</cite>', 'bonestheme'), get_comment_author_link()) ?>
+ <time datetime="<?php echo comment_time('Y-m-j'); ?>"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php comment_time(__('F jS, Y', 'bonestheme')); ?> </a></time>
<?php edit_comment_link(__('(Edit)', 'bonestheme'),' ','') ?>
</header>
<?php if ($comment->comment_approved == '0') : ?>
@@ -162,4 +162,4 @@ function bones_wpsearch($form) {
} // don't remove this bracket!
-?>
+?>
View
8 index.php
@@ -13,8 +13,9 @@
<header class="article-header">
<h1 class="h2"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h1>
-
- <p class="byline vcard"><?php _e('Posted', 'bonestheme'); ?> <time class="updated" datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time(get_option('date_format')); ?></time> <?php _e('by', 'bonestheme'); ?> <span class="author"><?php the_author_posts_link(); ?></span> <span class="amp">&</span> <?php _e('filed under', 'bonestheme'); ?> <?php the_category(', '); ?>.</p>
+ <p class="byline vcard"><?php
+ printf(__('Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by <span class="author">%3$s</span> <span class="amp">&</span> filed under %4$s.', 'bonestheme'), get_the_time('Y-m-j'), get_the_time(get_option('date_format')), bones_get_the_author_posts_link(), get_the_category_list(', '));
+ ?></p>
</header> <!-- end article header -->
@@ -23,8 +24,7 @@
</section> <!-- end article section -->
<footer class="article-footer">
-
- <p class="tags"><?php the_tags('<span class="tags-title">Tags:</span> ', ', ', ''); ?></p>
+ <p class="tags"><?php the_tags('<span class="tags-title">' . __('Tags:', 'bonestheme') . '</span> ', ', ', ''); ?></p>
</footer> <!-- end article footer -->
View
6 library/admin.php
@@ -63,7 +63,7 @@ function bones_rss_dashboard_widget() {
else foreach ($items as $item) : ?>
<h4 style="margin-bottom: 0;">
- <a href="<?php echo $item->get_permalink(); ?>" title="<?php echo $item->get_date('j F Y @ g:i a'); ?>" target="_blank">
+ <a href="<?php echo $item->get_permalink(); ?>" title="<?php echo mysql2date(__('j F Y @ g:i a', 'bonestheme'), $item->get_date('Y-m-d H:i:s')); ?>" target="_blank">
<?php echo $item->get_title(); ?>
</a>
</h4>
@@ -75,7 +75,7 @@ function bones_rss_dashboard_widget() {
// calling all custom dashboard widgets
function bones_custom_dashboard_widgets() {
- wp_add_dashboard_widget('bones_rss_dashboard_widget', 'Recently on Themble (Customize on admin.php)', 'bones_rss_dashboard_widget');
+ wp_add_dashboard_widget('bones_rss_dashboard_widget', __('Recently on Themble (Customize on admin.php)', 'bonestheme'), 'bones_rss_dashboard_widget');
/*
Be sure to drop any other created Dashboard Widgets
in this function and they will all load.
@@ -120,7 +120,7 @@ function bones_login_title() { return get_option('blogname'); }
// Custom Backend Footer
function bones_custom_admin_footer() {
- echo '<span id="footer-thankyou">Developed by <a href="http://yoursite.com" target="_blank">Your Site Name</a></span>. Built using <a href="http://themble.com/bones" target="_blank">Bones</a>.';
+ _e('<span id="footer-thankyou">Developed by <a href="http://yoursite.com" target="_blank">Your Site Name</a></span>. Built using <a href="http://themble.com/bones" target="_blank">Bones</a>.', 'bonestheme');
}
// adding it to the admin area
View
28 library/bones.php
@@ -231,7 +231,7 @@ function bones_main_nav() {
wp_nav_menu(array(
'container' => false, // remove nav container
'container_class' => 'menu clearfix', // class of container (should you choose to use it)
- 'menu' => 'The Main Menu', // nav name
+ 'menu' => __( 'The Main Menu', 'bonestheme' ), // nav name
'menu_class' => 'nav top-nav clearfix', // adding custom nav class
'theme_location' => 'main-nav', // where it's located in the theme
'before' => '', // before the menu
@@ -249,7 +249,7 @@ function bones_footer_links() {
wp_nav_menu(array(
'container' => '', // remove nav container
'container_class' => 'footer-links clearfix', // class of container (should you choose to use it)
- 'menu' => 'Footer Links', // nav name
+ 'menu' => __( 'Footer Links', 'bonestheme' ), // nav name
'menu_class' => 'nav footer-nav clearfix', // adding custom nav class
'theme_location' => 'footer-links', // where it's located in the theme
'before' => '', // before the menu
@@ -293,7 +293,7 @@ function bones_related_posts() {
<li class="related_post"><a class="entry-unrelated" href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; }
else { ?>
- <?php echo '<li class="no_related_post">No Related Posts Yet!</li>'; ?>
+ <?php echo '<li class="no_related_post">' . __( 'No Related Posts Yet!', 'bonestheme' ) . '</li>'; ?>
<?php }
}
wp_reset_query();
@@ -337,7 +337,7 @@ function bones_page_navi($before = '', $after = '') {
}
echo $before.'<nav class="page-navigation"><ol class="bones_page_navi clearfix">'."";
if ($start_page >= 2 && $pages_to_show < $max_page) {
- $first_page_text = "First";
+ $first_page_text = __( "First", 'bonestheme' );
echo '<li class="bpn-first-page-link"><a href="'.get_pagenum_link().'" title="'.$first_page_text.'">'.$first_page_text.'</a></li>';
}
echo '<li class="bpn-prev-link">';
@@ -354,7 +354,7 @@ function bones_page_navi($before = '', $after = '') {
next_posts_link('>>');
echo '</li>';
if ($end_page < $max_page) {
- $last_page_text = "Last";
+ $last_page_text = __( "Last", 'bonestheme' );
echo '<li class="bpn-last-page-link"><a href="'.get_pagenum_link($max_page).'" title="'.$last_page_text.'">'.$last_page_text.'</a></li>';
}
echo '</ol></nav>'.$after."";
@@ -376,6 +376,22 @@ function bones_excerpt_more($more) {
return '... <a href="'. get_permalink($post->ID) . '" title="Read '.get_the_title($post->ID).'">Read more &raquo;</a>';
}
-
+/*
+ * This is a modified the_author_posts_link() which just returns the link.
+ *
+ * This is necessary to allow usage of the usual l10n process with printf().
+ */
+function bones_get_the_author_posts_link() {
+ global $authordata;
+ if ( !is_object( $authordata ) )
+ return false;
+ $link = sprintf(
+ '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
+ get_author_posts_url( $authordata->ID, $authordata->user_nicename ),
+ esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ), // No further l10n needed, core will take care of this one
+ get_the_author()
+ );
+ return $link;
+}
?>
View
11 page-custom.php
@@ -19,8 +19,10 @@
<header class="article-header">
<h1 class="page-title"><?php the_title(); ?></h1>
-
- <p class="byline vcard"><?php _e("Posted", "bonestheme"); ?> <time class="updated" datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time('F jS, Y'); ?></time> <?php _e("by", "bonestheme"); ?> <span class="author"><?php the_author_posts_link(); ?></span>.</p>
+ <p class="byline vcard"><?php
+ printf(__('Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by <span class="author">%3$s</span>.', 'bonestheme'), get_the_time('Y-m-j'), get_the_time(__('F jS, Y', 'bonestheme')), bones_get_the_author_posts_link());
+ ?></p>
+
</header> <!-- end article header -->
@@ -29,8 +31,7 @@
</section> <!-- end article section -->
<footer class="article-footer">
-
- <p class="clearfix"><?php the_tags('<span class="tags">Tags: ', ', ', '</span>'); ?></p>
+ <p class="clearfix"><?php the_tags('<span class="tags">' . __('Tags:', 'bonestheme') . '</span> ', ', ', ''); ?></p>
</footer> <!-- end article footer -->
@@ -64,4 +65,4 @@
</div> <!-- end #content -->
-<?php get_footer(); ?>
+<?php get_footer(); ?>
View
11 page.php
@@ -13,8 +13,10 @@
<header class="article-header">
<h1 class="page-title" itemprop="headline"><?php the_title(); ?></h1>
-
- <p class="byline vcard"><?php _e("Posted", "bonestheme"); ?> <time class="updated" datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time('F jS, Y'); ?></time> <?php _e("by", "bonestheme"); ?> <span class="author"><?php the_author_posts_link(); ?></span>.</p>
+ <p class="byline vcard"><?php
+ printf(__('Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by <span class="author">%3$s</span>.', 'bonestheme'), get_the_time('Y-m-j'), get_the_time(__('F jS, Y', 'bonestheme')), bones_get_the_author_posts_link());
+ ?></p>
+
</header> <!-- end article header -->
@@ -23,8 +25,7 @@
</section> <!-- end article section -->
<footer class="article-footer">
-
- <?php the_tags('<p class="tags"><span class="tags-title">Tags:</span> ', ', ', '</p>'); ?>
+ <?php the_tags('<span class="tags">' . __('Tags:', 'bonestheme') . '</span> ', ', ', ''); ?>
</footer> <!-- end article footer -->
@@ -56,4 +57,4 @@
</div> <!-- end #content -->
-<?php get_footer(); ?>
+<?php get_footer(); ?>
View
14 search.php
@@ -5,23 +5,23 @@
<div id="inner-content" class="wrap clearfix">
<div id="main" class="eightcol first clearfix" role="main">
-
- <h1 class="archive-title"><span>Search Results for:</span> <?php echo esc_attr(get_search_query()); ?></h1>
+ <h1 class="archive-title"><span><?php _e('Search Results for:', 'bonestheme'); ?></span> <?php echo esc_attr(get_search_query()); ?></h1>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">
<header class="article-header">
-
+
<h3 class="search-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
-
- <p class="byline vcard"><?php _e("Posted", "bonestheme"); ?> <time class="updated" datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time('F jS, Y'); ?></time> <?php _e("by", "bonestheme"); ?> <span class="author"><?php the_author_posts_link(); ?></span> <span class="amp">&</span> <?php _e("filed under", "bonestheme"); ?> <?php the_category(', '); ?>.</p>
+ <p class="byline vcard"><?php
+ printf(__('Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by <span class="author">%3$s</span> <span class="amp">&</span> filed under %4$s.', 'bonestheme'), get_the_time('Y-m-j'), get_the_time(__('F jS, Y', 'bonestheme')), bones_get_the_author_posts_link(), get_the_category_list(', '));
+ ?></p>
</header> <!-- end article header -->
<section class="entry-content">
- <?php the_excerpt('<span class="read-more">Read more &raquo;</span>'); ?>
+ <?php the_excerpt('<span class="read-more">' . __('Read more &raquo;', 'bonestheme') . '</span>'); ?>
</section> <!-- end article section -->
@@ -68,4 +68,4 @@
</div> <!-- end #content -->
-<?php get_footer(); ?>
+<?php get_footer(); ?>
View
10 single-custom_type.php
@@ -28,8 +28,9 @@
<header class="article-header">
<h1 class="single-title custom-post-type-title"><?php the_title(); ?></h1>
-
- <p class="byline vcard"><?php _e("Posted", "bonestheme"); ?> <time class="updated" datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time('F jS, Y'); ?></time> <?php _e("by", "bonestheme"); ?> <span class="author"><?php the_author_posts_link(); ?></span> <span class="amp">&</span> <?php _e("filed under", "bonestheme"); ?> <?php echo get_the_term_list( get_the_ID(), 'custom_cat', "" ) ?>.</p>
+ <p class="byline vcard"><?php
+ printf(__('Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by <span class="author">%3$s</span> <span class="amp">&</span> filed under %4$s.', 'bonestheme'), get_the_time('Y-m-j'), get_the_time(__('F js, Y', 'bonestheme')), bones_get_the_author_posts_link(), get_the_term_list( get_the_ID(), 'custom_cat', "" ));
+ ?></p>
</header> <!-- end article header -->
@@ -40,8 +41,7 @@
</section> <!-- end article section -->
<footer class="article-header">
-
- <p class="tags"><?php echo get_the_term_list( get_the_ID(), 'custom_tag', '<span class="tags-title">Custom Tags:</span> ', ', ' ) ?></p>
+ <p class="tags"><?php echo get_the_term_list( get_the_ID(), 'custom_tag', '<span class="tags-title">' . __('Custom Tags:', 'bonestheme') . '</span> ', ', ' ) ?></p>
</footer> <!-- end article footer -->
@@ -75,4 +75,4 @@
</div> <!-- end #content -->
-<?php get_footer(); ?>
+<?php get_footer(); ?>
View
10 single.php
@@ -13,8 +13,9 @@
<header class="article-header">
<h1 class="entry-title single-title" itemprop="headline"><?php the_title(); ?></h1>
-
- <p class="byline vcard"><?php _e("Posted", "bonestheme"); ?> <time class="updated" datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time('F jS, Y'); ?></time> <?php _e("by", "bonestheme"); ?> <span class="author"><?php the_author_posts_link(); ?></span> <span class="amp">&amp;</span> <?php _e("filed under", "bonestheme"); ?> <?php the_category(', '); ?>.</p>
+ <p class="byline vcard"><?php
+ printf(__('Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by <span class="author">%3$s</span> <span class="amp">&amp;</span> filed under %4$s.', 'bonestheme'), get_the_time('Y-m-j'), get_the_time(__('F js, Y', 'bonestheme')), bones_get_the_author_posts_link(), get_the_category_list(', '));
+ ?></p>
</header> <!-- end article header -->
@@ -23,8 +24,7 @@
</section> <!-- end article section -->
<footer class="article-footer">
-
- <?php the_tags('<p class="tags"><span class="tags-title">Tags:</span> ', ', ', '</p>'); ?>
+ <?php the_tags('<p class="tags"><span class="tags-title">' . __('Tags:', 'bonestheme') . '</span> ', ', ', '</p>'); ?>
</footer> <!-- end article footer -->
@@ -58,4 +58,4 @@
</div> <!-- end #content -->
-<?php get_footer(); ?>
+<?php get_footer(); ?>
View
10 taxonomy-custom_cat.php
@@ -30,14 +30,14 @@
<header class="article-header">
<h3 class="h2"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
-
- <p class="byline vcard"><?php _e("Posted", "bonestheme"); ?> <time class="updated" datetime="<?php echo the_time('Y-m-j'); ?>" pubdate><?php the_time('F jS, Y'); ?></time> <?php _e("by", "bonestheme"); ?> <span class="author"><?php the_author_posts_link(); ?></span> <span class="amp">&</span> <?php _e("filed under", "bonestheme"); ?> <?php echo get_the_term_list( get_the_ID(), 'custom_cat', "" ) ?>.</p>
+ <p class="byline vcard"><?php
+ printf(__('Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by <span class="author">%3$s</span> <span class="amp">&</span> filed under %4$s.', 'bonestheme'), get_the_time('Y-m-j'), get_the_time(__('F js, Y', 'bonestheme')), bones_get_the_author_posts_link(), get_the_term_list( get_the_ID(), 'custom_cat', "" ));
+ ?></p>
</header> <!-- end article header -->
<section class="entry-content">
-
- <?php the_excerpt('<span class="read-more">Read More &raquo;</span>'); ?>
+ <?php the_excerpt('<span class="read-more">' . __('Read More &raquo;', 'bonestheme') . '</span>'); ?>
</section> <!-- end article section -->
@@ -84,4 +84,4 @@
</div> <!-- end #content -->
-<?php get_footer(); ?>
+<?php get_footer(); ?>
Something went wrong with that request. Please try again.