Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added I18n translation #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,22 @@ To style the web interface you are advised to use Sass. Here's an example scss f

Just save this into your rails assets and you're ready to go.

## I18n ##

For using I18n translation add this config to your locale file:

```yaml
#config/en.yml

en:
configurable:
save_button: "Save config"
title: "Config my site"
success:
save: "Saved!"
```


## Running the Tests ##

The tests for this rails engine are in the `spec` and `features` directories. They use the dummy rails app in `spec/dummy`
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin/configurables/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class='configurable-container'>

<div class="header">
<h2>Config</h2>
<h2> <%= I18n.t('configurable.title', default: 'Config' ) %></h2>
</div>

<div class="configurable-options">
Expand All @@ -25,7 +25,7 @@
</div>
<%- end -%>

<%= submit_tag 'Save' %>
<%= submit_tag I18n.t('configurable.save_button', default: 'Save'), class: 'configurable button' %>
<%- end -%>
</div>
</div>
4 changes: 2 additions & 2 deletions lib/configurable_engine/configurables_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ def update
end

if failures.empty?
redirect_to admin_configurable_path, :notice => "Changes successfully updated"
redirect_to admin_configurable_path, :notice => I18n.t('configurable.success.save', default: "Changes successfully updated")
else
flash[:error] = failures.flat_map(&:errors).flat_map(&:full_messages).join(',')
redirect_to admin_configurable_path
end
end
end
end
end