Skip to content

Commit

Permalink
feat: ✨ Add translation for form, that ai forgot rsrs
Browse files Browse the repository at this point in the history
  • Loading branch information
JordanBiego committed Feb 22, 2024
1 parent f02b6a4 commit 306e436
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
3 changes: 2 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions app/controllers/leads_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
<div class="h5 pb-3 mb-4 text-dark border-bottom border-dark">
<h4><strong><%= t('cybersecurity_offer') %></strong></h4>
<ul>
<% t('services').each do |service| %>
<li><%= service %></li>
<% end %>
<div class="container align-items-center col-6">
<% t('services').each do |service| %>
<li><%= service %></li>
<% end %>
</div>
</ul>
</div>
<div class="h5 pb-3 mb-4 text-dark border-bottom border-dark">
Expand Down
7 changes: 5 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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!'
access_site: 'Access the website!'
leads:
create:
success: 'Email successfully registered!'
alert: 'Email already registered.'
6 changes: 4 additions & 2 deletions config/locales/pt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.'

0 comments on commit 306e436

Please sign in to comment.