Estrutura do arquivo .yml de localizacao:
pt:
produtos:
cadastro:
salvar: Salvar produtoUtilizando o helper t para traduzir nas views:
| class QuotesController < ApplicationController | |
| def home | |
| @quote = Quote.all.sort_by{rand}.slice(0,10).first | |
| respond_to :html | |
| end | |
| def show | |
| @quote = Quote.find params[:id] | |
| respond_to :html | |
| end |
| <div class="hero-unit"> | |
| <% if @quote %> | |
| <blockquote> | |
| <p><%= @quote.content %></p> | |
| <small><%= @quote.author %></small> | |
| </blockquote> | |
| <%= link_to 'Excluir frase', quote_path(@quote), method: :delete, confirm: 'Tem certeza?', class: 'btn' %> | |
| <% else %> | |
| <p>Nenhuma frase cadastrada.</p> |
| <% if @quote.errors.any? %> | |
| <div class="alert alert-error"> | |
| <% @quote.errors.full_messages.each do |msg| %> | |
| <p><%= msg %></p> | |
| <% end %> | |
| </div> | |
| <% end %> | |
| <%= form_for @quote do |f| %> | |
| <%= f.label :content %> |
| class QuotesController < ApplicationController | |
| def index | |
| @quotes = Quote.all | |
| respond_to :html | |
| end | |
| def home | |
| @quote = Quote.all.sort_by{rand}.slice(0,10).first | |
| respond_to :html | |
| end |
| <div class="hero-unit"> | |
| <% if @quote %> | |
| <blockquote> | |
| <p><%= @quote.content %></p> | |
| <small><%= @quote.author %></small> | |
| </blockquote> | |
| <% else %> | |
| <p>Nenhuma frase cadastrada.</p> | |
| <% end %> | |
| </div> |
| <% if @quotes.any? %> | |
| <table class="table table-striped"> | |
| <tbody> | |
| <% @quotes.each do |quote| %> | |
| <tr> | |
| <td><%= quote.content %></td> | |
| <td><%= link_to 'Excluir', quote_path(quote), method: :delete, confirm: 'Tem certeza?', class: 'btn' %></td> | |
| </tr> | |
| <% end %> | |
| </tbody> |
| pt: | |
| activerecord: | |
| attributes: | |
| quote: | |
| content: Frase | |
| author: Autor |
| pt: | |
| activerecord: | |
| attributes: | |
| quote: | |
| content: Frase | |
| author: Autor | |
| errors: | |
| models: | |
| quote: |
Estrutura do arquivo .yml de localizacao:
pt:
produtos:
cadastro:
salvar: Salvar produtoUtilizando o helper t para traduzir nas views:
| #!/bin/sh | |
| # | |
| # redis - this script starts and stops the redis-server daemon | |
| # | |
| # chkconfig: - 85 15 | |
| # description: Redis is a persistent key-value database | |
| # processname: redis-server | |
| # config: /etc/redis/redis.conf | |
| # config: /etc/sysconfig/redis | |
| # pidfile: /var/run/redis.pid |