Merge pull-request and improve relative_time() to support translations
This commit is contained in:
commit
01c3175c1b
@ -73,7 +73,7 @@ return array(
|
||||
'This subscription has been enabled successfully.' => 'L\'abonnement a été activé avec succès.',
|
||||
'Unable to disable this subscription.' => 'Impossible de désactiver cet abonnement.',
|
||||
'This subscription has been disabled successfully.' => 'L\'abonnement a été désactivé avec succès.',
|
||||
'Do you really want to disable this subscription: "%s"?' => 'Voulez-vous vraiment désactiver cet abonnement : "%s" ?',
|
||||
'Do you really want to disable this subscription: "%s"?' => 'Voulez-vous vraiment désactiver cet abonnement : « %s » ?',
|
||||
'enable' => 'activer',
|
||||
'disable' => 'désactiver',
|
||||
'Subscription disabled' => 'Abonnement désactivé',
|
||||
@ -189,9 +189,21 @@ return array(
|
||||
'The confirmation is required' => 'La confirmation est obligatoire',
|
||||
'Passwords doesn\'t match' => 'Les mots de passe ne sont pas identiques',
|
||||
'Do you really want to remove these items from your history?' => 'Voulez-vous vraiment supprimer les éléments de votre historique ?',
|
||||
'Do you really want to remove this subscription: "%s"?' => 'Voulez-vous vraiment supprimer cet abonnement : "%s" ?',
|
||||
'Do you really want to remove this subscription: "%s"?' => 'Voulez-vous vraiment supprimer cet abonnement : « %s » ?',
|
||||
'Nothing to read, do you want to <a href="?action=refresh-all" data-action="refresh-all">update your subscriptions?</a>' =>
|
||||
'Il n\'y a rien à lire, voulez-vous <a href="?action=refresh-all" data-action="refresh-all">mettre à jour vos abonnements ?</a>',
|
||||
'Show help' => 'Afficher l\'aide',
|
||||
'Close help' => 'Fermer l\'aide',
|
||||
'%d second ago' => 'Il y a %d seconde',
|
||||
'%d seconds ago' => 'Il y a %d secondes',
|
||||
'%d minute ago' => 'Il y a %d minute',
|
||||
'%d minutes ago' => 'Il y a %d minutes',
|
||||
'%d hour ago' => 'Il y a %d heure',
|
||||
'%d hours ago' => 'Il y a %d heures',
|
||||
'%d day ago' => 'Il y a %d jour',
|
||||
'%d days ago' => 'Il y a %d jours',
|
||||
'%d week ago' => 'Il y a %d semaine',
|
||||
'%d weeks ago' => 'Il y a %d semaines',
|
||||
'%d month ago' => 'Il y a %d mois',
|
||||
'%d months ago' => 'Il y a %d mois',
|
||||
);
|
||||
|
@ -38,7 +38,8 @@
|
||||
|
||||
<?php if ($feed['last_checked']): ?>
|
||||
<time class="feed-last-checked" id="last-checked-feed-<?= $feed['id'] ?>" data-after-update="<?= t('updated just now') ?>">
|
||||
<?= t('checked at').' '.dt('%e %B %Y %k:%M', $feed['last_checked']) ?>
|
||||
<?= t('updated' ) ?>
|
||||
<span title="<?= dt('%e %B %Y %k:%M', $feed['last_checked']) ?>"><?= Helper\relative_time($feed['last_checked']) ?></span>
|
||||
</time>
|
||||
<?php else: ?>
|
||||
<span class="feed-last-checked" id="last-checked-feed-<?= $feed['id'] ?>" data-after-update="<?= t('now') ?>">
|
||||
|
@ -30,7 +30,7 @@
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<li class="hide-mobile">
|
||||
<?= dt('%e %B %Y %k:%M', $item['updated']) ?>
|
||||
<span title="<?= dt('%e %B %Y %k:%M', $item['updated']) ?>"><?= Helper\relative_time($item['updated']) ?></span>
|
||||
</li>
|
||||
<li class="hide-mobile">
|
||||
<a href="<?= $item['url'] ?>" id="original-<?= $item['id'] ?>" rel="noreferrer" target="_blank" data-item-id="<?= $item['id'] ?>"><?= t('original link') ?></a>
|
||||
|
@ -62,7 +62,7 @@
|
||||
<a href="?action=feed-items&feed_id=<?= $feed['id'] ?>"><?= Helper\escape($feed['title']) ?></a>
|
||||
</li>
|
||||
<li class="hide-mobile">
|
||||
<?= dt('%e %B %Y %k:%M', $item['updated']) ?>
|
||||
<span title="<?= dt('%e %B %Y %k:%M', $item['updated']) ?>"><?= Helper\relative_time($item['updated']) ?></span>
|
||||
</li>
|
||||
<?php if ($item['enclosure']): ?>
|
||||
<li>
|
||||
|
9
vendor/PicoFeed/Rules/fastcodesign.com.php
vendored
Normal file
9
vendor/PicoFeed/Rules/fastcodesign.com.php
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
return array(
|
||||
'test_url' => 'http://www.fastcodesign.com/3026548/exposure/peek-inside-the-worlds-forbidden-subway-tunnels',
|
||||
'body' => array(
|
||||
'//article[contains(@class, "body prose")]',
|
||||
),
|
||||
'strip' => array(
|
||||
)
|
||||
);
|
9
vendor/PicoFeed/Rules/fastcoexist.com.php
vendored
Normal file
9
vendor/PicoFeed/Rules/fastcoexist.com.php
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
return array(
|
||||
'test_url' => 'http://www.fastcoexist.com/3026114/take-a-seat-on-this-gates-funded-future-toilet-that-will-change-how-we-think-about-poop',
|
||||
'body' => array(
|
||||
'//article[contains(@class, "body prose")]',
|
||||
),
|
||||
'strip' => array(
|
||||
)
|
||||
);
|
9
vendor/PicoFeed/Rules/fastcompany.com.php
vendored
Normal file
9
vendor/PicoFeed/Rules/fastcompany.com.php
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
return array(
|
||||
'test_url' => 'http://www.fastcompany.com/3026712/fast-feed/elon-musk-an-apple-tesla-merger-is-very-unlikely',
|
||||
'body' => array(
|
||||
'//article[contains(@class, "body prose")]',
|
||||
),
|
||||
'strip' => array(
|
||||
)
|
||||
);
|
9
vendor/PicoFeed/Rules/huffingtonpost.com.php
vendored
Normal file
9
vendor/PicoFeed/Rules/huffingtonpost.com.php
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
return array(
|
||||
'test_url' => 'http://www.huffingtonpost.com/2014/02/20/centscere-social-media-syracuse_n_4823848.html',
|
||||
'body' => array(
|
||||
'//article[@class="content")]',
|
||||
),
|
||||
'strip' => array(
|
||||
)
|
||||
);
|
10
vendor/PicoFeed/Rules/treehugger.com.php
vendored
Normal file
10
vendor/PicoFeed/Rules/treehugger.com.php
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
return array(
|
||||
'test_url' => 'http://www.treehugger.com/uncategorized/top-ten-posts-week-bunnies-2.html',
|
||||
'body' => array(
|
||||
'//div[contains(@class, "promo-image")]',
|
||||
'//div[contains(@id, "entry-body")]',
|
||||
),
|
||||
'strip' => array(
|
||||
)
|
||||
);
|
24
vendor/PicoTools/Helper.php
vendored
24
vendor/PicoTools/Helper.php
vendored
@ -77,6 +77,30 @@ function in_list($id, array $listing)
|
||||
return '?';
|
||||
}
|
||||
|
||||
function relative_time($timestamp, $fallback_date_format = '%e %B %Y %k:%M')
|
||||
{
|
||||
$diff = time() - $timestamp;
|
||||
|
||||
if ($diff < 60) return \t('%d second'.($diff > 1 ? 's' : '').' ago', $diff);
|
||||
|
||||
$diff = floor($diff / 60);
|
||||
if ($diff < 60) return \t('%d minute'.($diff > 1 ? 's' : '').' ago', $diff);
|
||||
|
||||
$diff = floor($diff / 60);
|
||||
if ($diff < 24) return \t('%d hour'.($diff > 1 ? 's' : '').' ago', $diff);
|
||||
|
||||
$diff = floor($diff / 24);
|
||||
if ($diff < 7) return \t('%d day'.($diff > 1 ? 's' : '').' ago', $diff);
|
||||
|
||||
$diff = floor($diff / 7);
|
||||
if ($diff < 4) return \t('%d week'.($diff > 1 ? 's' : '').' ago', $diff);
|
||||
|
||||
$diff = floor($diff / 4);
|
||||
if ($diff < 12) return \t('%d month'.($diff > 1 ? 's' : '').' ago', $diff);
|
||||
|
||||
return \dt($fallback_date_format, $timestamp);
|
||||
}
|
||||
|
||||
function error_class(array $errors, $name)
|
||||
{
|
||||
return ! isset($errors[$name]) ? '' : ' form-error';
|
||||
|
Loading…
Reference in New Issue
Block a user