jekyll-language-plugin 1.1.0 → 1.1.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: b0a05d1d865dc59d54dada24d41de3c9d5d615de
|
4
|
+
data.tar.gz: 002e66f66fa993f0abbe721e71a31357562f5cb7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6410a6d6c6dce3fa4ec4e60bdf6492b4d8979a30930977144171c88734431da6a2fe1d10b85f6addd8ea3ea0005247fdda51dc0eea6c07886db044cfced54cc4
|
7
|
+
data.tar.gz: ae6919a539b02a056908dbb88bb7c28df9bd3f33457feb1ae4ca8993ffb88ead15b1c8c72adf9613a3ff852fba720638f600b9f44a51e37ef1047d35ea5aa4fb
|
@@ -2,7 +2,7 @@ module Jekyll
|
|
2
2
|
module Tags
|
3
3
|
class LanguageIncludeTag < IncludeTag
|
4
4
|
def tag_includes_dir(context)
|
5
|
-
context.registers[:site].config['language_includes_dir'].freeze
|
5
|
+
(context.registers[:site].config['language_includes_dir'].to_s || '_i18n').freeze
|
6
6
|
end
|
7
7
|
|
8
8
|
def page_language(context)
|
@@ -4,7 +4,7 @@ module JekyllLanguagePlugin
|
|
4
4
|
translation = JekyllLanguagePlugin::LiquidContext.get_language_data(context, 'date')
|
5
5
|
|
6
6
|
# validate language translation
|
7
|
-
|
7
|
+
raise JekyllLanguagePlugin::PluginError.new('Localized date is missing translation.') if translation.nil? ||
|
8
8
|
!['abbr_daynames', 'daynames', 'abbr_monthnames', 'monthnames'].all? {|s| translation.key?(s) && translation[s].is_a?(Array) } ||
|
9
9
|
translation['abbr_daynames'].size < 7 || translation['daynames'].size < 7 ||
|
10
10
|
translation['abbr_monthnames'].size < 12 || translation['monthnames'].size < 12
|
@@ -25,7 +25,7 @@ module JekyllLanguagePlugin
|
|
25
25
|
when 'b'; translation['abbr_monthnames'][self.mon-1]
|
26
26
|
when 'B'; translation['monthnames'][self.mon-1]
|
27
27
|
else
|
28
|
-
raise
|
28
|
+
raise JekyllLanguagePlugin::PluginError.new('Internal error.')
|
29
29
|
end
|
30
30
|
})
|
31
31
|
if defined? @@encoding_converter
|
@@ -2,16 +2,21 @@ module JekyllLanguagePlugin
|
|
2
2
|
module LiquidContext
|
3
3
|
def self.get_language_data(context, keys = nil)
|
4
4
|
site = context.registers[:site]
|
5
|
-
language_data = site.config['language_data']
|
5
|
+
language_data = site.config['language_data'].to_s || 'data.lang.%%'
|
6
|
+
|
6
7
|
page_language = context.registers[:page]['language']
|
7
|
-
return nil if
|
8
|
+
return nil if page_language.to_s.empty?
|
8
9
|
|
9
10
|
keys2 = language_data.gsub("%%", page_language).split('.')
|
10
11
|
language_data = site.send(keys2.shift)
|
11
12
|
language_data = self.traverse_hash(language_data, keys2)
|
13
|
+
raise JekyllLanguagePlugin::PluginError.new('Invalid language data configuration.') if language_data.nil?
|
12
14
|
|
13
15
|
return language_data if keys.to_s.empty? # can also return nil
|
14
|
-
|
16
|
+
|
17
|
+
language_data = self.traverse_hash(language_data, keys)
|
18
|
+
raise JekyllLanguagePlugin::PluginError.new("Language subset #{keys.to_s} not found.") if language_data.nil?
|
19
|
+
language_data
|
15
20
|
end
|
16
21
|
|
17
22
|
def self.get_language_string(context, key)
|
@@ -24,8 +29,8 @@ module JekyllLanguagePlugin
|
|
24
29
|
!(str = traverse_hash(data, key)).to_s.empty?
|
25
30
|
return str
|
26
31
|
end
|
27
|
-
|
28
|
-
""
|
32
|
+
|
33
|
+
raise JekyllLanguagePlugin::PluginError.new("Language string #{key} not found.")
|
29
34
|
end
|
30
35
|
|
31
36
|
def self.traverse_hash(hash, keys)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-language-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Wochnik
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- lib/jekyll/tags/language_include.rb
|
85
85
|
- lib/jekyll-language-plugin/date_localizer.rb
|
86
86
|
- lib/jekyll-language-plugin/liquid_context.rb
|
87
|
+
- lib/jekyll-language-plugin/plugin_exception.rb
|
87
88
|
- README.md
|
88
89
|
- LICENSE.md
|
89
90
|
homepage: https://github.com/vwochnik/jekyll-language-plugin
|