Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Commit

Permalink
預設為 English 並支援台灣正體語系
Browse files Browse the repository at this point in the history
  • Loading branch information
YamiOdymel committed Sep 12, 2021
1 parent 3d7f5e7 commit b5f34d1
Show file tree
Hide file tree
Showing 14 changed files with 223 additions and 30 deletions.
4 changes: 2 additions & 2 deletions 404.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<!-- .nothing -->
<div class="nothing">
<div class="nothing__header">404</div>
<div class="nothing__description">找不到該頁面</div>
<a href="<?php echo get_bloginfo('url'); ?>" class="nothing__button">← 返回首頁</a>
<div class="nothing__description"><?php _e( 'Page not found', 'tunalog' ); ?></div>
<a href="<?php echo esc_url( home_url() ); ?>" class="nothing__button">← 返回首頁</a>
</div>
<!-- / .nothing -->

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Tunalog 又稱鮪魚紀錄,是個貓咪喜歡的東西。這是一個極簡風

## 注意事項

- 這個佈景主題不支援翻譯語系,目前訊息字串是寫死的。
- 還在 Beta 測試階段。
- 區塊編輯器的樣式保持 WordPress 預設樣式,因此撰寫文章時的樣式會與實際預覽不相符。
- 完整支援行動裝置,是響應式設計(Responsive Design)的網站。
Expand Down Expand Up @@ -59,11 +58,11 @@ Tunalog 又稱鮪魚紀錄,是個貓咪喜歡的東西。這是一個極簡風
- **全域寬度屬性**

文章的寬度可以更窄,避免內容過短時造成的空虛感。(710px / 610px)

- **字型樣式**

你可以替網站內容選擇一個更相符的字型風格。(Noto Sans / Noto Serif)

- **字體大小**

網站的字體可以偏大令人更容易閱讀,同時搭配「全域寬度屬性」還有自己的撰寫習慣,可以讓整個網站的版面不再那麼空白。(16px / 18px)
Expand Down
84 changes: 84 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Tunalog

Tunalog 又稱鮪魚紀錄,是個貓咪喜歡的東西。這是一個極簡風格的單欄式 WordPress 佈景主題,並且帶有 Highlight.js 的程式碼標註功能。同時內建良好地社群網站(Facebook 與 Twitter)的摘要系統。使用這個佈景主題需要 WordPress 5.3,且發文時須透過新的區塊編輯器(Block Editor)。

![](./screenshot.png)

## 注意事項

- 還在 Beta 測試階段。
- 區塊編輯器的樣式保持 WordPress 預設樣式,因此撰寫文章時的樣式會與實際預覽不相符。
- 完整支援行動裝置,是響應式設計(Responsive Design)的網站。
- 首頁支援選單。

## 程式碼標註

這個佈景主題採用 Highlight.js 程式碼標註功能。你可以建立一個程式區塊,而 Highlight.js 會自動偵測其程式碼並載入相對應的程式行為。如果某些程式被誤判,也能指定程式語言。其方法是在該區塊增加指定樣式類別(如:`language-go`、`language-csharp`)。

## 自訂功能

這個佈景主題支援下列自訂功能。

### 列表設定

- **首頁特色圖片預覽**

是否要在文章列表中顯示其文章的特色圖片?(顯示於文繞圖 / 以背景圖片呈現 / 停用)

- **發文者名稱**

在列表中的文章是否要顯示作者名稱?若部落格有多個作者這將會幫上不小的忙。(顯示 / 隱藏)

### 內文設定

- **社群網路預覽友善(OG)**

啟用此功能後,會讓你的文章連結預覽在社群網站(如:Facebook、Twitter)上有著更好的視覺體驗。但如果你已經有安裝其他類似 SEO 友善的擴充套件,則請將此功能關閉。(啟用 / 停用)

- **頁腳動力提供者**

你可以在頁腳選擇要不要顯示這個佈景主題的名稱,好讓更多人知道這個神奇蹦蹦超棒異域主題!拜託啦。(顯示「以套用 Tunalog 佈景主題的 WordPress 發表」/ 顯示「驕傲地採用 WordPress 發表」/ 停用)

- **頁腳版權聲明**

是否在頁腳顯示網站名稱與版權聲明年份?(啟用 / 停用)

- **標頭與頁尾寬度**

標頭的網站名稱與頁尾的寬度是否要跟文章內容一樣等寬?(與內容同寬 / 更寬)

- **內文左右對齊**

文章的內容可以左右對齊達到最佳的排版視覺效果,但在字數較少的行數上會有較為明顯的字體間距反而有可能適得其反。(啟用 / 僅在行動裝置啟用 / 停用)

