I think I’m repeating too much in the following if-statement:
<?php $current_language = get_bloginfo( 'language' ); ?>
<div id="next">
<?php if ( $current_language == 'es-ES' ) : ?>
<?php next_post_link( '%link', 'Proyecto Siguiente ' . _x( '', 'next post link', 'twentyten' ) . '' ); ?>
<?php elseif ( $current_language == 'zh-TW' ) : ?>
<?php next_post_link( '%link', '下一個項目 ' . _x( '', 'next post link', 'twentyten' ) . '' ); ?>
<?php elseif ( $current_language == 'zh-CN' ) : ?>
<?php next_post_link( '%link', '下一个项目 ' . _x( '', 'next post link', 'twentyten' ) . '' ); ?>
<?php else : ?>
<?php next_post_link( '%link', 'Next Project ' . _x( '', 'next post link', 'twentyten' ) . '' ); ?>
<?php endif; ?>
</div>
<div id="prev">
<?php if ( $current_language == 'es-ES' ) : ?>
<?php previous_post_link( '%link', '' . _x( '', 'previous post link', 'twentyten' ) . ' Proyecto Anterior' ); ?>
<?php elseif ( $current_language == 'zh-TW' ) : ?>
<?php previous_post_link( '%link', '' . _x( '', 'previous post link', 'twentyten' ) . ' 上一個項目' ); ?>
<?php elseif ( $current_language == 'zh-CN' ) : ?>
<?php previous_post_link( '%link', '' . _x( '', 'previous post link', 'twentyten' ) . ' 上一个项目' ); ?>
<?php else : ?>
<?php previous_post_link( '%link', '' . _x( '', 'previous post link', 'twentyten' ) . ' Previous Project' ); ?>
<?php endif; ?>
</div>
(The repetition of php tags is a WordPress convention I think).
I wonder if there’s a way of not repeating the previous_post_link and next_post_link functions?
Well, one thing is that you don’t have to wrap every line in
<?php ... ?>tags. And since you’re repeating the same thing quite a lot, you could use an array instead:If you’re translating every string in your app like this, it might be worth considering a more general system behind it like gettext.