Skip to content

Commit f3c0c80

Browse files
authored
Merge pull request #200 from TreinaDev/fix/traducoes
Passa todos os textos para arquivos de tradução .yml
2 parents 19a931c + 34ecbd3 commit f3c0c80

File tree

77 files changed

+553
-371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+553
-371
lines changed

app/controllers/api/v1/invitations_controller.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ def create
99

1010
def update
1111
status = params.permit(:status)[:status]
12-
return render status: :bad_request, json: { error: 'Status inválido' } unless Invitation.statuses.key? status
12+
unless Invitation.statuses.key? status
13+
return render status: :bad_request,
14+
json: { error: I18n.t('invalid_status') }
15+
end
1316

1417
invitation = Invitation.find(params[:id])
1518
invitation.update!(status:)

app/controllers/api/v1/profiles_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def show
1515
profile = Profile.active.find(params[:id])
1616
render status: :ok, json: json_output(profile)
1717
rescue ActiveRecord::RecordNotFound
18-
render status: :not_found, json: { error: 'Perfil não existe.' }
18+
render status: :not_found, json: { error: I18n.t('profile_not_found') }
1919
end
2020

2121
private

app/controllers/reports_controller.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@ def redirect_unless_published_post
5858

5959
def set_offences
6060
@offences = [
61-
'Discurso de ódio',
62-
'Pornografia',
63-
'Racismo',
64-
'Spam',
65-
'Conteúdo pertubador',
66-
'Abuso/Perseguição'
61+
t('reports.hate_speech'),
62+
t('reports.pornography'),
63+
t('reports.racism'),
64+
t('reports.spam'),
65+
t('reports.disturbin_content'),
66+
t('reports.harassment')
6767
]
6868
end
6969

app/controllers/settings_controller.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ def index; end
77
def deactivate_profile
88
current_user.profile.inactive!
99
sign_out current_user
10-
redirect_to root_path, alert: t('deactivate_profile')
10+
redirect_to root_path, alert: t('.success')
1111
end
1212

1313
def delete_account
1414
current_user.delete_user_data
15-
redirect_to root_path, notice: t('delete_account')
15+
redirect_to root_path, notice: t('.success')
1616
end
1717

1818
def change_privacy

app/helpers/posts_helper.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
module PostsHelper
22
def date_fixer(post)
33
if post.draft?
4-
'Criado em: '
4+
t('posts.helpers.created_at')
55
elsif post.scheduled?
6-
'Agendado para: '
6+
t('posts.helpers.scheduled_for')
77
else
8-
'Publicado em: '
8+
t('posts.helpers.published_at')
99
end
1010
end
1111

app/mailers/invitations_mailer.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ def received_invitation
33
profile = Profile.find(params[:profile_id])
44
project_title = params[:project_title]
55
mail(subject: t('.subject'), to: profile.user.email,
6-
body: "Você recebeu um convite para participar do projeto #{project_title}.")
6+
body: t('.body', title: project_title))
77
end
88
end

app/mailers/likes_mailer.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def notify_like
88
@most_liked_post = @user.most_liked_post_since(1)
99
@most_liked_comment = @user.most_liked_comment_since(1)
1010

