Class: JekyllGoogleTranslate::GoogleTranslateJavascript

Inherits:
JekyllSupport::JekyllTag
  • Object
show all
Defined in:
lib/google_translate_javascript.rb

Constant Summary collapse

PLUGIN_NAME =
'google_translate_javascript'.freeze
VERSION =
JekyllGoogleTranslate::VERSION

Instance Method Summary collapse

Instance Method Details

#render_implvoid

This method returns an undefined value.

The following variables are predefined:

@argument_string, @config, @envs, @helper, @layout, @logger, @mode, @page, @paginator, @site, @tag_name and @theme

Parameters:

  • tag_name (String)

    is the name of the tag, which we already know.

  • argument_string (String)

    the arguments from the web page.

  • tokens (Liquid::ParseContext)

    tokenized command line



24
25
26
27
28
29
30
31
32
33
# File 'lib/google_translate_javascript.rb', line 24

def render_impl
  <<~END_OUTPUT
    <script type="text/javascript">
      function googleTranslateElementInit() {
        new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
      }
    </script>
    <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
  END_OUTPUT
end