How it looks:
Text editing:
Images editing:
At first, you need to install a gem i18n-active_record using instructions.
Install gem edit_i18n_database_translations from github
gem 'edit_i18n_database_translations', github: 'wwju/edit_i18n_database_translations'
Put
rails g edit_i18n_database_translations:install
in the project console
Add
include EditI18nDatabaseTranslations::ControllerModule
in ApplicationController.rb
And add this line in application.html.erb layout
<%= i18n_editor %>
Restart your development server.
Now you can use helper method text in the application's views instead of t method.
Add i18n_editor=true into browser url.
Enter your very strong login and password (yes, there are http base auth).
Enjoy!!!
= text("pages.main_title")
en.yml
pages:
page1:
image: 'http://example.org/example.png'
= image_tag_i18n('pages.page1.image')
It accepts all the options, which function image_tag
can accept. And an option default.
= image_tag_i18n('pages.page1.image', default: image_url('place.jpg'))
It will add
onerror="this.onerror=null;this.src='place.jpg'"
in the image tag.
background-image: image_url_i18n('pages.page1.image')
But it requires assets recompilation.
You can access admin panel with all texts by typing i18n_editor/admin
after root url in your project.
Be careful!
You have to edit initializer initializers/edit_i18n_database_translations.rb
to load specific keys:
config.allowed_keys = [:questions_pages, :seo, :share,
:results_pages]
If you didn't add keys here, them will not appear in admin panel.
Cmd(Ctrl) + Enter = Submit
Esc = Undo
This project rocks and uses MIT-LICENSE.