Add the gem to your
and install it with Bundler:
ActiveAdmin Translate takes the available languages from
I18n.available_locales, so you want to configure them in
config.i18n.available_locales = [:en, :de, :fr, :it]
You need to import the SASS for styling the tabs to
In order to access the translations of your model and be able to write them on save, you need to make attributes
accessible in your model. Globalize3 stores the model translations in a separate table that is accessible as
translations in your model:
class GlobalizedModel < ActiveRecord::Base attr_accessible :translations, :translations_attributes accepts_nested_attributes_for :translations end
To translate your form you need to use the
translate_inputs form helper:
form do |f| f.translate_inputs do |t| t.input :title t.input :description end end
To show the attributes for all locales, you use the
translate_attributes_table_for view helper:
show do |model| panel 'Globalized Model' do translate_attributes_table_for model do row :title row :description do |p| BlueCloth.new(p.teaser).to_html.html_safe end end end end
To localize your locale names, use the following I18n key structure per locale:
en: active_admin: translate: en: "English"
and add more translations with the registered locale symbol.
Developed by Michael Kessler, FlinkFinger GmbH.
You can report bugs and feature requests to GitHub Issues.
Please don't ask question in the issue tracker, instead ask them at Stackoverflow and use the activeadmin tag.
When you file a bug, please try to follow these simple rules if applicable:
- Make sure you've read the README carefully.
- Give as much information about your environment, like Ruby and ActiveAdmin version.
- Make sure that the issue is reproducible with your description.
It's most likely that your bug gets resolved faster if you provide as much information as possible!
Pull requests are very welcome! Please try to follow these simple rules if applicable:
- Please create a topic branch for every separate change you make.
- Update the Yard documentation.
- Update the README.
- Update the CHANGELOG for noteworthy changes.
- Please do not change the version number.
This project has taken some ideas and code from the following projects:
Copyright (c) 2012 Michael Kessler
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.