plugins: jekyll-multiple-language support ruby >3.2

- exists? -> exist?
- return blank translation string instead of nil
This commit is contained in:
plowsof 2024-07-10 16:36:30 +01:00
parent 7132e45a64
commit 6be9f0e054

View file

@ -48,7 +48,7 @@ module Jekyll
if (exclude_path == f_path)
new_path = parts[0] + "/" + f_path
puts "Moving '" + file_path + "' to '" + new_path + "'"
if (Dir.exists?(new_path))
if (Dir.exist?(new_path))
FileUtils.rm_r new_path
end
File.rename file_path, new_path
@ -611,9 +611,13 @@ def translate_key(key, lang, site)
if translation.nil? or translation.empty?
translation = site.parsed_translations[site.config['default_lang']].access(key)
puts "Missing i18n key: #{lang}:#{key}"
puts "Using translation '%s' from default language: %s" %[translation, site.config['default_lang']]
if translation.nil? or translation.empty?
translation = ""
if site.config["verbose"]
puts "Missing i18n key: #{lang}:#{key}"
puts "Using translation '%s' from default language: %s" %[translation, site.config['default_lang']]
end
end
end
translation
@ -684,4 +688,4 @@ Liquid::Template.register_tag('translate', Jekyll::LocalizeTag )
Liquid::Template.register_tag('tf', Jekyll::Tags::LocalizeInclude)
Liquid::Template.register_tag('translate_file', Jekyll::Tags::LocalizeInclude)
Liquid::Template.register_tag('tl', Jekyll::LocalizeLink )
Liquid::Template.register_tag('translate_link', Jekyll::LocalizeLink )
Liquid::Template.register_tag('translate_link', Jekyll::LocalizeLink )