Class: Locomotive::Steam::Liquid::Tags::LocaleSwitcher

Inherits:
Solid::Tag
  • Object
show all
Includes:
Concerns::I18nPage
Defined in:
lib/locomotive/steam/liquid/tags/locale_switcher.rb

Overview

Display the links to change the locale of the current page

Usage:

locale_switcher % => <div id=“locale-switcher”><a href=“/features” class=“current en”>Features</a><a href=“/fr/fonctionnalites” class=“fr”>Fonctionnalités</a></div>

{% locale_switcher label: locale, sep: ‘ - ’ }

options:

- label: iso (de, fr, en, ...etc), locale (Deutsch, Français, English, ...etc), title (page title)
- sep: piece of html code separating 2 locales

notes:

- "iso" is the default choice for label
- " | " is the default separating code

Instance Method Summary collapse

Methods included from Concerns::I18nPage

#change_page_locale

Instance Method Details

#display(*values) ⇒ Object



29
30
31
32
# File 'lib/locomotive/steam/liquid/tags/locale_switcher.rb', line 29

def display(*values)
  @options = { label: 'iso', sep: ' | ' }.merge(values.first || {})
  %{<div id="locale-switcher">#{build_site_locales}</div>}
end