diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index d6b0977..4805c27 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -2,6 +2,7 @@ class ApplicationController < ActionController::Base
before_action :set_locale
def set_locale
- I18n.locale = params[:locale] || I18n.default_locale
+ I18n.locale = params[:locale] || session[:locale] || I18n.default_locale
+ session[:locale] = I18n.locale
end
end
diff --git a/app/controllers/leads_controller.rb b/app/controllers/leads_controller.rb
index d181dd5..37adcb8 100644
--- a/app/controllers/leads_controller.rb
+++ b/app/controllers/leads_controller.rb
@@ -4,9 +4,9 @@ def index; end
def create
@lead = Lead.create(name: params[:name], email: params[:email])
if @lead.save
- flash[:success] = 'Email cadastrado com sucesso!'
+ flash[:success] = t('leads.create.success')
else
- flash[:alert] = 'Email cadastrado anteriormente.'
+ flash[:alert] = t('leads.create.alert')
end
redirect_to :root
end
diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb
index e225b91..0b6373c 100644
--- a/app/views/home/index.html.erb
+++ b/app/views/home/index.html.erb
@@ -14,9 +14,11 @@
<%= t('cybersecurity_offer') %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 4a5d621..d83eaff 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -16,9 +16,12 @@ en:
technical_excellence: "With a razor-sharp focus on technical excellence, we're here to fortify your security posture. Our highly specialized team brings over 15 years of experience, handling complex projects across diverse business sectors."
subscribe_newsletter: "Subscribe to our newsletter for exclusive insights, expert tips, and the latest trends in cybersecurity. Stay ahead in the digital race with Redway by your side."
language: "Language"
-
lead:
name: 'Name'
email: 'Email'
submit: 'Submit'
- access_site: 'Access the website!'
\ No newline at end of file
+ access_site: 'Access the website!'
+ leads:
+ create:
+ success: 'Email successfully registered!'
+ alert: 'Email already registered.'
\ No newline at end of file
diff --git a/config/locales/pt.yml b/config/locales/pt.yml
index dc48ff4..749c5d6 100644
--- a/config/locales/pt.yml
+++ b/config/locales/pt.yml
@@ -16,10 +16,12 @@ pt:
technical_excellence: "Com um foco afiado na excelência técnica, estamos aqui para fortalecer sua postura de segurança. Nossa equipe altamente especializada traz mais de 15 anos de experiência, lidando com projetos complexos em diversos setores de negócios."
subscribe_newsletter: "Assine nossa newsletter para insights exclusivos, dicas de especialistas e as últimas tendências em segurança cibernética. Mantenha-se à frente na corrida digital com a Redway ao seu lado."
language: "Idioma"
-
lead:
name: 'Nome'
email: 'Email'
submit: 'Enviar'
access_site: 'Acesse o site!'
-
+ leads:
+ create:
+ success: 'Email cadastrado com sucesso!'
+ alert: 'Email cadastrado anteriormente.'
\ No newline at end of file