11-
mail(subject: "Você recebeu #{@post_likes.count + @comment_likes.count} curtidas nas últimas 24 horas!",
11+
mail(subject: t('.subject', likes: @post_likes.count + @comment_likes.count),
1212
to: @user.email)
1313
end
1414
end

app/models/connection.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Connection < ApplicationRecord
1515
def cant_follow_yourself
1616
return unless followed_profile == follower
1717

18-
errors.add(:followed_profile, 'não pode ser o mesmo do usuário')
18+
errors.add(:followed_profile, I18n.t('connections.same_user'))
1919
end
2020

2121
def create_notification

app/models/invitation.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def set_status
1919
def expiration_date_cannot_be_in_the_past
2020
return unless expiration_date.present? && expiration_date < Time.zone.today
2121

22-
errors.add(:expiration_date, 'deve ser maior que a data atual')
22+
errors.add(:expiration_date, I18n.t('invitations.date_error'))
2323
end
2424

2525
def truncate_description

app/models/post.rb

+7-7
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def correct_file_type
6161
content_types = content.body.to_s.scan(/content-type="(.*?)"/)
6262

6363
content_types.each do |type|
64-
errors.add(:content, 'Tipo de arquivo inválido.') unless options.include? type[0]
64+
errors.add(:content, I18n.t('posts.model.invalid_file')) unless options.include? type[0]
6565
end
6666
end
6767

@@ -73,11 +73,11 @@ def file_size
7373

7474
def test_file_size(attachments)
7575
attachments.each do |attachment|
76-
validate_attachment_size(attachment, 'image/png', 2_000_000, 'Tamanho de imagem permitido é 2mb')
77-
validate_attachment_size(attachment, 'image/jpeg', 2_000_000, 'Tamanho de imagem permitido é 2mb')
78-
validate_attachment_size(attachment, 'video/mp4', 15_000_000, 'Tamanho do vídeo permitido é 15mb')
79-
validate_attachment_size(attachment, 'audio/mpeg', 3_000_000, 'Tamanho do áudio permitido é 3mb')
80-
validate_attachment_size(attachment, 'application/pdf', 900_000, 'Tamanho do PDF permitido é 900kb')
76+
validate_attachment_size(attachment, 'image/png', 2_000_000, I18n.t('posts.model.max_image_size'))
77+
validate_attachment_size(attachment, 'image/jpeg', 2_000_000, I18n.t('posts.model.max_image_size'))
78+
validate_attachment_size(attachment, 'video/mp4', 15_000_000, I18n.t('posts.model.max_video_size'))
79+
validate_attachment_size(attachment, 'audio/mpeg', 3_000_000, I18n.t('posts.model.max_audio_size'))
80+
validate_attachment_size(attachment, 'application/pdf', 900_000, I18n.t('posts.model.max_pdf_size'))
8181
end
8282
end
8383

@@ -91,6 +91,6 @@ def validate_published_at
9191
return if published_at.nil?
9292
return unless scheduled?
9393

94-
errors.add(:published_at, 'não pode estar no passado') if published_at < Time.zone.now
94+
errors.add(:published_at, I18n.t('posts.model.invalid_date')) if published_at < Time.zone.now
9595
end
9696
end

app/models/profile.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ def active!
114114
def valid_photo_content_type
115115
return if photo.present? && photo.content_type.in?(%w[image/jpg image/jpeg image/png])
116116

117-
errors.add(:photo, message: 'deve ser do formato .jpg, .jpeg ou .png') if photo.present?
117+
errors.add(:photo, message: I18n.t('profiles.model.photo_extention')) if photo.present?
118118
end
119119

120120
def photo_size_lower_than_3mb
121121
return if photo.present? && photo.byte_size <= 3.megabytes
122122

123-
errors.add(:photo, message: 'deve ter no máximo 3MB') if photo.present?
123+
errors.add(:photo, message: I18n.t('profiles.model.photo_size')) if photo.present?
124124
end
125125
end
126126

app/models/user.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def subscribe_likes_mailer_job
8383
end
8484

8585
def validate_citizen_id_number
86-
errors.add(:citizen_id_number, 'inválido') unless CPF.valid?(citizen_id_number)
86+
errors.add(:citizen_id_number, I18n.t('users.model.invalid_cpf')) unless CPF.valid?(citizen_id_number)
8787
end
8888

8989
def transfer_posts_and_comments_to(clone)

app/views/connections/following.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="container text-center">
22
<div class="d-flex flex-column">
33
<h1 class="text-primary"><%= @profile.full_name %></span></h1>
4-
<h3>Seguindo <%= @followed_profiles.count %> <%= User.model_name.human(count: @followed_profiles.count).downcase %></h3>
4+
<h3><%= t('.following') %> <%= @followed_profiles.count %> <%= User.model_name.human(count: @followed_profiles.count).downcase %></h3>
55
</div>
66
<div class="row row-cols-1 row-cols-md-3 g-4 justify-content-center gap-3 mt-4">
77
<% @followed_profiles.each do |followed| %>

app/views/connections/index.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="container text-center">
22
<div class="d-flex flex-column">
33
<h1 class="text-primary"><%= @profile.full_name %></span></h1>
4-
<h2>Seguido por <%= @follower_profiles.count %> <%= User.model_name.human(count: @follower_profiles.count).downcase %></h2>
4+
<h2><%= t('.followed_by') %> <%= @follower_profiles.count %> <%= User.model_name.human(count: @follower_profiles.count).downcase %></h2>
55
</div>
66
<div class="row row-cols-1 row-cols-md-3 g-4 justify-content-center gap-3 mt-4">
77
<% @follower_profiles.each do |connection| %>

app/views/education_infos/_error_message.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% if @education_info.errors.any? %>
2-
<p>Verifique o(s) erro(s) abaixo:</p>
2+
<p><%= t('check_errors')%></p>
33
<ul class="alert alert-warning" role="alert">
44
<% @education_info.errors.full_messages.each do |msg| %>
55
<li><%= msg %> </li>

app/views/education_infos/_form.html.erb

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
<%= education_info.label :visibility, class:"form-check-label" %>
2020
</p>
2121
<p class='mt-3'>
22-
<%= education_info.submit 'Salvar', class:'btn btn-primary' %>
23-
<%= link_to 'Voltar', profile_path(current_user.profile), class: 'btn btn-secondary' %>
22+
<%= education_info.submit t('save_btn'), class:'btn btn-primary' %>
23+
<%= link_to t('return_btn'), profile_path(current_user.profile), class: 'btn btn-secondary' %>
2424
</p>

app/views/home/index.html.erb

+11-11
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,36 @@
22
<% if user_signed_in? %>
33
<div class="row">
44
<section class="col-md-9 y-5">
5-
<h2>Feed</h2>
5+
<h2><%= t('.feed') %></h2>
66
<% if current_user.profile.followed_count > 0 %>
77
<% if @followed_posts.any? %>
88
<div>
99
<%= render partial: 'posts/listing', locals: { posts: @followed_posts.each } %>
1010
</div>
1111
<% else %>
1212
<div>
13-
<h4>Não existem posts de perfis que você segue. Veja o que outras pessoas estão publicando:</h4>
13+
<h4> <%= t('.what_people_are_posting') %>: </h4>
1414
<%= render partial: 'posts/listing', locals: { posts: @posts } %>
1515
</div>
1616
<% end %>
1717
<% else %>
1818
<div>
19-
<h4>Você ainda não segue ninguém. Siga alguém para personalizar seu feed</h4>
19+
<h4> <%= t('.follow_someone') %> </h4>
2020
<%= render partial: 'posts/listing', locals: { posts: @posts } %>
2121
</div>
2222
<% end %>
2323
</section>
2424

2525
<aside class="col-md-3">
26-
<h2>Usuários mais seguidos</h2>
26+
<h2> <%= t('.most_followed') %> </h2>
2727

2828
<div class="py-2" style="width: 18rem;">
2929
<% @most_followed.each do |profile| %>
3030
<div class="card mb-3 bg-light-subtle text-center">
3131
<div class="card-body">
3232
<h5 class="card-title"><%= profile.full_name %></h5>
3333
<p class="card-text"><%= profile.followers_count %> <%= t('followers', count: profile.followers_count) %></p>
34-
<a href="<%= profile_path(profile) %>" class="btn btn-primary">Ver perfil</a>
34+
<a href="<%= profile_path(profile) %>" class="btn btn-primary"> <%= t('.view_profile_btn') %> </a>
3535
</div>
3636
</div>
3737
<% end %>
@@ -44,17 +44,17 @@
4444
<div class="row g-0 d-flex align-items-center border-bottom justify-content-center">
4545
<%= image_tag 'logop.svg', class: 'home_logo col-sm-8 col-md-2'%>
4646
<h3 class="col-6 col-md-4">
47-
Descubra, Conecte, Brilhe <br>
48-
<span>Seu Portfólio, Seu Espaço</span><br>
49-
<span class="text-primary fw-bold py-3">Faça parte da nossa comunidade!</span> <br>
50-
<%= link_to 'Crie já a sua conta', new_user_registration_path, class: 'btn btn-primary col-10 py-2 my-4 fs-4' %>
47+
<%= t('.find_connect_shine') %> <br>
48+
<span> <%= t('.your_profile_your_space') %> </span><br>
49+
<span class="text-primary fw-bold py-3"><%= t('.become_part_of_comunity') %></span> <br>
50+
<%= link_to t('.create_account'), new_user_registration_path, class: 'btn btn-primary col-10 py-2 my-4 fs-4' %>
5151
</h3>
5252
</div>
5353
</div>
5454

55-
<h2>Feed</h2>
55+
<h2><%= t('.feed') %></h2>
5656
<div>
57-
<h4>Faça <%= link_to 'login', new_user_session_path %> ou <%= link_to 'crie uma conta', new_user_registration_path %> para descobrir conteúdos relevantes para você.</h4>
57+
<h4><%= t('.find_out_more.do') %> <%= link_to t('.login'), new_user_session_path %> <%= t('.find_out_more.or') %> <%= link_to t('.create_account'), new_user_registration_path %> <%= t('.find_out_more.find_out') %></h4>
5858
</div>
5959
</section>
6060
<% end %>

app/views/invitations/index.html.erb

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<div class="container">
22
<div class="row">
33
<section>
4-
<h2 class="text-center">Convites</h2>
4+
<h2 class="text-center"><%= Invitation.model_name.human(count: 2) %></h2>
55

66
<div class="nav-scroller border-bottom mb-4">
77
<nav class="d-flex nav nav-underline">
8-
<%= link_to 'Todos', invitations_path, class: "nav-item col nav-link link-body-emphasis" %>
9-
<%= link_to 'Pendentes', invitations_path(status: :pending), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'pending'}" %>
10-
<%= link_to 'Aceitos', invitations_path(status: :accepted), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'accepted'}" %>
11-
<%= link_to 'Recusados', invitations_path(status: :declined), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'declined'}" %>
12-
<%= link_to 'Expirados', invitations_path(status: :expired), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'expired'}" %>
8+
<%= link_to t('all'), invitations_path, class: "nav-item col nav-link link-body-emphasis" %>
9+
<%= link_to t('.pending'), invitations_path(status: :pending), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'pending'}" %>
10+
<%= link_to t('.accepted'), invitations_path(status: :accepted), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'accepted'}" %>
11+
<%= link_to t('.declined'), invitations_path(status: :declined), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'declined'}" %>
12+
<%= link_to t('.expired'), invitations_path(status: :expired), class: "nav-item nav-link col link-body-emphasis #{'active' if params[:status] == 'expired'}" %>
1313
</nav>
1414
</div>
1515

