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

Version 2.0 #122

Merged
merged 19 commits into from
May 2, 2018
Merged
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
65 changes: 33 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,54 +8,59 @@ This is the Internationalization project for [Solidus](https://solidus.io)

---

## Supported languages
## Changes in Version 2.0

We currently support the [following locales](https://github.com/solidusio-contrib/solidus_i18n/tree/master/config/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](http://guides.rubyonrails.org/i18n.html#how-to-store-your-custom-translations).
solidus_i18n Version 2.0+ only contains translation files.

Previous versions of solidus_i18n included extra functionality like locale
selectors and which is now built in to Solidus 2.6+. Configuration for
`routing-fitler` has also been removed and must be configured manually
(See [Locale in URL](#locale-in-url)).

## Installation

Add the following to your `Gemfile`:

```ruby
gem 'solidus_i18n', github: 'solidusio-contrib/solidus_i18n', branch: 'master'
gem 'solidus_i18n', '~> 2.0'
gem 'rails-i18n', '~> 5.1'
gem 'kaminari-i18n', '~> 0.5.0'
```

Run `bundle install`
## Locale in URL

You can use the generator to install migrations and append solidus_i18n assets to
your app solidus manifest file.
Older versions of solidus_i18n included the routing-filter gem and configured routes to include the locale in the URL.
This is still supported (maybe even recommended) but requires some additional configuration.

bin/rails g solidus_i18n:install
1. Add this gem to your `Gemfile`, then run `bundle install`

This will insert these lines into your Spree assets manifests:

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

```
//= require spree/frontend/solidus_i18n
``` ruby
gem 'routing-filter', '~> 0.6.0'
```

In `vendor/assets/javascripts/spree/backend/all.js`
2. Add `filter :locale` to your `config/routes.rb`

```
//= require spree/backend/solidus_i18n
```
``` ruby
Rails.application.routes.draw do
filter :locale

## Set default locale
mount Spree::Core::Engine, at: '/'
end
```

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.
3. Configure routing-fitler in `config/initializers/locale_filter.rb` (optional)

## Add more languages to the frontend locale toggle
``` ruby
# Do not include the default locale in the URL
RoutingFilter::Locale.include_default_locale = false
```

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.
## Supported languages

---
We currently support the [following locales](https://github.com/solidusio-contrib/solidus_i18n/tree/master/config/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](http://guides.rubyonrails.org/i18n.html#how-to-store-your-custom-translations).

## Updating Translations

Expand All @@ -69,8 +74,6 @@ Substitute <LOCALE> with your locale code (e.g: `it`).
This will do a cleanup and prepare `<LOCALE>.yml` with all the missing keys.
You can then write the translations and open a pull request.

---

## Model Translations

We **removed** support for translating models into [a separate Gem](https://github.com/solidusio-contrib/solidus_globalize).
Expand All @@ -82,8 +85,6 @@ Please update your `Gemfile` if you still need the model translations.
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**!
Expand Down

This file was deleted.

14 changes: 0 additions & 14 deletions app/assets/javascripts/spree/backend/helpers.js.coffee.erb

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions app/assets/javascripts/spree/backend/solidus_i18n.js

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/javascripts/spree/backend/translations.js.coffee

This file was deleted.

3 changes: 0 additions & 3 deletions app/assets/javascripts/spree/frontend/locale.js.coffee

This file was deleted.

2 changes: 0 additions & 2 deletions app/assets/javascripts/spree/frontend/solidus_i18n.js

This file was deleted.

8 changes: 0 additions & 8 deletions app/assets/stylesheets/spree/backend/solidus_i18n.css

This file was deleted.

8 changes: 0 additions & 8 deletions app/assets/stylesheets/spree/frontend/solidus_i18n.css

This file was deleted.

16 changes: 0 additions & 16 deletions app/controllers/spree/admin/locales_controller.rb

This file was deleted.

28 changes: 0 additions & 28 deletions app/controllers/spree/api/available_locales_controller.rb

This file was deleted.

3 changes: 0 additions & 3 deletions app/controllers/spree/api/base_controller_decorator.rb

This file was deleted.

3 changes: 0 additions & 3 deletions app/controllers/spree/base_controller_decorator.rb

This file was deleted.

5 changes: 0 additions & 5 deletions app/controllers/spree/locale_controller_decorator.rb

This file was deleted.

29 changes: 0 additions & 29 deletions app/helpers/solidus_i18n/locale_helper.rb

This file was deleted.

13 changes: 0 additions & 13 deletions app/models/spree/store_decorator.rb

This file was deleted.

This file was deleted.

This file was deleted.

Loading