Skip to content

Commit

Permalink
Merge pull request #11 from quangtt/feature/i18n
Browse files Browse the repository at this point in the history
[i18n] Migrate to translatable theme. Add EN, VI, JA lang
  • Loading branch information
quangtt-rks authored Feb 20, 2019
2 parents be6bd0e + fa1d76a commit 7bb31ab
Show file tree
Hide file tree
Showing 18 changed files with 176 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
node_modules/
/package-lock.json
2 changes: 1 addition & 1 deletion assets/css/min/screen.min.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions assets/css/screen.css
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,7 @@ h1:hover a, h2:hover a, h3:hover a, h4:hover a, h5:hover a, h6:hover a {
}
.post-author h4 {
font-size: 2.2rem;
text-transform: none;
}
.post-author p {
margin-bottom: 0;
Expand Down
6 changes: 3 additions & 3 deletions author.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
{{! The tag above means - insert everything in this file into the {body} of the default.hbs template }}

{{! The main content area on the homepage }}
<main class="site-main wow fadeIn" data-wow-duration=".8s" role="main">
<main class="site-main" role="main">

{{! Everything inside the #author tags pulls data from the author }}
{{#author}}

<section class="site-hero {{#if cover_image}}" style="background-image: url({{cover_image}}){{else}}site-hero-no-cover{{/if}}">
<header class="site-hero-header">
{{#if feature_image}}
<div class="author-image" style="background-image: url({{img_url feature_image}})">{{name}}'s Picture</div>
<div class="author-image" style="background-image: url({{img_url feature_image}})">{{t "{name}'s Picture" name=name}}</div>
{{/if}}
<h2 class="site-hero-title">{{name}}</h2>
{{#if bio}}
Expand All @@ -24,7 +24,7 @@
{{#if location}}
<p class="author-location"><span class="icon-location"></span>{{location}}</p>
{{/if}}
<p class="author-stats"><span class="icon-posts"></span>{{plural ../pagination.total empty='No posts' singular='% post' plural='% posts'}}</p>
<p class="author-stats"><span class="icon-posts"></span>{{plural ../pagination.total empty=(t "No posts") singular=(t "1 post") plural=(t "% posts")}}</p>
</div>

</header>
Expand Down
2 changes: 1 addition & 1 deletion default.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="{{lang}}">
<head>
{{! Document Settings }}
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{! The tag above means - insert everything in this file into the {body} of the default.hbs template }}

{{! The main content area on the homepage }}
<main class="site-main wow fadeIn" data-wow-duration=".8s" role="main">
<main class="site-main" role="main">

{{! The tag below includes the post loop - partials/loop.hbs }}
{{> "loop"}}
Expand Down
20 changes: 20 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"Previous story": "Previous story",
"Next story": "Next story",
"Published": "Published",
"Hi there!": "Hi there!",
"{name}'s Picture": "{name}'s Picture",
"Subscribe": "Subscribe",
"Proudly published with {ghost_link}": "Proudly published with {ghost_link}",
"Back": "Back",
"Next": "Next",
"No posts": "No posts",
"1 post": "1 post",
"% posts": "% posts",
"posts": "posts",
"Subscribe to {site_title}": "Subscribe to {site_title}",
"Your email address": "Your email address",
"Subscribed!": "Subscribed!",
"Subscribed to {site_title} with {sub_email}": "You've successfully subscribed to <strong>{site_title}</strong> with the email address <strong>{sub_email}</strong>.",
"Author": "Author:"
}
20 changes: 20 additions & 0 deletions locales/ja.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"Previous story": "前の記事",
"Next story": "次の記事",
"Published": "公開日時",
"Hi there!": "こんにちは!",
"{name}'s Picture": "{name}の写真",
"Subscribe": "購読",
"Proudly published with {ghost_link}": "誇らしげに{ghost_link}で公開",
"Back": "戻る",
"Next": "次る",
"No posts": "記事はありません",
"1 post": "1記事",
"% posts": "%記事",
"posts": "記事",
"Subscribe to {site_title}": "{site_title}を購読する",
"Your email address": "メールアドレス",
"Subscribed!": "購読しました!",
"Subscribed to {site_title} with {sub_email}": "正常にメールアドレス<strong>{sub_email}</strong>で<strong>{site_title}</strong>を購読しました。",
"Author": "著者:"
}
20 changes: 20 additions & 0 deletions locales/vi.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"Previous story": "Đọc nữa",
"Next story": "Đọc mãi",
"Published": "Viết vào",
"Hi there!": "Xin chào!",
"{name}'s Picture": "Ảnh của {name}",
"Subscribe": "Theo dõi",
"Proudly published with {ghost_link}": "Được xây dựng dựa trên {ghost_link}",
"Back": "Quay lại",
"Next": "Tiếp tục",
"No posts": "Không có bài nào",
"1 post": "1 bài viết",
"% posts": "% bài viết",
"posts": "bài viết",
"Subscribe to {site_title}": "Theo dõi {site_title}",
"Your email address": "Địa chỉ email",
"Subscribed!": "Theo dõi thành công!",
"Subscribed to {site_title} with {sub_email}": "Bạn đã theo dõi <strong>{site_title}</strong> thành công bằng email <strong>{sub_email}</strong>.",
"Author": "Tác giả:"
}
2 changes: 1 addition & 1 deletion page.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{! This is a page template. A page outputs content just like any other post, and has all the same attributes by default, but you can also customise it to behave differently if you prefer. }}

{{! The main content area on the homepage }}
<main class="site-main wow fadeIn" data-wow-duration=".8s" role="main">
<main class="site-main" role="main">

{{! Everything inside the #post tags pulls data from the page }}
{{#post}}
Expand Down
2 changes: 1 addition & 1 deletion partials/comments.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<section class="post-comments wow fadeInUp" data-wow-duration=".8s">
<section class="post-comments">
<div id="disqus_thread"></div>

<script type="text/javascript">
Expand Down
7 changes: 3 additions & 4 deletions partials/footer.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
&nbsp;|&nbsp;
<div class="footer-navigation">
<ul>
<li><a href="{{@site.url}}/about-quang-teo">Về tác giả</a></li>
<li>
{{#if @labs.subscribers}}
<a class="subscribe" href="{{@site.url}}/subscribe/">Subscribe</a>
<a class="subscribe" href="{{@site.url}}/subscribe/">{{t "Subscribe"}}</a>
{{else}}
<a class="subscribe" href="{{@site.url}}/rss/" target="_blank">RSS</a>
<a class="subscribe" href="{{@site.url}}/rss/" target="_blank">{{t "Subscribe"}}</a>
{{/if}}
</li>
</ul>
</div>
<div class="description">Blog này được xây dựng trên <a href="https://ghost.org">Ghost</a> The professional publishing platform</div>
<div class="description">{{{t "Proudly published with {ghost_link}" ghost_link="<a href='https://ghost.org'>Ghost</a>"}}}</div>
</div>
</footer>
2 changes: 1 addition & 1 deletion partials/loop.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{! This is the post loop - each post will be output using this markup }}
{{#foreach posts}}
<article class="{{post_class}} wow fadeIn" data-wow-duration=".8s">
<article class="{{post_class}}">

<header class="post-header">
{{#if featured}}
Expand Down
4 changes: 2 additions & 2 deletions partials/pagination.hbs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<nav class="pagination" role="pagination">
<ul>
{{#if prev}}
<li class="prev"><a href="{{page_url prev}}">Back</a></li>
<li class="prev"><a href="{{page_url prev}}">{{t "Back"}}</a></li>
{{/if}}
{{#if next}}
<li class="next"><a href="{{page_url next}}">Next</a></li>
<li class="next"><a href="{{page_url next}}">{{t "Next"}}</a></li>
{{/if}}
</ul>
</nav>
15 changes: 15 additions & 0 deletions partials/subscribe_form.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<form method="post" action="{{action}}" id="{{form_id}}" class="{{form_class}}">
{{! This is required for the form to work correctly }}
{{hidden}}

<div class="form-group{{#if error}} error{{/if}}">
{{input_email id=input_id class=input_class placeholder=placeholder value=email autofocus=autofocus}}
</div>
<button id="{{button_id}}" class="{{button_class}}" type="submit"><span>{{t "Subscribe"}}</span></button>
{{! This is used to get extra info about where this subscriber came from }}
{{script}}
</form>

{{#if error}}
<p class="main-error">{{error.message}}</p>
{{/if}}
14 changes: 7 additions & 7 deletions post.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{!< default}}
{{! The tag above means - insert everything in this file into the {body} of the default.hbs template }}

<main class="site-main wow fadeIn" data-wow-duration=".8s" role="main">
<main class="site-main" role="main">

{{! Everything inside the #post tags pulls data from the post }}
{{#post}}
Expand All @@ -10,7 +10,7 @@
<header class="post-header">
<h1>{{title}}</h1>
<div class="post-meta">
<time datetime="{{date format='YYYY-MM-DD'}}"><b>Viết vào: </b> {{date format="YYYY-MM-DD H:mm"}}</time>
<time datetime="{{date format='YYYY-MM-DD'}}"><b>{{t "Published"}}: </b> {{date format="YYYY-MM-DD H:mm"}}</time>
<div class="tags">
{{#foreach tags}}
<a href="{{url}}">#{{name}}</a>
Expand All @@ -30,7 +30,7 @@
<div class="column">
{{#prev_post}}
<div class="prev">
<p>Đọc nữa</p>
<p>{{t "Previous story"}}</p>
<h3><a href="{{url}}">{{title}}</a></h3>
</div>
{{/prev_post}}
Expand All @@ -39,7 +39,7 @@
<div class="column">
{{#next_post}}
<div class="next">
<p>Đọc mãi</p>
<p>{{t "Next story"}}</p>
<h3><a href="{{url}}">{{title}}</a></h3>
</div>
{{/next_post}}
Expand All @@ -54,16 +54,16 @@
{{#primary_author}}
<section class="post-author">
{{#if profile_image}}
<a class="author-image" href="{{url}}" style="background-image: url({{img_url profile_image}})"><span class="hidden">{{name}}'s Picture</span></a>
<a class="author-image" href="{{url}}" style="background-image: url({{img_url profile_image}})"><span class="hidden">{{t "{name}'s Picture" name=name}}</span></a>
{{/if}}

<div class="author-data">
<h4>Written by <a href="{{url}}">{{name}}</a></h4>
<h4>{{t "Author"}} <a href="{{url}}">{{name}}</a></h4>

{{#if bio}}
<p>{{bio}}</p>
{{else}}
<p>Read <a href="{{url}}">more posts</a> by this author.</p>
<p>{{t "Hi there!"}}</p>
{{/if}}
</div>

Expand Down
75 changes: 75 additions & 0 deletions subscribe.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<!doctype html>
<!--[if (IE 8)&!(IEMobile)]><html class="no-js lt-ie9" lang="en"><![endif]-->
<!--[if (gte IE 9)| IEMobile |!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

<title>{{@site.title}} - {{t "Subscribe"}}</title>

<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes" />

<link rel="shortcut icon" href="{{asset "favicon.ico"}}">
<meta http-equiv="cleartype" content="on">

<link rel="stylesheet" href="{{asset "public/ghost.css" hasMinFile="true"}}"/>
</head>
<body>
<div class="gh-app">
<div class="gh-viewport">
<main class="gh-main" role="main">
<div class="gh-flow">
<header class="gh-flow-head">
<nav class="gh-flow-nav">
<a href="{{#if subscribed_url}}{{subscribed_url}}{{else}}{{@site.url}}{{/if}}" class="gh-flow-back">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="17px" height="27px" viewBox="0 0 17 27" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 39.1 (31720) - http://www.bohemiancoding.com/sketch -->
<title>arrow-left3</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
<g id="Stroke-42" transform="translate(2.000000, 2.000000)" stroke-width="3" stroke="#0B0B0A">
<polyline points="13.5401 0.4256 0.3971 11.9256 13.5401 23.4256"></polyline>
</g>
</g>
</svg>
{{t "Back"}}
</a>
</nav>
</header>

<div class="gh-flow-content-wrap">
<section class="gh-flow-content">
{{^if success}}
<header>
<h1>{{t "Subscribe to {site_title}" site_title=@site.title}}</h1>
</header>

{{subscribe_form
form_class="gh-signin"
input_class="gh-input"
button_class="gh-btn gh-btn-blue gh-btn-block"
placeholder=(t "Your email address")
autofocus="true"
}}
{{else}}
<header>
<h1>{{t "Subscribed!"}}</h1>
</header>

<p>
{{{t "Subscribed to {site_title} with {sub_email}" site_title=@site.title sub_email=email}}}
</p>
{{/if}}
</section>
</div>
</div>
</main>
</div>
</div>
</body>
</html>
4 changes: 2 additions & 2 deletions tag.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{! The tag above means - insert everything in this file into the {body} of the default.hbs template }}

{{! The main content area on the homepage }}
<main class="site-main wow fadeIn" data-wow-duration=".8s" role="main">
<main class="site-main" role="main">

{{! Everything inside the #tag tags pulls data from the tag }}
{{#tag}}
Expand All @@ -14,7 +14,7 @@
{{#if description}}
{{description}}
{{else}}
{{../pagination.total}} bài viết
{{plural ../pagination.total empty=(t "No posts") singular=(t "1 post") plural=(t "% posts")}}
{{/if}}
</p>
</header>
Expand Down

0 comments on commit 7bb31ab

Please sign in to comment.