1616
<div class="d-flex flex-wrap justify-content-around">
1717
<% if @invitations.empty? %>
18-
<p class="text-center">Nenhum convite encontrado</p>
18+
<p class="text-center"> <%= t('.empty_state') %> </p>
1919
<% else %>
2020
<% @invitations.each do |invitation| %>
2121
<div class="col-md-5 p-4 m-4 rounded border w-25">
@@ -25,14 +25,14 @@
2525
<p><%= invitation.truncate_description %></p>
2626

2727
<% if invitation.pending? && invitation.expiration_date %>
28-
<p class="card-subtitle mb-2 text-muted">Expira dia: <%= I18n.l(invitation.expiration_date) %></p>
28+
<p class="card-subtitle mb-2 text-muted"><%= Invitation.human_attribute_name :expiration_date %>: <%= I18n.l(invitation.expiration_date) %></p>
2929
<% end %>
3030

31-
<p class="card-subtitle mb-2 text-success"><%= 'Aceito' if invitation.accepted? %></p>
32-
<p class="card-subtitle mb-2 text-danger"><%= 'Expirado' if invitation.expired? %></p>
33-
<p class="card-subtitle mb-2 text-danger"><%= 'Recusado' if invitation.declined? %></p>
34-
<p class="card-subtitle mb-2 text-dark"><%= 'Cancelado' if invitation.cancelled? %></p>
35-
<p class="card-subtitle mb-2 text-info"> <%= 'Processando' if invitation.processing? %></p>
31+
<p class="card-subtitle mb-2 text-success"><%= t('invitations.accepted_status') if invitation.accepted? %></p>
32+
<p class="card-subtitle mb-2 text-danger"><%= t('invitations.expired_status') if invitation.expired? %></p>
33+
<p class="card-subtitle mb-2 text-danger"><%= t('invitations.declined_status') if invitation.declined? %></p>
34+
<p class="card-subtitle mb-2 text-dark"><%= t('invitations.cancelled_status') if invitation.cancelled? %></p>
35+
<p class="card-subtitle mb-2 text-info"> <%= t('invitations.processing_status') if invitation.processing? %></p>
3636
</div>
3737
<% end %>
3838
</div>

