Skip to content

Commit ee16e36

Browse files
author
Seaton Jiang
committed
fix: multilingual display (seatonjiang#319)
1 parent 01f3b1f commit ee16e36

File tree

6 files changed

+79
-34
lines changed

6 files changed

+79
-34
lines changed

assets/js/comments.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

inc/theme-article.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* 文章相关函数
44
* @author Seaton Jiang <seaton@vtrois.com>
55
* @license MIT License
6-
* @version 2020.12.02
6+
* @version 2021.01.06
77
*/
88

99
// 文章链接添加 target 和 rel
@@ -206,7 +206,9 @@ function comment_scripts()
206206
wp_enqueue_script('comment', ASSET_PATH . '/assets/js/comments.min.js', array(), THEME_VERSION);
207207
wp_localize_script('comment', 'ajaxcomment', array(
208208
'ajax_url' => admin_url('admin-ajax.php'),
209-
'order' => get_option('comment_order')
209+
'order' => get_option('comment_order'),
210+
'compost' => __('评论正在提交中','kratos'),
211+
'comsucc' => __('评论提交成功','kratos'),
210212
));
211213
}
212214
add_action('wp_enqueue_scripts', 'comment_scripts');
@@ -244,7 +246,7 @@ function comment_callback()
244246
<?php comment_text();?>
245247
</div>
246248
<div class="meta clearfix">
247-
<div class="date d-inline-block float-left"><?php echo get_comment_date('Y年m月d日'); ?><?php if (current_user_can('edit_posts')) {echo '<span class="ml-2">';edit_comment_link(__('编辑', 'kratos'));echo '</span>';};?>
249+
<div class="date d-inline-block float-left"><?php echo get_comment_date(); ?><?php if (current_user_can('edit_posts')) {echo '<span class="ml-2">';edit_comment_link(__('编辑', 'kratos'));echo '</span>';};?>
248250
</div>
249251
</div>
250252
</div>
@@ -283,7 +285,7 @@ function comment_callbacks($comment, $args, $depth = 2)
283285
<?php comment_text();?>
284286
</div>
285287
<div class="meta clearfix">
286-
<div class="date d-inline-block float-left"><?php echo get_comment_date('Y年m月d日'); ?><?php if (current_user_can('edit_posts')) {echo '<span class="ml-2">';edit_comment_link(__('编辑', 'kratos'));echo '</span>';};?>
288+
<div class="date d-inline-block float-left"><?php echo get_comment_date(); ?><?php if (current_user_can('edit_posts')) {echo '<span class="ml-2">';edit_comment_link(__('编辑', 'kratos'));echo '</span>';};?>
287289
</div>
288290
<div class="tool reply ml-2 d-inline-block float-right">
289291
<?php

inc/theme-widgets.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* 侧栏小工具
44
* @author Seaton Jiang <seaton@vtrois.com>
55
* @license MIT License
6-
* @version 2020.12.14
6+
* @version 2020.12.17
77
*/
88

