octopress-multilingual 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1cdb85708c9c83a005a9264293caa1191f194d9d
|
4
|
+
data.tar.gz: a43cbabca0b124c02d65b4e821ee8e28b50a6138
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca0756bc4340d208e966a4bc2f2826d1a28bcae42d57d589d0699d6f4b9a33a17533eef2ef12b3ac504918913a95a1ecbfd48ca9f9a0c1bb24245a62594c2b9c
|
7
|
+
data.tar.gz: e70ab74c2c0ba7529c57288fade6d27eaa2655873ab4315d4e16229591c96c8c6322062df7c3794eb6ea42b451c570496d76b2bce5db95528edad356eab906e6
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
### 0.2.0 (2015-02-
|
3
|
+
### 0.2.0 (2015-02-02)
|
4
|
+
- Added a `language_name` method for retrieving a match from the language_names hash.
|
5
|
+
|
6
|
+
### 0.2.0 (2015-02-02)
|
4
7
|
- Link between posts or pages with a matching `translation_id`.
|
5
8
|
- Add translation IDs to posts or pages with `octopress translate <path>`.
|
6
9
|
- Check if a post or page has been translated with `[post or page].tranlsated`.
|
data/README.md
CHANGED
@@ -115,8 +115,7 @@ have its posts filtered to display only matching languages. If your site uses [o
|
|
115
115
|
|
116
116
|
## Link between translated posts or pages
|
117
117
|
|
118
|
-
URLs can change and manually linking to translated posts or pages isn't the best idea. This plugin helps you link posts together using
|
119
|
-
a shared translation ID. With [octopress](https://github.com/octopress/octopress), you'll be able to automatically add translation IDs to pages and posts. Then you can reference the array of translations with `post.tranlsations` or `page.translations`. Here's the syntax:
|
118
|
+
URLs can change and manually linking to translated posts or pages isn't the best idea. This plugin helps you link posts together using a shared translation ID. With [octopress](https://github.com/octopress/octopress), you'll be able to automatically add translation IDs to pages and posts. Then you can reference the array of translations with `post.tranlsations` or `page.translations`. Here's the syntax:
|
120
119
|
|
121
120
|
```
|
122
121
|
$ octopress translate path [path path...]
|
@@ -129,11 +128,13 @@ example:
|
|
129
128
|
$ octopress translate _posts/2015-02-02-english-post.md _posts/2015-02-02-deutsch-post.md _posts/2015-02-02-espanol-post.md
|
130
129
|
```
|
131
130
|
|
132
|
-
This will add `translation_id: fcdbc7e82b45346d67cced3523a2f236` to the YAML front-matter of each of these posts.
|
133
|
-
|
131
|
+
This will add `translation_id: fcdbc7e82b45346d67cced3523a2f236` to the YAML front-matter of each of these posts. There's nothing special about this key except that it is unique. If you want to write your own you can, it'll work just fine.
|
132
|
+
|
133
|
+
When you have posts or pages with a `translation_id` you can use the `translations` or `translation_list` tags to list links to translated posts or pages. For example:
|
134
134
|
|
135
135
|
```
|
136
|
-
{% translations
|
136
|
+
{% translations page %} # On a page/post layout
|
137
|
+
{% translations post %} # In a post loop
|
137
138
|
|
138
139
|
# Which outputs:
|
139
140
|
<a class='translation-link lang-de' href='/de/2015/02/02/deutsch-post'>Deutsch</a>, <a class='translation-link lang-es' href='/es/2015/02/02/espanol-post'>Español</a>
|
@@ -28,21 +28,22 @@ module Octopress
|
|
28
28
|
@site ||= Octopress.site
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
31
|
+
def language_name(name=nil)
|
32
|
+
if language = language_names[name]
|
33
|
+
language
|
34
|
+
else
|
35
|
+
name
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def language_names
|
32
40
|
@language_names ||= begin
|
33
41
|
config = SafeYAML.load_file(File.expand_path('../../language_key.yml', __FILE__))
|
34
42
|
if lang_config = site.config['language_names']
|
35
43
|
config.merge!(lang_config)
|
36
44
|
end
|
37
|
-
|
38
45
|
config
|
39
46
|
end
|
40
|
-
|
41
|
-
if name
|
42
|
-
@language_names[name]
|
43
|
-
else
|
44
|
-
@language_names
|
45
|
-
end
|
46
47
|
end
|
47
48
|
|
48
49
|
def translated_posts
|
@@ -25,7 +25,7 @@ module Octopress
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def anchor(item)
|
28
|
-
language = Octopress::Multilingual.
|
28
|
+
language = Octopress::Multilingual.language_name(item.lang)
|
29
29
|
"<a class='translation-link lang-#{item.lang}' href='#{ item.url }'>#{ language }</a>"
|
30
30
|
end
|
31
31
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-multilingual
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octopress-hooks
|