app/views/invitations/show.html.erb

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,34 @@
1-
<h2 class="text-center">Convite</h2>
1+
<h2 class="text-center"><%= Invitation.model_name.human %></h2>
22

33
<div class="col-md-6 offset-md-3">
44
<div class="card shadow rounded">
55
<div class="card-body">
66
<h4 class="text-break text-primary"><%= @invitation.project_title %></h4>
77

88
<p class="card-text"><%= @invitation.project_description %></p>
9-
<p class="card-subtitle mb-2 text-muted">Categoria: <%= @invitation.project_category %></p>
9+
<p class="card-subtitle mb-2 text-muted"><%= Invitation.human_attribute_name :category %>: <%= @invitation.project_category %></p>
1010
<% if @invitation.message.present? %>
11-
<p class="card-subtitle mb-2 text-muted">Mensagem: <%= @invitation.message %></p>
11+
<p class="card-subtitle mb-2 text-muted"><%= Invitation.human_attribute_name :message %>: <%= @invitation.message %></p>
1212
<% end %>
1313
<% if @invitation.expiration_date.present? %>
14-
<p class="card-subtitle mb-2 text-muted">Expira dia: <%= I18n.l(@invitation.expiration_date) %></p>
14+
<p class="card-subtitle mb-2 text-muted"><%= Invitation.human_attribute_name :expiration_date %>: <%= I18n.l(@invitation.expiration_date) %></p>
1515
<% end %>
16-
1716
<% if @invitation.pending? %>
1817
<div class="btn-group">
1918
<div>
20-
<%= link_to 'Aceitar', 'http://localhost:3000', class: 'btn btn-primary me-4' %>
19+
<%= link_to t('accept_btn'), 'http://localhost:3000', class: 'btn btn-primary me-4' %>
2120
</div>
2221
<div>
23-
<%= button_to 'Recusar', decline_invitation_path(@invitation), method: :patch, class: 'btn btn-secondary' %>
22+
<%= button_to t('decline_btn'), decline_invitation_path(@invitation), method: :patch, class: 'btn btn-secondary' %>
2423
</div>
2524
</div>
2625
<% end %>
2726

