From 6fb17cb3b2ef856af1c52c60acd32f579a3a77ec Mon Sep 17 00:00:00 2001 From: rehrar Date: Mon, 27 Nov 2017 13:28:15 -0700 Subject: [PATCH] Tweaked configuration settings - Changed config.yml to correct settings for necessary multi-lingual site - Removed unnecessary plugin (first attempt at multi-lingual) from _plugins --- _config.yml | 14 +++++++++- _plugins/plugin.rb | 70 ---------------------------------------------- 2 files changed, 13 insertions(+), 71 deletions(-) delete mode 100644 _plugins/plugin.rb diff --git a/_config.yml b/_config.yml index b0cb1ceb..715adfab 100644 --- a/_config.yml +++ b/_config.yml @@ -14,10 +14,22 @@ kramdown: input: GFM exclude: ["README.md"] -gems: [jekyll-paginate] + +# paginate paginate: 10 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 ie_tile_color: eeeeee ie_tile_small: https://static.getmonero.org/images/live-tiles/small.png diff --git a/_plugins/plugin.rb b/_plugins/plugin.rb deleted file mode 100644 index 90191af5..00000000 --- a/_plugins/plugin.rb +++ /dev/null @@ -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)