Skip to content

Arpsara/solidus_i18n

 
 

Repository files navigation

Solidus Internationalization

Build Status Code Climate Gem Version

This is the Internationalization project for Solidus


Supported languages

We currently support the following locales by default. If you need a locale that is not in the list you can add a custom translation file into your application by following the Rails translations guide.

Installation

Add the following to your Gemfile:

gem 'solidus_i18n', github: 'solidusio-contrib/solidus_i18n', branch: 'master'

Run bundle install

You can use the generator to install migrations and append solidus_i18n assets to your app solidus manifest file.

bin/rails g solidus_i18n:install

This will insert these lines into your Spree assets manifests:

In vendor/assets/javascripts/spree/frontend/all.js

//= require spree/frontend/solidus_i18n

In vendor/assets/javascripts/spree/backend/all.js

//= require spree/backend/solidus_i18n

Set default locale

In config/initializers/spree.rb you will find the default locale settings for both frontend and backend. Just replace 'en' with your default locale code.

Add more languages to the frontend locale toggle

Go to Admin -> General Settings -> Localization Setting and add the locales you want your users to be able to select from the locale toggle on the frontend.


Model Translations

We removed support for translating models into a separate Gem.

Please update your Gemfile if you still need the model translations.

# Gemfile
gem 'solidus_globalize', github: 'solidusio-contrib/solidus_globalize', branch: 'master'

Upgrading

WARNING: If you want to keep your model translations, be sure to add the solidus_globalize gem to your Gemfile before migrating the database. Otherwise you will loose your translations!

1. Migrate your database

bin/rake solidus_i18n:upgrade
bin/rake db:migrate

Note: The migration automatically skips the removal of the translations tables. So it's safe to run the migration without data loss. But be sure to have the solidus_globalize gem in your Gemfile, if you want to keep them.

2. Remove Configuration

Remove all occurrences of SolidusI18n::Config.supported_locales from your code.

Contributing

Solidus is an open source project and we encourage contributions. Please read CONTRIBUTING.md before contributing.

About

🌏 This is the Internationalization project for Solidus

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 90.7%
  • HTML 4.9%
  • CSS 2.9%
  • CoffeeScript 1.1%
  • JavaScript 0.4%