# encoding: UTF-8
module Georgia
  module InternationalizationHelper
    
    LOCALES_HASH = {en: "English", fr: "Français"}

    def locale_name(locale)
      return "" unless locale
      LOCALES_HASH[locale.to_sym]
    end

    def french?
      current_locale? :fr
    end

    def english?
      current_locale? :en
    end

    def link_to_locale options={}, html_options={}    
      options[:text] ||= english? ? "Français" : "English"
      options[:locale] ||= english? ? :fr : :en
      html_options[:hreflang] ||= english? ? :fr : :en
      
      link_to(options[:text], {locale: options[:locale]}, html_options)
    end
    
    private
    
    def current_locale?(locale)
      I18n.locale == locale
    end

  end
end
# encoding: UTF-8
module Georgia
  module InternationalizationHelper

    LOCALES_HASH = {en: "English", fr: "Français"}

    def locale_name(locale)
      return "" unless locale
      LOCALES_HASH[locale.to_sym]
    end

    def french?
      current_locale? :fr
    end

    def english?
      current_locale? :en
    end

    def link_to_locale options={}, html_options={}
      options[:text] ||= english? ? "Français" : "English"
      options[:text] = sanitize(options[:text]) if options[:sanitize]
      options[:locale] ||= english? ? :fr : :en
      html_options[:hreflang] ||= english? ? :fr : :en

      link_to(options[:text], {locale: options[:locale]}, html_options)
    end

    private

    def current_locale?(locale)
      I18n.locale == locale
    end

  end
end
Add option sanitize to link_to_locale
Add option sanitize to link_to_locale
