i18n WIP
This commit is contained in:
parent
1030170c47
commit
028887f1a2
@ -2,4 +2,10 @@ class ApplicationController < ActionController::Base
|
||||
# Prevent CSRF attacks by raising an exception.
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
protect_from_forgery with: :exception
|
||||
|
||||
before_action :set_locale
|
||||
|
||||
def set_locale
|
||||
I18n.locale = params[:locale] || I18n.default_locale
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="center jumbotron">
|
||||
<h1>Library</h1>
|
||||
<h2>Browse <%= @books_count %> books</h2>
|
||||
<h1><%= t :library %></h1>
|
||||
<h2><%= t :welcome_count, count: @books_count %></h2>
|
||||
|
||||
<p>
|
||||
<%= link_to "Books", books_path, class: "btn btn-lg btn-primary", remote: true %>
|
||||
|
@ -21,3 +21,5 @@
|
||||
|
||||
en:
|
||||
hello: "Hello world"
|
||||
library: "Library"
|
||||
welcome_count: "Browse %{count} books"
|
||||
|
4
config/locales/fr.yml
Normal file
4
config/locales/fr.yml
Normal file
@ -0,0 +1,4 @@
|
||||
fr:
|
||||
hello: "Bonjour"
|
||||
library: "Bibliothèque"
|
||||
welcome_count: "Parcourir les %{count} livres"
|
Loading…
Reference in New Issue
Block a user