From b5ede41a874e298b596f957d2a92535b83224686 Mon Sep 17 00:00:00 2001 From: echarp Date: Sun, 10 Aug 2014 00:26:18 +0200 Subject: [PATCH] =?UTF-8?q?Pour=20optimiser=20les=20pages,=20les=20traduct?= =?UTF-8?q?ions=20venant=20de=20la=20bd=20sont=20cach=C3=A9es=20en=20m?= =?UTF-8?q?=C3=A9moire?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/translation.rb | 4 ++++ config/initializers/locale.rb | 2 ++ config/locales/fr.yml | 2 ++ 3 files changed, 8 insertions(+) diff --git a/app/admin/translation.rb b/app/admin/translation.rb index 0f88e8ec..6b493cda 100644 --- a/app/admin/translation.rb +++ b/app/admin/translation.rb @@ -8,4 +8,8 @@ ActiveAdmin.register I18n::Backend::ActiveRecord::Translation do f.actions end end + + after_update do + I18n.reload! + end end diff --git a/config/initializers/locale.rb b/config/initializers/locale.rb index 385a3696..0bee853d 100644 --- a/config/initializers/locale.rb +++ b/config/initializers/locale.rb @@ -1,7 +1,9 @@ require 'i18n/backend/active_record' +# https://github.com/dylanz/i18n_backend_database Translation = I18n::Backend::ActiveRecord::Translation if Translation.table_exists? I18n.backend = I18n::Backend::Chain.new(I18n.backend, I18n::Backend::ActiveRecord.new) + I18n::Backend::ActiveRecord.send :include, I18n::Backend::Memoize end diff --git a/config/locales/fr.yml b/config/locales/fr.yml index e8de4b75..2c0fcd6c 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -75,6 +75,8 @@ fr: update: "Mettre à jour %{model}" event: create: Visualiser + q: + create: Rechercher date: abbr_day_names: