jekyll-multiple-languages-plugin 1.2.4 → 1.2.5
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 +4 -4
- data/README.md +2 -0
- data/lib/jekyll/multiple/languages/plugin.rb +11 -5
- data/lib/jekyll/multiple/languages/plugin/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c62b83447dfb672db4e214ae3e9d64bad83788e
|
4
|
+
data.tar.gz: d1db48cc7b9a2f8cd2a67c5bb5bd9b860f10a3cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2230b6922100d16fdd678e6b68e1a520c1256d85241bee74260941aff41b5c5b5e37603d3e6c396821bca39fe5ca4e93add4b00f5d0a60c8ae618442a22aec0
|
7
|
+
data.tar.gz: ebb45c393fdfeb2bb927dfbe554a5203b6b305527aee5c8feb2d1337238ec896a44ce3c067ec2714f93a48e95e0d4dd3f4d9ee31e949a726c591c6645ad341da
|
data/README.md
CHANGED
@@ -60,6 +60,8 @@ Copy or link the file `lib/jekyll/multiple/languages/plugin.rb` into your `_plug
|
|
60
60
|
* Supports translated template files
|
61
61
|
|
62
62
|
##Changelog
|
63
|
+
1.2.5
|
64
|
+
Fixed a bug when global variables wasn't as global as expected
|
63
65
|
1.2.4
|
64
66
|
Fixed a bug when changes in .yml files got lost during live reload.
|
65
67
|
1.2.3
|
@@ -1,6 +1,13 @@
|
|
1
1
|
require "jekyll/multiple/languages/plugin/version"
|
2
2
|
|
3
3
|
module Jekyll
|
4
|
+
@parsedlangs = {}
|
5
|
+
def self.langs
|
6
|
+
@parsedlangs
|
7
|
+
end
|
8
|
+
def self.setlangs(l)
|
9
|
+
@parsedlangs = l
|
10
|
+
end
|
4
11
|
class Site
|
5
12
|
alias :process_org :process
|
6
13
|
def process
|
@@ -31,7 +38,7 @@ module Jekyll
|
|
31
38
|
self.dest = dest_org
|
32
39
|
self.config['baseurl'] = baseurl_org
|
33
40
|
end
|
34
|
-
|
41
|
+
Jekyll.setlangs({})
|
35
42
|
puts 'Build complete'
|
36
43
|
end
|
37
44
|
|
@@ -50,7 +57,6 @@ module Jekyll
|
|
50
57
|
def initialize(tag_name, key, tokens)
|
51
58
|
super
|
52
59
|
@key = key.strip
|
53
|
-
@@langs ||= {}
|
54
60
|
end
|
55
61
|
|
56
62
|
def render(context)
|
@@ -60,11 +66,11 @@ module Jekyll
|
|
60
66
|
key = @key
|
61
67
|
end
|
62
68
|
lang = context.registers[:site].config['lang']
|
63
|
-
unless
|
69
|
+
unless Jekyll.langs.has_key?(lang)
|
64
70
|
puts "Loading translation from file #{context.registers[:site].source}/_i18n/#{lang}.yml"
|
65
|
-
|
71
|
+
Jekyll.langs[lang] = YAML.load_file("#{context.registers[:site].source}/_i18n/#{lang}.yml")
|
66
72
|
end
|
67
|
-
translation =
|
73
|
+
translation = Jekyll.langs[lang].access(key) if key.is_a?(String)
|
68
74
|
if translation.empty?
|
69
75
|
puts "Missing i18n key: #{lang}:#{key}"
|
70
76
|
"*#{lang}:#{key}*"
|