Skip to content

Commit 0b34dac

Browse files
authored
Merge pull request #177 from aturret/Feature-Simplified-Chinese-translation
Feature: simplified chinese translation
2 parents 9b65257 + be59c13 commit 0b34dac

File tree

228 files changed

+6004
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

228 files changed

+6004
-185
lines changed

site/_config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ hello:
3434
nl: Hallo!
3535
he: "שלום!"
3636
ko: 안녕하세요!
37+
zh-CN: 你好!
3738

3839
plugins: [jekyll-polyglot, jekyll-paginate]
3940
# Permalinks
@@ -45,6 +46,7 @@ exclude: ['LICENSE.md', 'README.md', 'publi.sh', 'Gemfile.lock', 'Gemfile']
4546
title: Polyglot
4647
tagline: 'Straightforward I18n for Jekyll Blogs'
4748
description:
49+
zh-CN: 一款为 <a href="http://jekyllrb.com" target="_blank">Jekyll</a> 提供 i18n 多语言功能的插件,方便快捷,适用于各类大小博客。<a href="https://github.com/untra" target="_blank">@untra</a> 出品。
4850
ko: <a href="https://github.com/untra" target="_blank">@untra</a>가 만든, 크고 작은 블로그 모두가 빠르고 직관적인 다국어 지원을 가능케 하는 i18n 지원 <a href="http://jekyllrb.com" target="_blank">Jekyll</a> 플러그인.
4951
he: תוסף תמיכה ב-i18n עבור <a href="http://jekyllrb.com" target="_blank">Jekyll</a> שהופך את התמיכה מרובת שפות למהירה ואינטואיטיבית, עבור בלוגים גדולים וקטנים. תוצרת <a href="https://github.com/untra" target="_blank">@untra</a>.
5052
nl: Een plug-in voor internationlisering van <a href="http://jekyllrb.com" target="_blank">Jekyll</a> die meertalige ondersteuning snel en intuïtief maakt, voor blogs groot en klein. Gemaakt door <a href="https://github.com/untra" target="_blank">@untra</a>.
@@ -66,6 +68,7 @@ github:
6668
repo: https://github.com/untra/polyglot
6769

6870
#Polyglot
69-
languages: ["en", "es", "de", "fr", "ru", "nl", "he", "ko"]
71+
languages: ["en", "es", "de", "fr", "ru", "nl", "he", "ko", "zh-CN"]
7072
default_lang: "en"
7173
exclude_from_localization: ["javascript", "images", "css", "public"]
74+
parallel_localization: false

