diff options
| author | BigCoke233 <hi@guhub.cn> | 2020-07-15 00:18:04 +0800 |
|---|---|---|
| committer | BigCoke233 <hi@guhub.cn> | 2020-07-15 00:18:04 +0800 |
| commit | 08e6e289626620abd5dea49c0485fa80dc011e79 (patch) | |
| tree | 1bfb0f7746ca207bded81616f18782d5eb9871c9 /includes | |
| parent | 0615f62964b26f5d2f54da3c9262a1ea17df41ce (diff) | |
:poop: Add: 初步实现多语言功能,并使用 hint.css 添加 tooltip
Diffstat (limited to 'includes')
| -rw-r--r-- | includes/comments.php | 18 | ||||
| -rw-r--r-- | includes/footer.php | 13 | ||||
| -rw-r--r-- | includes/head.php | 5 | ||||
| -rw-r--r-- | includes/header.php | 41 |
4 files changed, 41 insertions, 36 deletions
diff --git a/includes/comments.php b/includes/comments.php index 7439c90..74cea9c 100644 --- a/includes/comments.php +++ b/includes/comments.php @@ -34,7 +34,7 @@ echo $commentClass; <span class="comment-author"><a href="<?php echo $comments->url; ?>" target="_blank"><?php echo $comments->author; ?></a></span>
<span class="comment-date">
<?php if ('waiting' == $comments->status) { ?>
- <em class="comment-waiting">您的评论正在等待审核!</em>
+ <em class="comment-waiting"><?php gtecho('commentListTexts','commentWaiting'); ?></em>
<?php } else { ?>
<?php $comments->date('Y-m-d H:i'); ?>
<?php } ?>
@@ -55,7 +55,7 @@ echo $commentClass; <?php if($this->fields->commentShow == 0)://如果显示评论列表 ?>
<?php if ($comments->have())://如果有评论 则显示 ?>
<div class="comment-container" id="comments">
- <h3 class="comment-title" id="response"><?php $this->commentsNum(_t('暂无评论'), _t('已有 1 条评论'), _t('已有 %d 条评论')); ?></h3>
+ <h3 class="comment-title" id="response"><?php $this->commentsNum(_t(gt('commentListTexts','commentNumNone')), _t(gta('commentListTexts','commentNum','1')), _t(gta('commentListTexts','commentNum','%d'))); ?></h3>
<?php $comments->listComments(array(
'before' => '<div class="comment-list" role="list">',
'after' => '</div>',
@@ -69,7 +69,7 @@ echo $commentClass; <?php endif;//有无评论判断结束?>
<?php else: //如果不显示评论列表 ?>
- <?php if($this->allow('comment')): ?><div class="comment-hidden">博主已关闭本页面的评论显示,您评论后将不会看到您的评论内容</div><?php endif; ?>
+ <?php if($this->allow('comment')): ?><div class="comment-hidden"><?php gtecho('commentListTexts','commentHidden'); ?></div><?php endif; ?>
<?php endif;//是否显示判断结束 ?>
<div class="comment-form">
@@ -81,14 +81,14 @@ echo $commentClass; <!-- 如果当前用户已经登录 -->
<?php if($this->user->hasLogin()): ?>
<!-- 显示当前登录用户的用户名以及登出连接 -->
- <p class="col-md-12 comment-logined-sign"><?php _e('登录身份: '); ?><a href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></a>. <a href="<?php $this->options->logoutUrl(); ?>" title="Logout"><?php _e('退出'); ?> »</a></p>
+ <p class="col-md-12 comment-logined-sign"><?php gtecho('commentListTexts','commentStatus'); ?><a href="<?php $this->options->profileUrl(); ?>"><?php $this->user->screenName(); ?></a>. <a href="<?php $this->options->logoutUrl(); ?>" title="Logout"><?php gtecho('commentListTexts','commentLogout'); ?></a></p>
<!-- 若当前用户未登录 -->
<?php else: ?>
<!-- 要求输入名字、邮箱、网址 -->
<div class="comment-input">
- <input type="text" name="author" id="author" class="text" placeholder="称呼*" value="<?php $this->remember('author'); ?>" required />
- <input type="email" name="mail" id="mail" class="text" placeholder="邮箱*" value="<?php $this->remember('mail'); ?>"<?php if ($this->options->commentsRequireMail): ?> required<?php endif; ?> />
- <input type="url" name="url" id="url" class="text" placeholder="<?php _e('http(s)://'); ?>" value="<?php $this->remember('url'); ?>"<?php if ($this->options->commentsRequireURL): ?> required<?php endif; ?> />
+ <input type="text" name="author" id="author" class="text" placeholder="<?php gtecho('commentFormTexts','nameInput'); ?>" value="<?php $this->remember('author'); ?>" required />
+ <input type="email" name="mail" id="mail" class="text" placeholder="<?php gtecho('commentFormTexts','emailInput'); ?>" value="<?php $this->remember('mail'); ?>"<?php if ($this->options->commentsRequireMail): ?> required<?php endif; ?> />
+ <input type="url" name="url" id="url" class="text" placeholder="<?php gtecho('commentFormTexts','urlInput'); ?>" value="<?php $this->remember('url'); ?>"<?php if ($this->options->commentsRequireURL): ?> required<?php endif; ?> />
</div>
<?php endif; ?>
<!-- 输入要回复的内容 -->
@@ -98,13 +98,13 @@ echo $commentClass; <p class="comment-submit-box">
<div title="OwO" class="OwO"></div>
<div class="cancel-comment-reply"><?php $comments->cancelReply(); ?></div>
- <button type="submit" onclick="return MiraclesComment.submitComment();" class="comment-submit submit"><?php _e('评论'); ?></button>
+ <button type="submit" onclick="return MiraclesComment.submitComment();" class="comment-submit submit"><?php gtecho('commentFormTexts','submit'); ?></button>
</p>
</form>
</div>
<!-- 若当前文章不允许进行评论 -->
<?php else: ?>
- <div class="comment-hidden"><?php _e('博主已关闭本页面的评论功能'); ?></div>
+ <div class="comment-hidden"><?php gtecho('commentListTexts','commentClosed'); ?></div>
<?php endif; ?>
</div>
</div>
diff --git a/includes/footer.php b/includes/footer.php index 82d39dc..61d9bd4 100644 --- a/includes/footer.php +++ b/includes/footer.php @@ -7,7 +7,9 @@ <p class="copyright"><span id="copyright">Powered by <a href="http://typecho.org">Typecho</a> | Theme <a href="https://github.com/BigCoke233/miracles" id="copyright-name">Miracles</a> by <a href="https://guhub.cn" id="copyright-author">Eltrac</a></span><br> Copyright © <?php echo date('Y'); ?> <a href="<?php $this->options->SiteUrl(); ?>"><?php $this->options->title(); ?></a>, All rights reserved.<br> <?php - echo $this->options->build_time?"记录已延续了 <span id=\"build-time\"></span>":""; + echo $this->options->build_time; + gtecho('footerTexts','startTime'); + echo " <span id=\"build-time\"></span>"; if($faces=$this->options->anime_face){ $faces = explode("&&",$faces); $faces = "<span class=\"anime-face\">".$faces[mt_rand(0,count($faces)-1)]."</span>"; @@ -18,7 +20,7 @@ </footer> <!-- Raised Buttons --> <div class="fixed-tools"> - <button title="返回顶部" class="fixed-button gotop-button" id="gotop"><i class="iconfont icon-chevron-up"></i></button> + <button class="fixed-button gotop-button hint--top" data-tooltip="<?php gtecho("otherTexts","goTop"); ?>" id="gotop"><i class="iconfont icon-chevron-up"></i></button> </div> <!-- JavaScript Require--> <?php @@ -35,6 +37,13 @@ var faviconUrl = '<?php if($this->options->favicon):$this->options->favicon();else:echo Utils::indexTheme('favicon.ico');endif; ?>'; var faviconDark = <?php $faviconDarkExist = file_exists('/faviconDark.ico'); if($faviconDarkExist=true): echo 'true'; else: echo 'false'; endif; ?>; + var commentSubmit = '<?php gtecho('commentFormTexts','submitLoading'); ?>'; + var commentSubmitLoading = '<?php gtecho('commentFormTexts','submit'); ?>'; + var footerTimeDay = '<?php gtecho('footerTexts','startTimeDay'); ?>'; + var footerTimeHour = '<?php gtecho('footerTexts','startTimeHour'); ?>'; + var footerTimeMin = '<?php gtecho('footerTexts','startTimeMin'); ?>'; + var footerTimeSec = '<?php gtecho('footerTexts','startTimeSec'); ?>'; + var footerTimeYear = '<?php gtecho('footerTexts','startTimeYear'); ?>'; <?php if($this->options->pjax && $this->options->pjax!=0) :?>var loadPjax = true; beforePjax = function() {NProgress.start();}; afterPjax = function() {owoLoad();<?php $this->options->pjax_complete(); ?>};<?php endif; ?></script><!--</nocompress>--> diff --git a/includes/head.php b/includes/head.php index 41f143d..3a9c475 100644 --- a/includes/head.php +++ b/includes/head.php @@ -45,7 +45,7 @@ if($GLOBALS['miraclesIfCompressHTML']=='on') ob_start(); //ob 截取开始 ?> <?php $this->options->headerEcho(); ?> <!-- css --> <?php - $css_files=array("codestyle","owo.min","nprogress","gazeimg","main/miracles.min"); + $css_files=array("codestyle","owo.min","nprogress","gazeimg","hint.min","main/miracles.min"); if($this->options->customCDN): $custom=$this->options->customCDN; else: $custom=Helper::options()->themeUrl("","Miracles"); endif; Utils::addRequires($css_files,"css",$this->options->CDN,$custom); ?> @@ -61,6 +61,7 @@ if($GLOBALS['miraclesIfCompressHTML']=='on') ob_start(); //ob 截取开始 ?> endif; ?> <!-- Font CDN --> <link href="<?php echo $theme_font_url; ?>" rel="stylesheet"> - <?php endif; ?><style>.body-dark .pio-action .pio-home{background-image: url(<?php Utils::indexTheme('images/icons/home.png'); ?>);}.body-dark .pio-action .pio-close{background-image: url(<?php Utils::indexTheme('images/icons/remove.png'); ?>);}.body-dark .pio-action .pio-skin{background-image: url(<?php Utils::indexTheme('images/icons/skin.png'); ?>);}.body-dark .pio-action .pio-info{background-image: url(<?php Utils::indexTheme('images/icons/info.png'); ?>);}.body-dark .pio-action .pio-night{background-image: url(<?php Utils::indexTheme('images/icons/night.png'); ?>);}@media (min-width:992px) {.search{background-image:url(<?php Utils::indexTheme('images/search.png'); ?>);}.login{background-image:url(<?php Utils::indexTheme('images/login.png'); ?>)}}.search {background-position: bottom right;background-repeat: no-repeat}.login {background-position: bottom left;background-repeat:no-repeat}<?php $this->options->cssEcho(); ?></style> + <?php endif; ?><style>.body-dark .pio-action .pio-home{background-image: url(<?php Utils::indexTheme('images/icons/home.png'); ?>);}.body-dark .pio-action .pio-close{background-image: url(<?php Utils::indexTheme('images/icons/remove.png'); ?>);}.body-dark .pio-action .pio-skin{background-image: url(<?php Utils::indexTheme('images/icons/skin.png'); ?>);}.body-dark .pio-action .pio-info{background-image: url(<?php Utils::indexTheme('images/icons/info.png'); ?>);}.body-dark .pio-action .pio-night{background-image: url(<?php Utils::indexTheme('images/icons/night.png'); ?>);}@media (min-width:992px) {.search{background-image:url(<?php Utils::indexTheme('images/search.png'); ?>);}.login{background-image:url(<?php Utils::indexTheme('images/login.png'); ?>)}}.search {background-position: bottom right;background-repeat: no-repeat}.login {background-position: bottom left;background-repeat:no-repeat} + .comment-by-author > .comment-body-inner > .comment-main > .comment-meta > .comment-date:before {content: '<?php gtecho('commentListTexts','byAuthor'); ?>'!important}<?php $this->options->cssEcho(); ?></style> </head> <body class="<?php if($this->options->bodyFonts && $this->options->bodyFonts=1): ?>body-serif<?php endif; ?>">
\ No newline at end of file diff --git a/includes/header.php b/includes/header.php index 1a228c2..2497966 100644 --- a/includes/header.php +++ b/includes/header.php @@ -6,7 +6,7 @@ <form method="post" action=""> <div class="search-form"> <input type="text" name="s" class="text" size="32" /> - <button type="submit" class="submit">搜索</button> + <button type="submit" class="submit"><i class="iconfont" style="font-size:30px"></i></button> </div> </form> </div> @@ -14,19 +14,19 @@ <div class="login ready"> <button class="login-close ready" id="login-close"><i class="iconfont icon-x"></i></button> <?php if($this->user->hasLogin()): ?> - <h1>你已经登陆了</h1> - <p class="large-screen" style="margin-top:0"> 不过康纳很乐意再次见到 <?php $this->user->screenName(); ?> 呢~</p> - <p class="login-enter-admin"><a href="/admin" class="col-md-3">进入后台</a></p> + <h1><?php gtecho('headerTexts','loginAlready'); ?></h1> + <p class="large-screen" style="margin-top:0"> <?php gtaecho('headerTexts','loginAlreadyInfo',$this->user->screenName); ?></p> + <p class="login-enter-admin"><a href="/admin" class="col-md-3"><?php gtecho('headerTexts','loginAdminEntrance');?></a></p> <?php else: ?> <form action="<?php $this->options->loginAction(); ?>" id="login-form" method="post" name="login" role="form" class="login-form"> - <h1>登录后台</h1> - <input type="text" name="name" autocomplete="username" placeholder="请输入用户名" required /> - <input type="password" name="password" autocomplete="current-password" placeholder="请输入密码" required /> + <h1><?php gtecho('headerTexts','loginTitle');?></h1> + <input type="text" name="name" autocomplete="username" placeholder="<?php gtecho('headerTexts','loginUsername');?>" required /> + <input type="password" name="password" autocomplete="current-password" placeholder="<?php gtecho('headerTexts','loginPassword');?>" required /> <input type="hidden" name="referer" value="<?php if($this->is('index')) $this->options->siteUrl(); else $this->permalink(); ?>"> - <button class="btn btn-normal" type="submit">登录</button> + <button class="btn btn-normal" type="submit"><?php gtecho('headerTexts','loginSubmit');?></button> </form> <?php endif; ?> </div> @@ -36,7 +36,7 @@ <!-- 移动端导航面板 --> <div class="mobile-menu ready"> <button class="mobile-menu-close ready" id="toggle-mobile-menu-close"><i class="iconfont icon-x"></i></button> - <h2 class="mobile-menu-title">页面导航</h2> + <h2 class="mobile-menu-title"><?php gtecho('headerTexts','navTitle'); ?></h2> <div class="mobile-menu-pagelist" role="navigation"><div class="container-fluid"><div class="row"> <?php if($this->options->customNav=='') { @@ -99,7 +99,7 @@ </div> </div> <div class="drawer-content"> - <a href="<?php $this->options->SiteUrl(); ?>" onclick="toggleDrawer()">首页</a> + <a href="<?php $this->options->SiteUrl(); ?>" onclick="toggleDrawer()"><?php gtecho('headerTexts','drawerHome'); ?></a> <?php if($this->options->customNav=='') { $this->widget('Widget_Contents_Page_List') @@ -143,33 +143,28 @@ <?php if($this->fields->meta==''): if($_SESSION["isPageArchive"]!=true){ ?> <div class="header-meta-line-one"> - <?php if($this->is('post')): ?><i class="iconfont icon-block" title="文章分类"></i> <?php $this->category(','); ?> <?php endif; ?> - <i class="iconfont icon-comments" title="共 <?php $this->commentsNum('0', '1', '%d'); ?> 条评论"></i> <?php $this->commentsNum('0', '1', '%d'); ?>  + <?php if($this->is('post')): ?><span class="hint--bottom" data-tooltip="<?php gtaecho('postTexts','sort_title',$this->category) ?>"><i class="iconfont"></i> <?php $this->category(','); ?></span> <?php endif; ?> + <span class="hint--bottom" data-tooltip="<?php if($this->commentsNum=='0'): gtecho('commentListTexts', 'commentNumNone'); else:gtaecho('commentListTexts', 'commentNum', $this->commentsNum);endif; ?>"><i class="iconfont"></i> <?php $this->commentsNum('0', '1', '%d'); ?></span>  </div> <div class="header-meta-line-two"> - <i class="iconfont icon-clock" title="该文章发布于 <?php $this->date(); ?>"></i> <?php $this->date(); ?>  - <i class="icon-view iconfont" title="该文章被浏览 <?php Contents::postViews($this) ?> 次"></i> <?php Contents::postViews($this) ?> + <span class="hint--bottom" data-tooltip="<?php gtaecho('postTexts', 'post_time', date('Y-m-d',$this->created)); ?>"><i class="iconfont"></i> <?php $this->date(); ?></span>  + <span class="hint--bottom" data-tooltip="<?php gtaecho('postTexts', 'post_views', Contents::postViews($this)) ?>"><i class="iconfont"></i> <?php echo Contents::postViews($this) ?></span> </div> <?php }else{ ?> <div class="header-meta-line-one"> - <i class="iconfont icon-clock" title="一切开始于 <?php Utils::getOldestPostDate(); ?>"></i> <?php Utils::getOldestPostDate(); ?>  + <i class="iconfont"></i> <?php gtaecho('archivePageTexts', 'archiveStart', Contents::getOldestPostDate());?>  </div> <div class="header-meta-line-two"> - <i class="icon-view iconfont" title="该页面被浏览 <?php Contents::postViews($this) ?> 次"></i> <?php Contents::postViews($this) ?> + <span class="hint--bottom" data-tooltip="<?php gtaecho('postTexts', 'post_views', Contents::postViews($this)) ?>"><i class="iconfont"></i> <?php echo Contents::postViews($this) ?></span> </div> <?php } else: ?> <?php $this->fields->meta(); ?><div style="display:none"><?php Contents::postViews($this) ?></div> <?php endif; - $_SESSION["isPageArchive"]=false; //清除归档页面标识,避免不必要的问题?> + $_SESSION["isPageArchive"]=false; //clear ?> </div> <?php elseif($this->is('archive')): ?> - <h1><?php $this->archiveTitle(array( - 'category' => _t('分类 %s 下的文章'), - 'search' => _t('包含关键字 %s 的文章'), - 'tag' => _t('标签 %s 下的文章'), - 'author' => _t('%s 发布的文章') - ), '', '');?></h1><?php else: endif; ?> + <h1><?php $this->archiveTitle($GLOBALS['archivesTitles'], '', '');?></h1><?php else: endif; ?> </div> </div> </div> |
