From 81bce8382e9acb14e2b12742378013a86f4f0e3a Mon Sep 17 00:00:00 2001 From: Henry Date: Mon, 26 Jul 2021 15:12:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3huamn=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E6=97=B6=E9=97=B4=E5=B7=AE=E9=9B=86=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E8=B4=9F=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/lang/zh-cn.php | 9 ++++++++- extend/fast/Date.php | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/application/admin/lang/zh-cn.php b/application/admin/lang/zh-cn.php index 2d537adb1..90fd68b39 100755 --- a/application/admin/lang/zh-cn.php +++ b/application/admin/lang/zh-cn.php @@ -1,5 +1,4 @@ '会员ID', 'Username' => '用户名', @@ -108,12 +107,20 @@ return [ 'Search %s' => '搜索 %s', 'View %s' => '查看 %s', '%d second%s ago' => '%d秒前', + '%d second%s ago' => '%d秒前', '%d minute%s ago' => '%d分钟前', '%d hour%s ago' => '%d小时前', '%d day%s ago' => '%d天前', '%d week%s ago' => '%d周前', '%d month%s ago' => '%d月前', '%d year%s ago' => '%d年前', + '%d second%s after' => '%d秒后', + '%d minute%s after' => '%d分钟后', + '%d hour%s after' => '%d小时后', + '%d day%s after' => '%d天后', + '%d week%s after' => '%d周后', + '%d month%s after' => '%d月后', + '%d year%s after' => '%d年后', 'Set to normal' => '设为正常', 'Set to hidden' => '设为隐藏', 'Recycle bin' => '回收站', diff --git a/extend/fast/Date.php b/extend/fast/Date.php index c4e4c3126..c5770b6b9 100644 --- a/extend/fast/Date.php +++ b/extend/fast/Date.php @@ -125,6 +125,7 @@ class Date public static function human($remote, $local = null) { $timediff = (is_null($local) || $local ? time() : $local) - $remote; + $tense = $timediff < 0 ? 'after' : 'ago'; $chunks = array( array(60 * 60 * 24 * 365, 'year'), array(60 * 60 * 24 * 30, 'month'), @@ -135,6 +136,8 @@ class Date array(1, 'second') ); + $name = 'second'; + $count = 0; for ($i = 0, $j = count($chunks); $i < $j; $i++) { $seconds = $chunks[$i][0]; $name = $chunks[$i][1]; @@ -142,7 +145,7 @@ class Date break; } } - return __("%d {$name}%s ago", $count, ($count > 1 ? 's' : '')); + return __("%d $name%s $tense", $count, ($count > 1 ? 's' : '')); } /** -- Gitee