This is the Internationalization project for Spree Commerce
See the official Internationalization documentation for more details.
Add the following to your
gem 'spree_i18n', github: 'spree/spree_i18n', branch: 'master'
You can use the generator to install migrations and append spree_i18n assets to your app spree manifest file.
rails g spree_i18n:install
This will insert these lines into your spree manifest files:
We've added support for translating models. The feature uses the Globalize gem to localize model data. So far the following models are translatable:
Product, Promotion, OptionType, Taxonomy, Taxon and Property.
Start your server and you should see a TRANSLATIONS link or a flag icon on each admin section that supports this feature.
The extension contains two configs that allow users to customize which locales should be displayed as options on the translation forms and which should be listed to customers on the frontend. You can set them on an initializer. e.g.
SpreeI18n::Config.available_locales = [:en, :es, :'pt-BR'] # displayed on translation forms SpreeI18n::Config.supported_locales = [:en, :'pt-BR'] # displayed on frontend select box
ps. please use symbols, not strings. e.g.
:'pt-BR' not just
you may get unexpected errors
Or if you prefer they're also available on the admin UI general settings section.
Every record needs to have a translation. If by any chance you remove spree_i18n
from your Gemfile, add some records and then add spree_i18n gem back you might get
undefined method for nilClass because Globalize will try fetch
translations that do not exist.
In the spirit of free software, everyone is encouraged to help improve this project.
Here are some ways you can contribute:
- by using prerelease versions
- by reporting bugs
- by suggesting new features
- by writing translations
- by writing or editing documentation
- by writing specifications
- by writing code (no patch is too small: fix typos, add comments, clean up inconsistent whitespace)
- by refactoring code
- by resolving issues
- by reviewing patches
- Fork the repo
- Clone your repo
bundle exec rake test_appto create the test application in
- Make your changes
- Ensure specs pass by running
bundle exec rspec spec
- Submit your pull request