28-
<p class="card-subtitle mb-2 text-success"><%= 'Aceito' if @invitation.accepted? %></p>
29-
<p class="card-subtitle mb-2 text-danger"><%= 'Expirado' if @invitation.expired? %></p>
30-
<p class="card-subtitle mb-2 text-danger"><%= 'Recusado' if @invitation.declined? %></p>
31-
<p class="card-subtitle mb-2 text-dark"><%= 'Cancelado' if @invitation.cancelled? %></p>
32-
<p class="card-subtitle mb-2 text-info"> <%= 'Processando' if @invitation.processing? %></p>
27+
<p class="card-subtitle mb-2 text-success"><%= t('invitations.accepted_status') if @invitation.accepted? %></p>
28+
<p class="card-subtitle mb-2 text-danger"><%= t('invitations.expired_status') if @invitation.expired? %></p>
29+
<p class="card-subtitle mb-2 text-danger"><%= t('invitations.declined_status') if @invitation.declined? %></p>
30+
<p class="card-subtitle mb-2 text-dark"><%= t('invitations.cancelled_status') if @invitation.cancelled? %></p>
31+
<p class="card-subtitle mb-2 text-info"> <%= t('invitations.processing_status') if @invitation.processing? %></p>
3332
</div>
3433
</div>
3534
</div>

app/views/job_categories/index.html.erb

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div>
2-
<h2 class="text-center">Cadastro de categorias de trabalho</h2>
2+
<h2 class="text-center"> <%= t('.register') %> </h2>
33
<% if @job_category.errors.any? %>
44
<div>
55
<% @job_category.errors.each do |error| %>
@@ -11,17 +11,17 @@
1111
<div class="col-md-4 mx-auto">
1212
<%= f.label :name, 'Nome da categoria', class: "form-label" %>
1313
<%= f.text_field :name, class: "form-control", placeholder: "Ex: Web Design, Modelagem 3D" %>
14-
<%= f.submit 'Criar', class: "px-3 py-1 mt-3 btn btn-primary" %>
14+
<%= f.submit t('create_btn'), class: "px-3 py-1 mt-3 btn btn-primary" %>
1515
</div>
1616
</div>
1717
<% end %>
1818
<div class="d-flex flex-column mt-5 align-items-center">
19-
<h2>Categorias de trabalho cadastradas</h2>
19+
<h2> <%= t('.registered') %> </h2>
2020
<div class="d-flex flex-column mt-3 gap-3 categories">
2121
<% @job_categories.each do |category| %>
2222
<div class="d-flex justify-content-between">
2323
<p><%= category.name %></p>
24-
<%= button_to 'Remover', job_category_path(category), method: :delete, class:"btn btn-danger" %>
24+
<%= button_to t('remove_btn'), job_category_path(category), method: :delete, class:"btn btn-danger" %>
2525
</div>
2626
<% end %>
2727
</div>

0 commit comments

Comments
 (0)