Skip to content

Commit

Permalink
i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloschiavon committed May 23, 2014
1 parent fa02f39 commit d238332
Show file tree
Hide file tree
Showing 13 changed files with 284 additions and 34 deletions.
5 changes: 5 additions & 0 deletions app/assets/stylesheets/translation_missing.css.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<% if Rails.env.development? %>
.translation_missing {
border: 3px dashed red;
}
<% end %>
4 changes: 2 additions & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
<h1><%= link_to "colcho.net", root_path %> </h1>
<nav>
<ul>
<li><%= link_to "Quartos", rooms_path %> </li>
<li><%= link_to "Cadastro", new_user_path %> </li>
<li><%= link_to t('layout.rooms'), rooms_path %> </li>
<li><%= link_to t('layout.signup'), new_user_path %> </li>
</ul>
</nav>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/rooms/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= form_for(@room) do |f| %>
<% if @room.errors.any? %>
<div id="error_explanation">
<h2>Há erros no formulário, por favor verifique.</h2>
<h2><%= t 'general.form_error' %></h2>
</div>
<% end %>

Expand Down
5 changes: 2 additions & 3 deletions app/views/rooms/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<h1>Editing room</h1>
<h1><%= t '.title' %></h1>

<%= render 'form' %>
<%= link_to 'Show', @room %> |
<%= link_to 'Back', rooms_path %>
<%= link_to t('links.back'), @room %>
4 changes: 2 additions & 2 deletions app/views/rooms/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1>New room</h1>
<h1><%= t '.title' %></h1>

<%= render 'form' %>
<%= link_to 'Back', rooms_path %>
<%= link_to t('links.back'), root_path %>
21 changes: 6 additions & 15 deletions app/views/rooms/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
<p>
<strong>Title:</strong>
<%= @room.title %>
</p>
<h1><%= t '.title', room_title: @room.title %> </h1>

<p>
<strong>Location:</strong>
<%= @room.location %>
</p>
<ul>
<li><%= t '.location', location: @room.location %> </li>
<li><%= t '.description', description: @room.description %> </li>
</ul>

<p>
<strong>Description:</strong>
<%= @room.description %>
</p>

<%= link_to 'Edit', edit_room_path(@room) %> |
<%= link_to 'Back', rooms_path %>
<%= link_to t('.edit'), edit_room_path(@room) %>
2 changes: 1 addition & 1 deletion app/views/users/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%= form_for @user do |f| %>
<% if @user.errors.any? %>
<div id="error_explanation">
<h2>Há erros no formulário, por favor verifique.</h2>
<h2><%= t 'general.form_error' %></h2>
</div>
<% end %>

Expand Down
4 changes: 2 additions & 2 deletions app/views/users/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1>Editar perfil</h1>
<h1><%= t '.title' %></h1>

<%= render 'form' %>
<%= link_to "Voltar ao perfil", @user %>
<%= link_to t('links.back'), @user %>
4 changes: 2 additions & 2 deletions app/views/users/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1>Cadastro</h1>
<h1><%= t '.title' %></h1>

<%= render 'form' %>
<%= link_to "Voltar", root_path %>
<%= link_to t('links.back'), root_path %>
8 changes: 4 additions & 4 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<h1>Perfil: <%= @user.full_name %> </h1>
<h1><%= t '.title', user_name: @user.full_name %> </h1>

<ul>
<li>Localização: <%= @user.location %> </li>
<li>Bio: <%= @user.bio %> </li>
<li><%= t '.location', location: @user.location %> </li>
<li><%= t '.bio', bio: @user.bio %> </li>
</ul>

<%= link_to 'Editar Perfil', edit_user_path(@user) %>
<%= link_to t('.edit'), edit_user_path(@user) %>
4 changes: 2 additions & 2 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ class Application < Rails::Application

# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
config.time_zone = 'Brasilia'

# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
config.i18n.default_locale = :pt
end
end
44 changes: 44 additions & 0 deletions config/locales/pt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
pt:
rooms:
new:
title: Cadastro
edit:
title: Ediar quarto
show:
title: "Quarto: %{room_title}"
edit: Ediar quarto
location: "Localização: %{location}"
description: "Description: %{description}"
users:
new:
title: Cadastro
edit:
title: Ediar perfil
show:
title: "Perfil: %{user_name}"
edit: Ediar perfil
location: "Localização: %{location}"
bio: "Bio: %{bio}"
links:
back: Voltar
layout:
rooms: Quartos
signup: Cadastro
general:
form_error: "Há erros no formilário, favor verificar"
activerecord:
models:
room: Quarto
user: Usuário
attributes:
room:
description: Descrição
location: Localização
title: Título
user:
bio: Biografia
email: Email
full_name: "Nome completo"
location: Localização
password: Senha
password_confirmation: "Confirme sua senha"
211 changes: 211 additions & 0 deletions config/locales/rails.pt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
pt:
date:
abbr_day_names:
- Dom
- Seg
- Ter
- Qua
- Qui
- Sex
- Sáb
abbr_month_names:
-
- Jan
- Fev
- Mar
- Abr
- Mai
- Jun
- Jul
- Ago
- Set
- Out
- Nov
- Dez
day_names:
- Domingo
- Segunda
- Terça
- Quarta
- Quinta
- Sexta
- Sábado
formats:
default: ! '%d/%m/%Y'
long: ! '%d de %B de %Y'
short: ! '%d de %B'
month_names:
-
- Janeiro
- Fevereiro
- Março
- Abril
- Maio
- Junho
- Julho
- Agosto
- Setembro
- Outubro
- Novembro
- Dezembro
order:
- :day
- :month
- :year
datetime:
distance_in_words:
about_x_hours:
one: aproximadamente 1 hora
other: aproximadamente %{count} horas
about_x_months:
one: aproximadamente 1 mês
other: aproximadamente %{count} meses
about_x_years:
one: aproximadamente 1 ano
other: aproximadamente %{count} anos
almost_x_years:
one: quase 1 ano
other: quase %{count} anos
half_a_minute: meio minuto
less_than_x_minutes:
one: menos de um minuto
other: menos de %{count} minutos
less_than_x_seconds:
one: menos de 1 segundo
other: menos de %{count} segundos
over_x_years:
one: mais de 1 ano
other: mais de %{count} anos
x_days:
one: 1 dia
other: ! '%{count} dias'
x_minutes:
one: 1 minuto
other: ! '%{count} minutos'
x_months:
one: 1 mês
other: ! '%{count} meses'
x_seconds:
one: 1 segundo
other: ! '%{count} segundos'
prompts:
day: Dia
hour: Hora
minute: Minuto
month: Mês
second: Segundo
year: Ano
errors: &errors
format: ! '%{attribute} %{message}'
messages:
accepted: deve ser aceito
blank: não pode ficar em branco
present: deve ficar em branco
confirmation: não é igual a %{attribute}
empty: não pode ficar vazio
equal_to: deve ser igual a %{count}
even: deve ser par
exclusion: não está disponível
greater_than: deve ser maior que %{count}
greater_than_or_equal_to: deve ser maior ou igual a %{count}
inclusion: não está incluído na lista
invalid: não é válido
less_than: deve ser menor que %{count}
less_than_or_equal_to: deve ser menor ou igual a %{count}
not_a_number: não é um número
not_an_integer: não é um número inteiro
odd: deve ser ímpar
record_invalid: ! 'A validação falhou: %{errors}'
restrict_dependent_destroy:
one: "Não é possível excluir o registro pois existe um %{record} dependente"
many: "Não é possível excluir o registro pois existem %{record} dependentes"
taken: já está em uso
too_long: ! 'é muito longo (máximo: %{count} caracteres)'
too_short: ! 'é muito curto (mínimo: %{count} caracteres)'
wrong_length: não possui o tamanho esperado (%{count} caracteres)
template:
body: ! 'Por favor, verifique o(s) seguinte(s) campo(s):'
header:
one: ! 'Não foi possível gravar %{model}: 1 erro'
other: ! 'Não foi possível gravar %{model}: %{count} erros.'
helpers:
select:
prompt: Por favor selecione
submit:
create: Criar %{model}
submit: Salvar %{model}
update: Atualizar %{model}
number:
currency:
format:
delimiter: .
format: ! '%u %n'
precision: 2
separator: ! ','
significant: false
strip_insignificant_zeros: false
unit: R$
format:
delimiter: .
precision: 3
separator: ! ','
significant: false
strip_insignificant_zeros: false
human:
decimal_units:
format: ! '%n %u'
units:
billion:
one: bilhão
other: bilhões
million:
one: milhão
other: milhões
quadrillion:
one: quatrilhão
other: quatrilhões
thousand: mil
trillion:
one: trilhão
other: trilhões
unit: ''
format:
delimiter: .
precision: 2
significant: true
strip_insignificant_zeros: true
storage_units:
format: ! '%n %u'
units:
byte:
one: Byte
other: Bytes
gb: GB
kb: KB
mb: MB
tb: TB
percentage:
format:
delimiter: .
precision:
format:
delimiter: .
support:
array:
last_word_connector: ! ' e '
two_words_connector: ! ' e '
words_connector: ! ', '
time:
am: ''
formats:
default: ! '%a, %d de %B de %Y, %H:%M:%S %z'
long: ! '%d de %B de %Y, %H:%M'
short: ! '%d de %B, %H:%M'
pm: ''
# remove these aliases after 'activemodel' and 'activerecord' namespaces are removed from Rails repository
activemodel:
errors:
<<: *errors
activerecord:
errors:
<<: *errors

0 comments on commit d238332

Please sign in to comment.