From 05d9a8390dbb42f467d803d7d8f98a4f5399e9e0 Mon Sep 17 00:00:00 2001 From: David Beniamine <david.beniamine@tetras-libre.fr> Date: Fri, 14 Jul 2017 17:30:49 +0200 Subject: [PATCH] plus de traductions --- article.php | 4 ++-- functions.php | 15 +++++++-------- posts.php | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/article.php b/article.php index 196fae5..0f21a6c 100644 --- a/article.php +++ b/article.php @@ -8,8 +8,8 @@ <section class="footnote"> <!-- Unfortunately, CSS means everything's got to be inline. --> - <p>Article numéro: <?php echo numeral(article_number(article_id()), true); ?> . <?php echo count_words(article_markdown()); ?> mots, <?php if(comments_open()): ?>, - <?php echo total_comments();?> commentaires pour le moment.<?php endif; ?> <?php echo article_custom_field('attribution'); ?></p> + <p>Article numéro: <?php echo article_number(article_id()); ?>, <?php echo count_words(article_markdown()); ?> mots <?php if(comments_open()): ?>, + <?php echo total_comments();?> <?php echo pluralise(total_comments(), "commentaire", "s") ?> pour le moment.<?php endif; ?> <?php echo article_custom_field('attribution'); ?></p> </section> </section> diff --git a/functions.php b/functions.php index 9e95c87..e7333f4 100644 --- a/functions.php +++ b/functions.php @@ -11,7 +11,6 @@ function numeral($number, $hideIfOne = false) { return ''; } - $test = abs($number) % 10; $ext = ((abs($number) % 100 < 21 and abs($number) % 100 > 4) ? 'th' : (($test < 4) ? ($test < 3) ? ($test < 2) ? ($test < 1) ? 'th' : 'st' : 'nd' : 'rd' : 'th')); return $number . $ext; } @@ -40,13 +39,13 @@ function relative_time($date) { } $times = array( - 31104000 => 'year', - 2592000 => 'month', - 604800 => 'week', - 86400 => 'day', - 3600 => 'hour', + 31104000 => 'an', + 2592000 => 'mois', + 604800 => 'semaine', + 86400 => 'jour', + 3600 => 'heure', 60 => 'minute', - 1 => 'second' + 1 => 'seconde' ); foreach($times as $seconds => $title) { @@ -54,7 +53,7 @@ function relative_time($date) { if($rounded > 1) { $rounded = round($rounded); - return $rounded . ' ' . pluralise($rounded, $title) . ' ago'; + return 'il y a ' . $rounded . ' ' . pluralise($rounded, $title); } } } diff --git a/posts.php b/posts.php index 9e7ba2a..f1fbfe3 100644 --- a/posts.php +++ b/posts.php @@ -16,7 +16,7 @@ </div> <footer> - Posted <time datetime="<?php echo date(DATE_W3C, article_time()); ?>"><?php echo relative_time(article_time()); ?></time> by <?php echo article_author('real_name'); ?>. + Posté <time datetime="<?php echo date(DATE_W3C, article_time()); ?>"><?php echo relative_time(article_time()); ?></time> par <?php echo article_author('real_name'); ?>. </footer> </article> </li> -- GitLab