From bbb63d369818069583ad30f5ab3bf51b87286e47 Mon Sep 17 00:00:00 2001 From: djoate <56777051+djoate@users.noreply.github.com> Date: Sat, 23 Nov 2019 20:12:39 -0500 Subject: [PATCH] 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. --- _plugins/translate-tag.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/_plugins/translate-tag.rb b/_plugins/translate-tag.rb index 3464e46e..faf3c8e2 100644 --- a/_plugins/translate-tag.rb +++ b/_plugins/translate-tag.rb @@ -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