- **強制圖片長寬比**

強制將文章裡的所有圖片裁切並以 16:9 的長寬比呈現。(啟用並置上 / 啟用並置中 / 停用)

- **全域寬度屬性**

文章的寬度可以更窄,避免內容過短時造成的空虛感。(710px / 610px)

- **字型樣式**

你可以替網站內容選擇一個更相符的字型風格。(Noto Sans / Noto Serif)

- **字體大小**

網站的字體可以偏大令人更容易閱讀,同時搭配「全域寬度屬性」還有自己的撰寫習慣,可以讓整個網站的版面不再那麼空白。(16px / 18px)

- **程式碼標註**

是否要透過 Highlight.js 螢光標記程式碼區塊?(啟用 / 停用)

- **作者資訊位置**

發文作者的個人資訊(頭像、名稱與簡介)應出現在內文中的何處?(文首 / 文末 / 隱藏)

- **程式碼區塊寬度**

在內文中的程式碼區塊應該以何種寬度呈現?等寬會與內文同寬,而全螢幕會延伸到整個螢幕的寬度。(等寬 / 全螢幕)

- **留言樣式**

留言的區域應以何種樣式呈現?區塊會帶有底色以呈現成明顯的區塊樣式。(標準 / 區塊)
6 changes: 3 additions & 3 deletions comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}
?>
<?php if ( $comments_number > 0 ) { ?>
<div id="comments" class="comments__count">這篇文章有 <?php echo $comments_number; ?> 則留言</div>
<div id="comments" class="comments__count"><?php printf( _n( '%s thought on the post', '%s thoughts on the post', $comments_number, 'tunalog' ), number_format_i18n( $comments_number )); ?></div>
<!-- .comments_wrapper -->
<div class="comments_wrapper">
<?php
Expand All @@ -42,8 +42,8 @@
<?php if ( get_comment_pages_count() > 1 ) { ?>
<div class="comments_pagination">
<?php
$previous_comments = get_previous_comments_link( '舊留言' );
$next_comments = get_next_comments_link( '新留言 →' );
$previous_comments = get_previous_comments_link( __( 'Older Comments', 'tunalog' ) );
$next_comments = get_next_comments_link( __( 'Newer Comments →', 'tunalog' ) );
?>
<div class="pagination__previous">
<?php if( $previous_comments ) { echo $previous_comments; } ?>
Expand Down
4 changes: 2 additions & 2 deletions footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
<?php if ( get_theme_mod( 'display_by', 'enabled_all' ) != 'disabled' ) { ?>
<div class="copyright__right">
<?php if ( get_theme_mod( 'display_by', 'enabled_all' ) == 'enabled_all' ) { ?>
以套用 <a href="//github.com/teacat/tunalog">Tunalog</a> 佈景主題的 <a href="//tw.wordpress.org/">WordPress</a> 發表
<?php _e( 'Powered by <a href="//tw.wordpress.org/">WordPress</a> with <a href="//github.com/teacat/tunalog">Tunalog</a> theme', 'tunalog' ); ?>
<?php } else { ?>
驕傲地採用 <a href="//tw.wordpress.org/">WordPress</a> 發表
<?php _e ( 'Proudly powered by <a href="//tw.wordpress.org/">WordPress</a>', 'tunalog' ); ?>
<?php } ?>
</div>
<?php } ?>
Expand Down
9 changes: 9 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ function tunalog_register_styles() {
}
add_action( 'wp_enqueue_scripts', 'tunalog_register_styles' );

/**
* 語系
*/

function tunalog_load_theme_textdomain() {
load_theme_textdomain( 'tunalog', get_template_directory() . '/languages' );
}
add_action( 'after_setup_theme', 'tunalog_load_theme_textdomain' );

/**
* 自訂選單
*/
Expand Down
6 changes: 3 additions & 3 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@
<!-- .singular-header -->
<div class="singular-header">
<div class="header__wrapper">
<a href="<?php echo get_bloginfo('url'); ?>" class="header__title"><?php echo get_bloginfo('name'); ?></a>
<a href="<?php echo esc_url( home_url() ); ?>" class="header__title"><?php echo get_bloginfo('name'); ?></a>
<?php if ( is_active_sidebar( 'sidebar-1' ) ) { ?>
<a class="header__button" href="#!">選單</a>
<a class="header__button" href="#!"><?php _e( 'Menu', 'tunalog' ); ?></a>
<?php } ?>
</div>
</div>
Expand All @@ -113,7 +113,7 @@

<!-- .global-header -->
<div class="global-header">
<a class="header__title" href="<?php echo get_bloginfo('url'); ?>">
<a class="header__title" href="<?php echo esc_url( home_url() ); ?>">
<?php if ( is_category() ) { ?>
<?php echo single_cat_title(); ?>
<?php } else if ( is_archive() ) { ?>
Expand Down
16 changes: 8 additions & 8 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php get_header(); ?>

<?php if ( is_search() ) { ?>
<form class="global-search" method="get" action="<?php echo home_url('/'); ?>">
<input type="text" class="search__field" name="s" placeholder="在此輸入關鍵字…" value="<?php the_search_query(); ?>">
<input class="search__button" type="submit" value="搜尋">
<form class="global-search" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<input type="text" class="search__field" name="s" placeholder="<?php _e( 'Search anything...', 'tunalog' ); ?>" value="<?php the_search_query(); ?>">
<input class="search__button" type="submit" value="<?php _e( 'Search', 'tunalog' ); ?>">
</form>
<?php } ?>

Expand Down Expand Up @@ -56,15 +56,15 @@
<div class="global-pagination">
<div class="pagination__previous">
<?php if ($paged != 1) { ?>
<?php echo previous_posts_link( '新文章' ); ?>
<?php echo previous_posts_link( __( 'Newer Posts', 'tunalog' ) ); ?>
<?php } ?>
</div>
<div class="pagination__info">
目前第 <?php echo $paged ?> 頁,共有 <?php echo $total_pages ?>
<?php printf( __('Page %s of %s', 'tunalog'), $paged, $total_pages ); ?>
</div>
<div class="pagination__next">
<?php if ($paged != $total_pages) { ?>
<?php echo next_posts_link( '舊文章 →' ); ?>
<?php echo next_posts_link( __( 'Older Posts →', 'tunalog' ) ); ?>
<?php } ?>
</div>
</div>
Expand All @@ -74,8 +74,8 @@
<?php if ( is_search() && $total_pages == 0 ) { ?>
<!-- .global-nothing -->
<div class="global-nothing">
<div class="nothing__header">找不到文章</div>
<div class="nothing__description">請試著變換搜尋關鍵字</div>
<div class="nothing__header"><?php _e( 'No posts found', 'tunalog'); ?></div>
<div class="nothing__description"><?php _e( 'Try another keyword', 'tunalog'); ?></div>
</div>
<!-- / .global-nothing -->
<?php } ?>
Expand Down
Binary file added languages/zh_TW.mo
Binary file not shown.
100 changes: 100 additions & 0 deletions languages/zh_TW.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# Blank WordPress Pot
# Copyright 2014 ...
# This file is distributed under the GNU General Public License v3 or later.
msgid ""
msgstr ""
"Project-Id-Version: Tunalog\n"
"Report-Msgid-Bugs-To: Translator Name <[email protected]>\n"
"POT-Creation-Date: 2021-09-12 15:33+0800\n"
"PO-Revision-Date: \n"
"Last-Translator: \n"
"Language-Team: Yami Odymel <[email protected]>\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Textdomain-Support: yesX-Generator: Poedit 1.6.4\n"
"X-Poedit-SourceCharset: UTF-8\n"
"X-Poedit-KeywordsList: __;_e;esc_html_e;esc_html_x:1,2c;esc_html__;"
"esc_attr_e;esc_attr_x:1,2c;esc_attr__;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;"
"_x:1,2c;_n:1,2;_n_noop:1,2;__ngettext:1,2;__ngettext_noop:1,2;_c,"
"_nc:4c,1,2\n"
"X-Poedit-Basepath: ..\n"
"X-Generator: Poedit 3.0\n"
"X-Poedit-SearchPath-0: .\n"

#: 404.php:6
msgid "Page not found"
msgstr "找不到該頁面"

#: comments.php:31
#, php-format
msgid "%s thought on the post"
msgid_plural "%s thoughts on the post"
msgstr[0] "這篇文章有 %s 則留言"

#: comments.php:45
msgid "← Older Comments"
msgstr "← 舊留言"

#: comments.php:46
msgid "Newer Comments →"
msgstr "新留言 →"

#: footer.php:45
msgid ""
"Powered by <a href=\"//tw.wordpress.org/\">WordPress</a> with <a href=\"//"
"github.com/teacat/tunalog\">Tunalog</a> theme"
msgstr ""
"以套用 <a href=\"//github.com/teacat/tunalog\">Tunalog</a> 佈景主題的 <a "
"href=\"//tw.wordpress.org/\">WordPress</a> 發表"

#: footer.php:47
msgid "Proudly powered by <a href=\"//tw.wordpress.org/\">WordPress</a>"
msgstr "驕傲地採用 <a href=\"//tw.wordpress.org/\">WordPress</a> 發表"

#: header.php:106 sidebar.php:4
msgid "Menu"
msgstr "選單"

#: index.php:5 searchform.php:2
msgid "Search anything..."
msgstr "在此輸入關鍵字..."

#: index.php:6 searchform.php:3
msgid "Search"
msgstr "搜尋"

#: index.php:59
msgid "← Newer Posts"
msgstr "← 新文章"

#: index.php:63
#, php-format
msgid "Page %s of %s"
msgstr "目前第 %s 頁,共有 %s 頁"

#: index.php:67
msgid "Older Posts →"
msgstr "舊文章 →"

#: index.php:77
msgid "No posts found"
msgstr "找不到文章"

#: index.php:78
msgid "Try another keyword"
msgstr "請試著變換搜尋關鍵字"

#: sidebar.php:5
msgid "Close"
msgstr "關閉"

#: singular.php:90
msgid "Previous Post"
msgstr "上一篇"

#: singular.php:95
msgid "Next Post"
msgstr "下一篇"
6 changes: 3 additions & 3 deletions searchform.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<form class="compact-search" method="get" action="<?php echo home_url('/'); ?>">
<input type="text" class="search__field" name="s" placeholder="在此輸入關鍵字…" value="<?php the_search_query(); ?>">
<input class="search__button" type="submit" value="搜尋">
<form class="compact-search" method="get" action="<?php echo esc_url( home_url( '/' ) ) ; ?>">
<input type="text" class="search__field" name="s" placeholder="<?php _e( 'Search anything...', 'tunalog'); ?>" value="<?php the_search_query(); ?>">
<input class="search__button" type="submit" value="<?php _e( 'Search', 'tunalog'); ?>">
</form>
4 changes: 2 additions & 2 deletions sidebar.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- .sidebar -->
<div class="global-sidebar">
<div class="sidebar__header">
選單
<a href="#!" class="sidebar__close">關閉</a>
<?php _e( 'Menu', 'tunalog' ); ?>
<a href="#!" class="sidebar__close"><?php _e( 'Close', 'tunalog' ); ?></a>
</div>

<?php
Expand Down
6 changes: 3 additions & 3 deletions singular.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<?php if ( have_posts() ) { while ( have_posts() ) { the_post(); ?>
<!-- .article -->
<article class="singular-article">
<article <?php post_class( 'singular-article' ); ?>>

<?php if ( has_post_thumbnail() && ! post_password_required() ) {?>
<!-- .article__featured -->
Expand Down Expand Up @@ -87,12 +87,12 @@
?>
<?php if ( get_previous_post() ) { ?>
<a href="<?php echo get_permalink( $previous->ID ); ?>" class="pagenav__previous">
<div class="pagenav__label">上一篇</div>
<div class="pagenav__label"><?php _e( 'Previous Post', 'tunalog' ); ?></div>
<div class="pagenav__title"><?php echo get_the_title($previous) ?></div>
</a>
<?php } if ( get_next_post() ) { ?>
<a href="<?php echo get_permalink( $next->ID ); ?>" class="pagenav__next">
<div class="pagenav__label">下一篇</div>
<div class="pagenav__label"><?php _e( 'Next Post', 'tunalog' ); ?></div>
<div class="pagenav__title"><?php echo get_the_title($next) ?></div>
</a>
<?php } ?>
Expand Down
3 changes: 2 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Theme Name: Tunalog
Text Domain: tunalog
Version: 1.31
Version: 1.32
Requires at least: 5.3
Requires PHP: 5.2.4
Description: 一個極簡設計的單欄式 WordPress 部落格佈景主題,並帶有 Highlight.js 的程式碼標記功能。同時支援 WordPress 的區塊編輯器以達成最佳的使用者閱讀體驗!
Expand All @@ -10,6 +10,7 @@ Author: TeaCat
Author URI: https://github.com/teacat/tunalog
License: DON'T BE A DICK PUBLIC LICENSE
License URI: https://github.com/philsturgeon/dbad
Domain Path: /languages
Tunalog 裡的檔案皆以「別當個雞掰人」公眾授權條款釋出,這意味著你可以更改所有你想改的東西!
但是希望你可以留下一些授權資訊,好讓神奇蹦蹦原作者(其實就是我啦)受益。
Expand Down

0 comments on commit b5f34d1

Please sign in to comment.