99
// 添加小工具
@@ -66,15 +66,15 @@ function timeago($ptime){
6666
$ptime = strtotime($ptime);
6767
$etime = time() - $ptime;
6868
if($etime < 1)
69-
return'刚刚';
69+
return '刚刚';
7070
$interval = array(
71-
12*30*24*60*60 => ' 年前('.date('m月d日',$ptime).'',
72-
30*24*60*60 => ' 个月前('.date('m月d日',$ptime).'',
73-
7*24*60*60 => ' 周前('.date('m月d日',$ptime).'',
74-
24*60*60 => ' 天前('.date('m月d日',$ptime).'',
75-
60*60 => ' 小时前('.date('m月d日',$ptime).'',
76-
60 => ' 分钟前('.date('m月d日',$ptime).'',
77-
1 => ' 秒前('.date('m月d日',$ptime).'',
71+
12*30*24*60*60 => __(' 年前','kratos').''.date(__('m月d日','kratos'),$ptime).'',
72+
30*24*60*60 => __(' 个月前','kratos').''.date(__('m月d日','kratos'),$ptime).'',
73+
7*24*60*60 => __(' 周前','kratos').''.date(__('m月d日','kratos'),$ptime).'',
74+
24*60*60 => __(' 天前','kratos').''.date(__('m月d日','kratos'),$ptime).'',
75+
60*60 => __(' 小时前','kratos').''.date(__('m月d日','kratos'),$ptime).'',
76+
60 => __(' 分钟前','kratos').''.date(__('m月d日','kratos'),$ptime).'',
77+
1 => __(' 秒前','kratos').''.date(__('m月d日','kratos'),$ptime).'',
7878
);
7979
foreach($interval as$secs=>$str){
8080
$d=$etime/$secs;
@@ -466,7 +466,7 @@ public function __construct()
466466
public function widget($args, $instance)
467467
{
468468
$number = !empty($instance['number']) ? $instance['number'] : '5';
469-
$title = !empty($instance['title']) ? $instance['title'] : '最近评论';
469+
$title = !empty($instance['title']) ? $instance['title'] : __('最近评论', 'kratos');
470470

471471
echo '<div class="widget w-comments"><div class="title">'. $title .'</div><div class="comments">';
472472
echo latest_comments($number, 50);
@@ -486,7 +486,7 @@ public function form($instance)
486486
{
487487
global $wpdb;
488488
$number = !empty($instance['number']) ? $instance['number'] : '5';
489-
$title = !empty($instance['title']) ? $instance['title'] : '最近评论';
489+
$title = !empty($instance['title']) ? $instance['title'] : __('最近评论', 'kratos');
490490
?>
491491
<div class="media-widget-control">
492492
<p>

languages/kratos.pot

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ msgid ""
33
msgstr ""
44
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
55
"Project-Id-Version: Kratos\n"
6-
"POT-Creation-Date: 2020-12-14 15:09+0800\n"
6+
"POT-Creation-Date: 2021-01-06 10:03+0800\n"
77
"PO-Revision-Date: 2020-02-14 23:32+0800\n"
88
"Last-Translator: \n"
99
"Language-Team: \n"
@@ -217,43 +217,51 @@ msgstr ""
217217
msgid "浏览文件"
218218
msgstr ""
219219

220-
#: inc/theme-article.php:247 inc/theme-article.php:286
220+
#: inc/theme-article.php:210
221+
msgid "评论正在提交中"
222+
msgstr ""
223+
224+
#: inc/theme-article.php:211
225+
msgid "评论提交成功"
226+
msgstr ""
227+
228+
#: inc/theme-article.php:249 inc/theme-article.php:288
221229
msgid "编辑"
222230
msgstr ""
223231

224-
#: inc/theme-article.php:290 inc/theme-smtp.php:102
232+
#: inc/theme-article.php:292 inc/theme-smtp.php:102
225233
msgid "回复"
226234
msgstr ""
227235

228-
#: inc/theme-article.php:345
236+
#: inc/theme-article.php:347
229237
msgid "添加表情"
230238
msgstr ""
231239

232-
#: inc/theme-article.php:398
240+
#: inc/theme-article.php:400
233241
msgid "描述"
234242
msgstr ""
235243

236-
#: inc/theme-article.php:403 inc/theme-options.php:226
244+
#: inc/theme-article.php:405 inc/theme-options.php:226
237245
msgid "关键词"
238246
msgstr ""
239247

240-
#: inc/theme-article.php:409
248+
#: inc/theme-article.php:411
241249
msgid "SEO 设置"
242250
msgstr ""
243251

244-
#: inc/theme-core.php:80
252+
#: inc/theme-core.php:84
245253
msgid "您已经赞过了"
246254
msgstr ""
247255

248-
#: inc/theme-core.php:81
256+
#: inc/theme-core.php:85
249257
msgid "感谢您的支持"
250258
msgstr ""
251259

252-
#: inc/theme-core.php:82
260+
#: inc/theme-core.php:86
253261
msgid "打赏作者"
254262
msgstr ""
255263

256-
#: inc/theme-core.php:83
264+
#: inc/theme-core.php:87
257265
msgid "扫码支付"
258266
msgstr ""
259267

@@ -968,6 +976,40 @@ msgstr ""
968976
msgid "侧边栏工具"
969977
msgstr ""
970978

979+
#: inc/theme-widgets.php:71
980+
msgid " 年前"
981+
msgstr ""
982+
983+
#: inc/theme-widgets.php:71 inc/theme-widgets.php:72 inc/theme-widgets.php:73
984+
#: inc/theme-widgets.php:74 inc/theme-widgets.php:75 inc/theme-widgets.php:76
985+
#: inc/theme-widgets.php:77
986+
msgid "m月d日"
987+
msgstr ""
988+
989+
#: inc/theme-widgets.php:72
990+
msgid " 个月前"
991+
msgstr ""
992+
993+
#: inc/theme-widgets.php:73
994+
msgid " 周前"
995+
msgstr ""
996+
997+
#: inc/theme-widgets.php:74
998+
msgid " 天前"
999+
msgstr ""
1000+
1001+
#: inc/theme-widgets.php:75
1002+
msgid " 小时前"
1003+
msgstr ""
1004+
1005+
#: inc/theme-widgets.php:76
1006+
msgid " 分钟前"
1007+
msgstr ""
1008+
1009+
#: inc/theme-widgets.php:77
1010+
msgid " 秒前"
1011+
msgstr ""
1012+
9711013
#: inc/theme-widgets.php:115
9721014
msgid "发布于 "
9731015
msgstr ""
@@ -1089,7 +1131,8 @@ msgstr ""
10891131
msgid "默认显示:"
10901132
msgstr ""
10911133

1092-
#: inc/theme-widgets.php:459
1134+
#: inc/theme-widgets.php:459 inc/theme-widgets.php:469
1135+
#: inc/theme-widgets.php:489
10931136
msgid "最近评论"
10941137
msgstr ""
10951138

pages/page-content.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* 文章列表
44
* @author Seaton Jiang <seaton@vtrois.com>
55
* @license MIT License
6-
* @version 2020.12.14
6+
* @version 2021.01.06
77
*/
88
?>
99
<div class="article-panel">
@@ -39,7 +39,7 @@
3939
</div>
4040
<div class="a-meta">
4141
<span class="float-left d-none d-md-block">
42-
<span class="mr-2"><i class="kicon i-calendar"></i><?php echo get_the_date('Y年m月d日'); ?></span>
42+
<span class="mr-2"><i class="kicon i-calendar"></i><?php echo get_the_date(); ?></span>
4343
<span class="mr-2"><i class="kicon i-comments"></i><?php comments_number('0', '1', '%'); _e('条评论', 'kratos'); ?></span>
4444
</span>
4545
<span class="float-left d-block">

single.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* 文章内容
44
* @author Seaton Jiang <seaton@vtrois.com>
55
* @license MIT License
6-
* @version 2020.06.08
6+
* @version 2021.01.06
77
*/
88

99
get_header();
@@ -48,7 +48,7 @@
4848
<div class="header">
4949
<h1 class="title"><?php the_title(); ?></h1>
5050
<div class="meta">
51-
<span><?php echo get_the_date('Y年m月d日'); ?></span>
51+
<span><?php echo get_the_date(); ?></span>
5252
<span ><?php echo get_post_views(); _e('点热度' , 'kratos'); ?></span>
5353
<span><?php if (get_post_meta($post->ID, 'love', true)) { echo get_post_meta($post->ID, 'love', true); } else {echo '0'; } _e('人点赞', 'kratos'); ?></span>
5454
<span><?php comments_number('0', '1', '%'); _e('条评论', 'kratos'); ?></span>
@@ -125,8 +125,8 @@
125125
<?php if ( get_the_tags() ) { the_tags('', ' ', ''); } else{ echo '<a>' . __( '暂无' , 'kratos') . '</a>'; }?>
126126
</div>
127127
<div class="tool float-right d-none d-lg-block">
128-
<div data-toggle="tooltip" data-html="true" data-original-title="<?php _e('最后更新:','kratos'); the_modified_date( 'Y-m-d H:i' ) ?>">
129-
<span><?php _e('最后更新:','kratos'); ?><?php the_modified_date('Y年m月d日'); ?></span>
128+
<div data-toggle="tooltip" data-html="true" data-original-title="<?php _e('最后更新:','kratos'); the_modified_date() ?>">
129+
<span><?php _e('最后更新:','kratos'); ?><?php the_modified_date(); ?></span>
130130
</div>
131131
</div>
132132
</div>

0 commit comments

Comments
 (0)