Tweaked configuration settings

- Changed config.yml to correct settings for necessary multi-lingual site
- Removed unnecessary plugin (first attempt at multi-lingual) from _plugins
This commit is contained in:
rehrar 2017-11-27 13:28:15 -07:00
parent 3d4a4fa59a
commit 6fb17cb3b2
No known key found for this signature in database
GPG key ID: 9B252A4EF355CC8D
2 changed files with 13 additions and 71 deletions

View file

@ -14,10 +14,22 @@ kramdown:
input: GFM input: GFM
exclude: ["README.md"] exclude: ["README.md"]
gems: [jekyll-paginate]
# paginate
paginate: 10 paginate: 10
paginate_path: blog/page:num/ paginate_path: blog/page:num/
gems:
- jekyll-paginate
- jekyll-multiple-languages-plugin
# jekyll-multiple-languages-plugin settings:
languages: ["en", "es"]
exclude_from_localizations: ["img", "css", "fonts", "media", "404", "feed.xml", "404", "meta", "forum-funding-system", "_posts"]
# Windows live tiles config # Windows live tiles config
ie_tile_color: eeeeee ie_tile_color: eeeeee
ie_tile_small: https://static.getmonero.org/images/live-tiles/small.png ie_tile_small: https://static.getmonero.org/images/live-tiles/small.png

View file

@ -1,70 +0,0 @@
# Just a placeholder plugin to do translated strings, gives us room and scope to get the
# jekyll-multiple-languages-plugin to work correctly
module Jekyll
module Translated
module Strings
module Plugin
VERSION = "0.1"
end
end
end
end
module Jekyll
class LocalizeTag < Liquid::Tag
def initialize(tag_name, key, tokens)
super
@key = key.strip
end
def render(context)
if "#{context[@key]}" != "" #Check for page variable
key = "#{context[@key]}"
else
key = @key
end
site = context.registers[:site]
stringsfile = File.join(site.source, '_strings_en.yml')
strings_en = YAML.load_file(stringsfile)
translation = strings_en.access(key) if key.is_a?(String)
if translation.nil? || translation.empty?
Jekyll.logger.abort_with "Missing key: #{key}"
end
# If we have an @, pass the string through the markdown converter, so that we hit the Moneropedia plugin
if translation.include? '@'
converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
translation = converter.convert(translation)[3..-6]
end
translation
end
end
end
unless Hash.method_defined? :access
class Hash
def access(path)
ret = self
path.split('.').each do |p|
if p.to_i.to_s == p
ret = ret[p.to_i]
else
ret = ret[p.to_s] || ret[p.to_sym]
end
break unless ret
end
ret
end
end
end
Liquid::Template.register_tag('t', Jekyll::LocalizeTag)
Liquid::Template.register_tag('translate', Jekyll::LocalizeTag)