def extract_locale_from_subdomain 
        parsed_locale = request.subdomains.first
        if !parsed_locale.blank?
          I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale.to_sym : nil 
        else
          nil
        end
      end
def extract_locale_from_subdomain 
        parsed_locale = request.subdomains.first
        if !parsed_locale.blank?
          I18n.available_locales.include?(parsed_locale.to_sym) ? parsed_locale.to_sym : nil 
        else
          nil
        end
      end
Get locale code from request subdomain (like http://it.application.local:3000)
 You have to put something like:
 127.0.0.1 gr.application.local
 in your /etc/hosts file to try this out locally