site/_data/zh-CN/sample.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
1: "你好,欢迎来到示例页面"
2+
2: "请您欣赏本页"
3+
3: "本页面由 _data 目录下的一个 .yml 文件生成"
4+
4: "HTML 标签<i>依然保留</i>"
5+
5: '而链接则会被<a href="/">相对化</a>'
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
layout: post
3+
title: Jekyll 是什么?
4+
lang: zh-CN
5+
---
6+
7+
[Jekyll](http://jekyllrb.com) 是一款静态网站生成器,同时还是一款开源工具,可用于创建适用于各种形式及尺寸的简单却强大的网站。根据[Jekyll 的官方项目说明](https://github.com/mojombo/jekyll/blob/master/README.markdown):
8+
9+
> Jekyll 是一个简单、具备博客功能的静态网站生成器。Jekyll 接收你的内容,渲染 Markdown 和 Liquid 模板,生成一个完整的静态网站,可以通过Apache、Nginx 或其他 Web 服务器进行提供服务。Jekyll 同时还是 GitHub Pages 背后所采用的引擎,你可以使用它来从你的 GitHub 代码仓库直接托管网站。
10+
11+
它是一款非常有用的工具,我们非常推荐您使用 Hyde 主题部署 Jekyll。
12+
13+
若想了解更多,请[查看项目的 GitHub 页面](https://github.com/mojombo/jekyll)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
layout: post
3+
title: Hyde 介绍
4+
lang: zh-CN
5+
---
6+
7+
Hyde 是一款大胆的双栏 [Jekyll](http://jekyllrb.com) 主题。其采用了突出的侧边栏和简洁的内容的结合。Hyde 基于 Jekyll 的管家 [Poole](http://getpoole.com) 构建。
8+
9+
### 基于 Poole 构建
10+
11+
Poole 是 Jekyll 的管家,是 [@mdo](https://twitter.com/mdo) 开发的用于提供可靠且高效的 Jekyll 主题开发模板。Poole 以及所有基于它构建的 Jekyll 主题(正如本网站正在使用的 Hyde)均包含如下内容:
12+
13+
* 完整的 Jekyll 安装所需内容(版式、配置、[404](/404)[RSS feed](/atom.xml)、文章,以及[示例页面](/about))。
14+
* 对手机显示友好的界面和开发。
15+
* 使用 CSS 中的 `rem` 单位轻松可伸缩的文本和组件大小。
16+
* 支持多种多样的 HTML 标签。
17+
* 每篇文章下方有相关文章(Jekyll 实现的基于时间的排序)。
18+
* 语法高亮功能,感谢 Pygments(基于 Python 的代码片段高亮器)
19+
20+
### Hyde 的特性
21+
22+
除了 Poole 已有的特性外,Hyde 的特性还包括:
23+
24+
* 侧边栏支持文本模块和动态生成的导航菜单,包括活动链接的支持。
25+
* Two orientations for content and sidebar, default (left sidebar) and [reverse](https://github.com/poole/lanyon#reverse-layout) (right sidebar), available via `<body>` classes
26+
* 使用 `<body>` 选择[八种可选配色主题](https://github.com/poole/hyde#themes)
27+
28+
[请阅读文档](https://github.com/poole/hyde#readme)了解更多。
29+
30+
### 浏览器支持
31+
32+
Hyde 是一个面向未来的项目。除了最新版本的 Chrome、Safari(移动和桌面版)和 Firefox 之外,它仅与 Internet Explorer 9 及更高版本兼容。
33+
34+
### 下载
35+
36+
Hyde 代码托管在 GitHub 上,供大家开发。请前往 <a href="https://github.com/poole/hyde">GitHub 代码库</a>进行下载、汇报问题,以及特性提交。
37+
38+
谢谢使用!
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
layout: post
3+
title: Polyglot 版本 1.1.0
4+
lang: zh-CN
5+
---
6+
7+
Polyglot 现已全面支持 [Jekyll 3.0](https://jekyllrb.com/news/2015/10/26/jekyll-3-0-released/) 博客![去试试看吧!](https://github.com/untra/polyglot)
8+
9+
{% highlight yaml %}
10+
gem 'jekyll-polyglot', '~> 1.1.0'
11+
{% endhighlight %}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
layout: post
3+
title: Polyglot 简介
4+
lang: zh-CN
5+
---
6+
7+
在经过数月的打磨后,我很骄傲地为大家介绍 **Polyglot**:为那些*需要*为其受众提供多语言内容的网站所打造的,一款 [Jekyll](http://jekyllrb.com) 的 i18n 插件。
8+
9+
### 特性
10+
11+
尽管市面上存在其他的 Jekyll 多语言插件,Polyglot 却也有其独特之处。多语言插件,Polyglot 在包揽了那些通常留给 Jekyll 开发者去做的脏活累活(比如为了保持不同语言网站下站点地图保持一致而去折腾 url 的写法)的同时,还为他们提供了高效且简单的 SEO 与内容聚合工具。
12+
13+
## 创建相对化链接
14+
15+
在过去,一款静态网站/博客的多语言插件必须费心地跟进维护网站上所提供的每种语言的相对链接。开发者很容易犯错,然后外语访客就会一下子掉进还没翻译的内容之中。
16+
17+
Polyglot 自动化地为每种你希望网站所拥有的语言的 url 进行相对化处理。这可以让网站的访客可以在浏览你的网站时一直使用同一种语言的版本。
18+
19+
## 应变支持
20+
21+
当你*没有*为多语言内容提供翻译版本时,Jekyll 依然会为该语言的子站点根据已有的内容进行构建。而在你*提供*了多语言翻译版本的情况下,Jekyll 会根据该内容对该语言的子站点构建对应内容。就是这么简单。
22+
23+
站点地图对所有语言均保持一致,翻译内容与其所处的子站点一一对应。
24+
25+
## 富文本翻译
26+
27+
一般来讲,富文本内容的多语言翻译很难实现。对一个 Jekyll 网站来说,多语言的短字符串或者某些语言的特定用语很难在显示上保持一致。
28+
29+
*但现在却简单如斯*:只需在你的 `config.yml` 文件中,按照如下方式存储字符串:
30+
{% highlight yaml %}
31+
hello:
32+
en: Hello!
33+
es: ¡hola!
34+
fr: Bonjour!
35+
de: Guten Tag!
36+
{% endhighlight %}
37+
按照如下方式使用 Liquid 模板内容:
38+
{% highlight html %}
39+
{% raw %}
40+
{{ site.hello[site.active_lang]}}
41+
{% endraw %}
42+
{% endhighlight %}
43+
会生成如下内容:
44+
<p class="message">
45+
{{ site.hello[site.active_lang]}}
46+
</p>
47+
48+
## 快速,异步,零成本构建
49+
50+
Polyglot 会和构建你的默认语言站点一样构建你的多语言站点。Polyglot 会以最小的成本在各自独立的进程下*同时*构建你的网站的每种语言的子站点。这意味着,你的网站的构建时间不会因为支持语言的数量而增加。
51+
52+
### 下载
53+
54+
Polyglot 支持 gem 版本,也可以当作 Jekyll 插件使用。可以使用如下代码安装:
55+
{% highlight bash %}
56+
gem install 'jekyll-polyglot'
57+
{% endhighlight %}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
layout: post
3+
title: Polyglot 1.2.4
4+
lang: zh-CN
5+
---
6+
7+
Polyglot 的全新版本现已推出。去试试吧!
8+
9+
{% highlight yaml %}
10+
gem install jekyll-polyglot
11+
{% endhighlight %}
12+
13+
本版本由 GitHub 用户 [vlsi](https://github.com/vlsi) 的热心支持提供,他修复了一些 bug,并添加了下列新特性:
14+
15+
### 支持绝对 URL 的多语言翻译版本
16+
17+
Polyglot 现在会翻译你的 `site.url`,因此,绝对 URL 也会得到翻译了。
18+
19+
### 支持对全部 Jekyll 合集的翻译
20+
21+
[Jekyll 合集](https://jekyllrb.com/docs/collections/)是一项 Jekyll 的全新特性。本次更新也会把所有现有合集都进行翻译,而不只有文章和页面。
22+
23+
### `site.data[:lang]` 存在时,对 `site.data` 的富文本使用语言特定的 `_data` 内容翻译
24+
25+
根目录下的富文本会在生成时。之前如果想要渲染富文本内容,你需要按照如下方式使用:
26+
{% highlight html %}
27+
{% raw %}
28+
{{ site.data[site.active_lang].richTextString }}
29+
{% endraw %}
30+
{% endhighlight %}
31+
现在,富文本内容可以直接使用如下标签进行渲染:
32+
{% highlight html %}
33+
{% raw %}
34+
{{ site.data.richTextString }}
35+
{% endraw %}
36+
{% endhighlight %}
37+
38+
### `I18n_Headers` 在留空时使用来自 `site.url` 的默认值
39+
40+
用户现在可以在不指定特定 url 的情况下使用下列标签:
41+
{% highlight html %}
42+
{% raw %}
43+
{% I18n_Headers %}
44+
{% endraw %}
45+
{% endhighlight %}
46+
这些标签将会使用你的 `site.url` 的默认值。
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
layout: post
3+
title: Polyglot 1.2.0
4+
lang: zh-CN
5+
---
6+
7+
Polyglot 的全新版本现已推出。去试试吧!
8+
9+
{% highlight yaml %}
10+
gem install jekyll-polyglot
11+
{% endhighlight %}
12+
13+
此外,还请把 `jekyll-polyglot` 添加到你的网站的 `_config.yml` 的 gem 列表中。
14+
15+
本版本主要是为接下来的新特性以及更好的多语言内容管理提供基础准备。此外,本版本还包括了一些新特性:
16+
17+
## {% raw %} {% I18n_Headers %} {% endraw %}
18+
19+
请把这些标签和[你的网站的 url](https://github.com/untra/polyglot/blob/site/_includes/head.html#L6) 一同放入你的 `includes` 文件夹下的 `head.html` 文件中,以此获得最大化的多语言站点 SEO 。其效果与如下 Liquid 代码等同:
20+
21+
{% highlight html %}{% raw %}
22+
<meta http-equiv="Content-Language" content="{{site.active_lang}}">
23+
<link rel="alternate"
24+
hreflang="{{site.default_lang}}"
25+
href="http://yoursite.com{{page.permalink}}" />
26+
{% for lang in site.languages %}
27+
{% if lang == site.default_lang %}
28+
{% continue %}
29+
{% endif %}
30+
<link rel="alternate"
31+
hreflang="{{lang}}"
32+
href="http://yoursite.com/{{lang}}{{page.permalink}}" />
33+
{% endfor %}
34+
{% endraw %}
35+
{% endhighlight %}
36+
37+
同样是要放在你的网页 header 中,但是 Polyglot 的方案更加快捷清晰!若需更多详情,请参照 [SEO 页面](/seo)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
layout: post
3+
title: Polyglot 1.3.0
4+
lang: zh-CN
5+
---
6+
7+
Polyglot 的全新版本现已推出。去试试吧!
8+
9+
{% highlight yaml %}
10+
gem install jekyll-polyglot
11+
{% endhighlight %}
12+
13+
本次发布得益于以下 GitHub 用户的支持:
14+
15+
* [vlsi](https://github.com/vlsi)
16+
* [pserwylo](https://github.com/pserwylo)
17+
18+
### 递归式合并不同语言特定的 `site.data`
19+
20+
现在,在你的 `site.data` 目录下的特定语言内容将会递归地被合并在一起。也就是说,`active_lang` 的内容会优先于 `default_lang` 的内容呈现,也就是优先于非特定语言的内容。([#59](https://github.com/untra/polyglot/pull/59)
21+
22+
### 未指定语言的文件仍然会被写入 `default_lang` 的站点根目录
23+
24+
如果没有在 `languages` 中定义 `default_lang`,本功能会确保没有指定语言的文件(也就是被排除在本地化之外的文件)仍然会被写入站点根目录。([#65](https://github.com/untra/polyglot/pull/65)
25+
26+
### `i18n_headers` 性能提升以及修复
27+
28+
现在,文档处理速度更快了。此外,修复了 `site.url` 被定义时的 `i18n_headers` 处理。([#67](https://github.com/untra/polyglot/pull/67)
29+
30+
### 自定义站点配置文件中的 `active_lang`
31+
32+
这将允许 `active_lang` 使用自定义的键,使 Polyglot 可以和其他的插件与主题更好地配合使用。([#68](https://github.com/untra/polyglot/pull/68)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
layout: post
3+
title: Polyglot 1.3.2
4+
lang: zh-CN
5+
---
6+
7+
Polyglot [1.3.2 版本](https://rubygems.org/gems/jekyll-polyglot/versions/1.3.1) 现已推出!去试试吧!
8+
9+
{% highlight yaml %}
10+
gem install jekyll-polyglot
11+
{% endhighlight %}
12+
13+
本次发布得益于以下 GitHub 用户的支持:
14+
15+
* [eighthave](https://github.com/eighthave)
16+
17+
### `lang_from_path` 设置 setting to derive document lang from relative path
18+
19+
This release adds a new boolean configuration setting `lang_from_path`. When set to true, this option tells polyglot to derive the base language from a matching subpath if the lang frontmatter is not set. This setting works well in conjunction with other translation maintenance tools such as [po4a](https://po4a.org/).
20+
21+
### 相对和绝对 url 的相对化逻辑优化
22+
23+
`excluded_from_localization` files will have trailing slashes added to their paths if they are directories. In addition, these files will be matched differently in the relativize and absolute url regex matchers. This will improve the accuracy of url relativization based on user feedback.

0 commit comments

Comments
 (0)