module Jekyll::TranslateKey
Public Instance Methods
t(key)
click to toggle source
Takes a translation key and returns a translated string according to the language of the current page. Or if none is found, returns the original key.
# File lib/jekyll-open-sdg-plugins/translate_key.rb, line 9 def t(key) # Determine the language of the current page. translations = @context.registers[:site].data['translations'] language = @context.environments.first["page"]['language'] return opensdg_translate_key(key, translations, language) end