Como utilizar Internacionalização no Rails - criar aplicações em português

Depois de buscas exaustivas no google ainda não consegui utilizar o
i18n para internacionalização de aplicações com o Rails 3. Parece que
houve algumas mudanças em como utilizá-lo a partir do Rails 3.
Gostaria de criar minhas aplicações em português, sem ter que ficar
traduzindo as views na unha.
Qual seria a maneira mais indicada de fazer isso?


After exhaustive searches on google I still can not use the
i18n internationalization of applications with Rails 3. It seems that
there were some changes in how to use it from Rails 3.
I would like to create my applications in Portuguese, without having
to stay
reflecting the views on the nail.
What would be the better way to do this?

Actually there were just some minor changes, like the new
interpolation syntax (was “Helo {{user}}” and now it is “Hello %

What exactly is the problem you are finding in use I18n?

Inside the folder “locale” I save the file pt-BR.yml. So, I’ve
configured the application.rb file with “config.i18n.default_locale
= :pt-BR” .
When I’ve tried to start the server: rails server, I got this
/application.rb:32: uninitialized constant
DicEtim::Application::BR (NameError), etc…
I don’t know why, after I remove the “-BR” part of the file name, I
didn’t get the error message anymore.

This is an example of my file (pt.yml):

pt (before was pt-BR):

formatos de data e hora

default: “%d/%m/%Y”
short: “%d de %B”
long: “%d de %B de %Y”

day_names: [Domingo, Segunda, Terça, Quarta, Quinta, Sexta,

abbr_day_names: [Dom, Seg, Ter, Qua, Qui, Sex, Sáb]
month_names: [~, Janeiro, Fevereiro, Março, Abril, Maio, Junho,
Julho, Agosto, Setembro, Outubro, Novembro, Dezembro]
abbr_month_names: [~, Jan, Fev, Mar, Abr, Mai, Jun, Jul, Ago, Set,
Out, Nov, Dez]
order: [:day, :month, :year]

How could I translate a button with the text (“create termo”) for
example to (“criar termo”), that is generated by the controller below:

def new
@termo =

respond_to do |format|
  format.html # new.html.erb
  format.xml  { render :xml => @termo }


and _format.html.erb :

<%= form_for(@termo) do |f| %>
<% if @termo.errors.any? %>

<%= pluralize(@termo.errors.count, “error”) %> prohibited
this termo from being saved:

  <% @termo.errors.full_messages.each do |msg| %>
    <li><%= msg %></li>
  <% end %>

<% end %>

<%= f.label :termo %>
<%= f.text_field :termo %>
<%= f.label :significado %>
<%= f.text_area :significado %>
<%= f.submit %>
<% end %>

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs