Module: Jekyll::TranslateKey
- Defined in:
- lib/jekyll-open-sdg-plugins/translate_key.rb
Instance Method Summary collapse
-
#t(key) ⇒ Object
Takes a translation key and returns a translated string according to the language of the current page.
Instance Method Details
#t(key) ⇒ Object
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.
9 10 11 12 13 14 15 16 |
# 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 |