How to avoid server restart when changing I18n transfers?

I have a Rails 4 application in which I am trying to enable translations that need to be entered using I18n-active_record .

Everything seems to be working fine, but after adding or changing one of the translations, a server reboot is required so that the updated translations appear in the views.

How to configure the application so that the translation displayed in the view always receives the latest information in db without restarting the server?

I can do this in my controller:

 if @translation.update(translation_params)
    I18n.backend.reload!
    redirect_to translations_url
 else
    render :edit, alert: 'There was a problem:'
 end

But is there a “cleaner” way to do this?

+4
source share
1 answer

, , , ( ).

i18n, I18n.cache_store.clear .

0

Source: https://habr.com/ru/post/1540707/


All Articles