jekyll-language-plugin 1.1.1 → 1.1.2

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: b0a05d1d865dc59d54dada24d41de3c9d5d615de
4
- data.tar.gz: 002e66f66fa993f0abbe721e71a31357562f5cb7
3
+ metadata.gz: 2b6c261bef7ca88520afb58ec4a1760617681229
4
+ data.tar.gz: fd4978a18ea984aacdccafb8b43b6c8b20cb6323
5
5
  SHA512:
6
- metadata.gz: 6410a6d6c6dce3fa4ec4e60bdf6492b4d8979a30930977144171c88734431da6a2fe1d10b85f6addd8ea3ea0005247fdda51dc0eea6c07886db044cfced54cc4
7
- data.tar.gz: ae6919a539b02a056908dbb88bb7c28df9bd3f33457feb1ae4ca8993ffb88ead15b1c8c72adf9613a3ff852fba720638f600b9f44a51e37ef1047d35ea5aa4fb
6
+ metadata.gz: 1528ab446fa8b5446dfa068aa377f669d8933aa4fae6faab3f021fc9c502d1a9b53134398a6fa15e8490a150a3b8f2f1d101da30ad0c119427d20f4900e75986
7
+ data.tar.gz: 1782d0f93101c1a2dfceaf5783eaf859138f201153dceb0e8f486c2242e246b66106bc0b5bab28969b1c1bb90c7a2c585ecd6d981a337ab921a0d9b8ecba24ec
data/LICENSE.md CHANGED
@@ -1,7 +1,5 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014 GitHub, inc.
4
-
5
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
4
  of this software and associated documentation files (the "Software"), to deal
7
5
  in the Software without restriction, including without limitation the rights
data/README.md CHANGED
@@ -53,7 +53,7 @@ The first key, `language_data`, tells the plugin where it can find the translati
53
53
 
54
54
  ## Usage
55
55
 
56
- Every page or post, that needs to be translated must either have a `language` key or a `languages` array inside its YAML front-matter. Additionally, it may also have an `alias` key which tells the plugin to traverse one step further into the language data. So for example, if `alias` is `home` and the `language_data` configuration setting is `data.lang.%%` and the language is `en`, the plugin will look into `data.lang.en.home` for the translation keys used by the liquid tag. Of course, only pages and layouts can use the translation liquid tag but layouts used by posts can therefore benefit from an `alias`.
56
+ Every page or post, that needs to be translated must either have a `language` key or a `languages` array inside its YAML front-matter. Additionally, it may also have an `subset` key which tells the plugin to traverse one step further into the language data. So for example, if `subset` is `home` and the `language_data` configuration setting is `data.lang.%%` and the language is `en`, the plugin will look into `data.lang.en.home` for the translation keys used by the liquid tag. Of course, only pages and layouts can use the translation liquid tag but layouts used by posts can therefore benefit from an `subset`.
57
57
 
58
58
  ### Example
59
59
 
@@ -62,7 +62,7 @@ This is a page optimized for the language plugin, `home.html`:
62
62
  ```
63
63
  ---
64
64
  layout: default
65
- alias: home
65
+ subset: home
66
66
  languages:
67
67
  - en
68
68
  - de
@@ -107,7 +107,7 @@ Create a new file `_layouts/default.html` which will contain the default layout:
107
107
  </html>
108
108
  ```
109
109
 
110
- As a sidenote, if an `alias` is given and the translation liquid tag can not find a key within the alias of a given language, it will look without the `alias`, basically one level upwards.
110
+ As a side note, if a `subset` is given and the translation liquid tag can not find a key within the given subset of the specified language, it will perform another lookup without the given subset.
111
111
 
112
112
  So if `footnote` is common to all pages and posts, it can be placed within the root of each language file. For the English language, add the following to `_data/lang/en.yml`:
113
113
 
@@ -125,7 +125,7 @@ If you now run `jekyll build`, you will obtain two separate `home.html` files in
125
125
 
126
126
  ### Posts
127
127
 
128
- Similar to pages, posts can also have the `languages` or `language` keys in its YAML front-matter. The `alias` key is also supported. Unlike pages, posts cannot use the translation liquid tag but the layout used by the post can. The post is rendered for each language specified, just like pages are.
128
+ Similar to pages, posts can also have the `languages` or `language` keys as well as the `subset` key in its YAML front-matter. You can use all supported liquid tags and filters to translate posts but you can also create multiple posts, one for each language.
129
129
 
130
130
  ## Liquid tags
131
131
 
@@ -135,9 +135,9 @@ Currently, there are two liquid tags provided by this plugin.
135
135
 
136
136
  The `t` liquid tag provides a convenient way of accessing language-specific translations from the language data referred to in the configuration file.
137
137
 
138
- If an alias is given by the page's or post's front-matter, `t` will look into the language-specific alias first. Only if the key cannot be found there, it will perform another lookup without the alias. This can be useful for common translations like a copyright notice. The key can also be a dot-notation of multiple keys which are traversed upon lookup.
138
+ If a `subset` is given by the page's or post's front-matter, `t` will look into the given `subset` of the language specified. Only if the key cannot be found there, it will perform another lookup without traversing into the given subset. This can be useful for common translations like a copyright notice. The key can also be a dot-notation of cascaded keys which are traversed upon lookup.
139
139
 
140
- *Example*: `{% t homepage_welcome %}`
140
+ *Example*: `{% t homepage_welcome %}` or `{% t homepage.welcome %}`
141
141
 
142
142
  ### Language-Specific Include Tag
143
143
 
@@ -23,9 +23,9 @@ module JekyllLanguagePlugin
23
23
  data = self.get_language_data(context)
24
24
  return "" if data.nil?
25
25
 
26
- page_alias = context.registers[:page]['alias']
27
- if (!page_alias.to_s.empty? &&
28
- !(str = traverse_hash(traverse_hash(data, page_alias), key)).to_s.empty?) ||
26
+ language_subset = context.registers[:page]['subset']
27
+ if (!language_subset.to_s.empty? &&
28
+ !(str = traverse_hash(traverse_hash(data, language_subset), key)).to_s.empty?) ||
29
29
  !(str = traverse_hash(data, key)).to_s.empty?
30
30
  return str
31
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-language-plugin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Wochnik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-14 00:00:00.000000000 Z
11
+ date: 2015-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll