Parse translated and nontranslated strings

This updates translate-tag.rb to parse all strings. This means that
we can add items such as {{ site.name }} into the source strings
and the plugin will do the rest. We no longer need hacky a
hacky workaround.
This commit is contained in:
djoate
2019-11-23 20:12:39 -05:00
parent 2688f16fbb
commit bbb63d3698

View File

@ -33,11 +33,12 @@ module Jekyll
if page_language.nil?
Weblate::SourceFile.add_entry(weblate_id, text)
text
Liquid::Template.parse(text).render(context)
else
translated_string = site.data["languages"][page_language][weblate_id]
translated_string.nil? ? text : translated_string.strip
translated_string.nil? ? Liquid::Template.parse(text).render(context)
: Liquid::Template.parse(translated_string.strip).render(context)
end
end
end