On peut maintenant gérer les traductions dans la base, sera utilisé pour certains textes, notamment d'aide
This commit is contained in:
parent
26968189bf
commit
008eaeb9ef
8
Gemfile
8
Gemfile
@ -52,8 +52,16 @@ gem 'modernizr-rails'
|
|||||||
gem 'activeadmin', github: 'gregbell/active_admin'
|
gem 'activeadmin', github: 'gregbell/active_admin'
|
||||||
# To correct some 4.1 issue with active_admin:
|
# To correct some 4.1 issue with active_admin:
|
||||||
gem 'polyamorous', github: 'activerecord-hackery/polyamorous'
|
gem 'polyamorous', github: 'activerecord-hackery/polyamorous'
|
||||||
|
gem "formtastic", github: "justinfrench/formtastic"
|
||||||
|
gem "ransack", github: "activerecord-hackery/ransack", branch: "rails-4.1"
|
||||||
|
gem "devise", github: "plataformatec/devise"
|
||||||
|
|
||||||
gem 'rails-i18n'
|
gem 'rails-i18n'
|
||||||
gem 'devise-i18n'
|
gem 'devise-i18n'
|
||||||
|
# Store some specific content, like application name and some important documentation
|
||||||
|
gem 'i18n-active_record',
|
||||||
|
git: 'git://github.com/svenfuchs/i18n-active_record.git',
|
||||||
|
require: 'i18n/active_record'
|
||||||
gem 'font-awesome-rails'
|
gem 'font-awesome-rails'
|
||||||
|
|
||||||
gem 'simple_calendar', github: 'echarp/simple_calendar'
|
gem 'simple_calendar', github: 'echarp/simple_calendar'
|
||||||
|
52
Gemfile.lock
52
Gemfile.lock
@ -5,6 +5,17 @@ GIT
|
|||||||
polyamorous (0.6.4)
|
polyamorous (0.6.4)
|
||||||
activerecord (>= 3.0)
|
activerecord (>= 3.0)
|
||||||
|
|
||||||
|
GIT
|
||||||
|
remote: git://github.com/activerecord-hackery/ransack.git
|
||||||
|
revision: d51c78f9071f291b0707ed32093e191f4d8d3b26
|
||||||
|
branch: rails-4.1
|
||||||
|
specs:
|
||||||
|
ransack (1.1.0)
|
||||||
|
actionpack (>= 4.0)
|
||||||
|
activerecord (>= 4.0)
|
||||||
|
activesupport (>= 4.0)
|
||||||
|
i18n
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: git://github.com/echarp/simple_calendar.git
|
remote: git://github.com/echarp/simple_calendar.git
|
||||||
revision: 415838f60847068bc29459f5a275c04d4db05ee9
|
revision: 415838f60847068bc29459f5a275c04d4db05ee9
|
||||||
@ -30,6 +41,31 @@ GIT
|
|||||||
ransack (~> 1.0)
|
ransack (~> 1.0)
|
||||||
sass-rails
|
sass-rails
|
||||||
|
|
||||||
|
GIT
|
||||||
|
remote: git://github.com/justinfrench/formtastic.git
|
||||||
|
revision: 9904fc4336f63a5375573a7002647680dcae773e
|
||||||
|
specs:
|
||||||
|
formtastic (2.3.0.rc2)
|
||||||
|
actionpack (>= 3.0)
|
||||||
|
|
||||||
|
GIT
|
||||||
|
remote: git://github.com/plataformatec/devise.git
|
||||||
|
revision: b786c384d54a6365bdc6c0cf6068dc5325a301a9
|
||||||
|
specs:
|
||||||
|
devise (3.2.4)
|
||||||
|
bcrypt (~> 3.0)
|
||||||
|
orm_adapter (~> 0.1)
|
||||||
|
railties (>= 3.2.6, < 5)
|
||||||
|
thread_safe (~> 0.1)
|
||||||
|
warden (~> 1.2.3)
|
||||||
|
|
||||||
|
GIT
|
||||||
|
remote: git://github.com/svenfuchs/i18n-active_record.git
|
||||||
|
revision: 55507cf59f8f2173d38e07e18df0e90d25b1f0f6
|
||||||
|
specs:
|
||||||
|
i18n-active_record (0.0.2)
|
||||||
|
i18n (>= 0.5.0)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
@ -89,12 +125,6 @@ GEM
|
|||||||
compass-rails (1.1.7)
|
compass-rails (1.1.7)
|
||||||
compass (>= 0.12.2)
|
compass (>= 0.12.2)
|
||||||
sprockets (<= 2.11.0)
|
sprockets (<= 2.11.0)
|
||||||
devise (3.2.4)
|
|
||||||
bcrypt (~> 3.0)
|
|
||||||
orm_adapter (~> 0.1)
|
|
||||||
railties (>= 3.2.6, < 5)
|
|
||||||
thread_safe (~> 0.1)
|
|
||||||
warden (~> 1.2.3)
|
|
||||||
devise-i18n (0.10.3)
|
devise-i18n (0.10.3)
|
||||||
em-websocket (0.5.0)
|
em-websocket (0.5.0)
|
||||||
eventmachine (>= 0.12.9)
|
eventmachine (>= 0.12.9)
|
||||||
@ -106,8 +136,6 @@ GEM
|
|||||||
font-awesome-rails (4.0.3.1)
|
font-awesome-rails (4.0.3.1)
|
||||||
railties (>= 3.2, < 5.0)
|
railties (>= 3.2, < 5.0)
|
||||||
formatador (0.2.4)
|
formatador (0.2.4)
|
||||||
formtastic (2.3.0.rc2)
|
|
||||||
actionpack (>= 3.0)
|
|
||||||
fssm (0.2.10)
|
fssm (0.2.10)
|
||||||
gritter (1.1.0)
|
gritter (1.1.0)
|
||||||
guard (2.6.0)
|
guard (2.6.0)
|
||||||
@ -203,10 +231,6 @@ GEM
|
|||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
rake (10.2.2)
|
rake (10.2.2)
|
||||||
ransack (1.1.0)
|
|
||||||
actionpack (>= 3.0)
|
|
||||||
activerecord (>= 3.0)
|
|
||||||
polyamorous (~> 0.6.0)
|
|
||||||
rb-fsevent (0.9.4)
|
rb-fsevent (0.9.4)
|
||||||
rb-inotify (0.9.3)
|
rb-inotify (0.9.3)
|
||||||
ffi (>= 0.5.0)
|
ffi (>= 0.5.0)
|
||||||
@ -261,13 +285,16 @@ DEPENDENCIES
|
|||||||
activeadmin!
|
activeadmin!
|
||||||
coffee-rails
|
coffee-rails
|
||||||
compass-rails
|
compass-rails
|
||||||
|
devise!
|
||||||
devise-i18n
|
devise-i18n
|
||||||
font-awesome-rails
|
font-awesome-rails
|
||||||
|
formtastic!
|
||||||
gritter
|
gritter
|
||||||
guard-bundler
|
guard-bundler
|
||||||
guard-livereload
|
guard-livereload
|
||||||
guard-minitest
|
guard-minitest
|
||||||
haml-rails
|
haml-rails
|
||||||
|
i18n-active_record!
|
||||||
jbuilder (~> 2.0)
|
jbuilder (~> 2.0)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
jquery-turbolinks
|
jquery-turbolinks
|
||||||
@ -277,6 +304,7 @@ DEPENDENCIES
|
|||||||
quiet_assets
|
quiet_assets
|
||||||
rails (~> 4.1.0.rc1)
|
rails (~> 4.1.0.rc1)
|
||||||
rails-i18n
|
rails-i18n
|
||||||
|
ransack!
|
||||||
redcarpet
|
redcarpet
|
||||||
sass-rails (~> 4.0.1)
|
sass-rails (~> 4.0.1)
|
||||||
sdoc (~> 0.4.0)
|
sdoc (~> 0.4.0)
|
||||||
|
6
app/admin/translation.rb
Normal file
6
app/admin/translation.rb
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
ActiveAdmin.register I18n::Backend::ActiveRecord::Translation do
|
||||||
|
# See permitted parameters documentation:
|
||||||
|
# https://github.com/gregbell/active_admin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters
|
||||||
|
#
|
||||||
|
permit_params :key, :value
|
||||||
|
end
|
3
config/initializers/locale.rb
Normal file
3
config/initializers/locale.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
require 'i18n/backend/active_record'
|
||||||
|
|
||||||
|
I18n.backend = I18n::Backend::Chain.new(I18n::Backend::ActiveRecord.new, I18n.backend)
|
@ -26,6 +26,7 @@ fr:
|
|||||||
city: Cité
|
city: Cité
|
||||||
region: Région
|
region: Région
|
||||||
lug: Gull
|
lug: Gull
|
||||||
|
i18n/backend/active_record/translation: Traduction
|
||||||
attributes:
|
attributes:
|
||||||
user:
|
user:
|
||||||
login: Login
|
login: Login
|
||||||
@ -59,6 +60,12 @@ fr:
|
|||||||
all: Toutes les régions
|
all: Toutes les régions
|
||||||
note:
|
note:
|
||||||
contents: Votre commentaire
|
contents: Votre commentaire
|
||||||
|
i18n/backend/active_record/translation:
|
||||||
|
locale: Langue
|
||||||
|
key: Clé
|
||||||
|
value: Valeur
|
||||||
|
interpolations: Interpolations
|
||||||
|
is_proc: Procédure?
|
||||||
|
|
||||||
helpers:
|
helpers:
|
||||||
submit:
|
submit:
|
||||||
|
11
db/migrate/20140403204748_create_translation.rb
Normal file
11
db/migrate/20140403204748_create_translation.rb
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
class CreateTranslation < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :translations do |t|
|
||||||
|
t.string :locale
|
||||||
|
t.string :key
|
||||||
|
t.text :value
|
||||||
|
t.text :interpolations
|
||||||
|
t.boolean :is_proc, default: false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
10
db/schema.rb
10
db/schema.rb
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20131114103121) do
|
ActiveRecord::Schema.define(version: 20140403204748) do
|
||||||
|
|
||||||
create_table "active_admin_comments", force: true do |t|
|
create_table "active_admin_comments", force: true do |t|
|
||||||
t.string "namespace"
|
t.string "namespace"
|
||||||
@ -99,6 +99,14 @@ ActiveRecord::Schema.define(version: 20131114103121) do
|
|||||||
t.string "name", default: "", null: false
|
t.string "name", default: "", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "translations", force: true do |t|
|
||||||
|
t.string "locale"
|
||||||
|
t.string "key"
|
||||||
|
t.text "value"
|
||||||
|
t.text "interpolations"
|
||||||
|
t.boolean "is_proc", default: false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "users", force: true do |t|
|
create_table "users", force: true do |t|
|
||||||
t.string "login", default: "", null: false
|
t.string "login", default: "", null: false
|
||||||
t.string "password", default: "", null: false
|
t.string "password", default: "", null: false
|
||||||
|
@ -5,3 +5,7 @@
|
|||||||
#
|
#
|
||||||
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
||||||
# Mayor.create(name: 'Emanuel', city: cities.first)
|
# Mayor.create(name: 'Emanuel', city: cities.first)
|
||||||
|
|
||||||
|
I18n::Backend::ActiveRecord::Translation.create([
|
||||||
|
{ locale: 'fr', key: 'layouts.application.subtitle', value: 'L\'agenda des évènements du Logiciel Libre en France' }
|
||||||
|
])
|
||||||
|
Loading…
Reference in New Issue
Block a user