octopress-multilingual 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: adbfc715861572322e769a378f91f056c0978b21
4
- data.tar.gz: 9f3d3350c30e02fc88dbf662ae7681bcd7ee3df0
3
+ metadata.gz: 1cdb85708c9c83a005a9264293caa1191f194d9d
4
+ data.tar.gz: a43cbabca0b124c02d65b4e821ee8e28b50a6138
5
5
  SHA512:
6
- metadata.gz: 5787dc6d327e186c098e6f1751ca45abd9f87c09d697a92e32abfec19b2a93c612d7b865e7c3a791510bf7c165e88dcf5aed0e95fbcc8696367acfb20a81a406
7
- data.tar.gz: 74d5b41f3d5197f47d7efc9318d009fdb36d09ddafc7c57a705992582134f63fa01f8d7ad8edbce78354006819aef6701be8dc5bde22e47d42a181d9f1f9e378
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-01)
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
- Now you can use the `translations` or `translation_list` tags to list links to translated posts or pages. For example:
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 post %}
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 language_names(name=nil)
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
@@ -3,7 +3,7 @@ module Octopress
3
3
  module Filters
4
4
  def language_name(input)
5
5
  if input
6
- Octopress::Multilingual.language_names(input.strip.downcase) || input
6
+ Octopress::Multilingual.language_name(input.strip.downcase) || input
7
7
  end
8
8
  end
9
9
  end
@@ -25,7 +25,7 @@ module Octopress
25
25
  end
26
26
 
27
27
  def anchor(item)
28
- language = Octopress::Multilingual.language_names(item.lang)
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
 
@@ -1,5 +1,5 @@
1
1
  module Octopress
2
2
  module Multilingual
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
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.0
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-02 00:00:00.000000000 Z
11
+ date: 2015-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octopress-hooks