@@ -8,54 +8,59 @@ This is the Internationalization project for [Solidus](https://solidus.io)
88
99---
1010
11- ## Supported languages
11+ ## Changes in Version 2.0
1212
13- We currently support the [ following locales] ( https://github.com/solidusio-contrib/solidus_i18n/tree/master/config/locales )
14- by default. If you need a locale that is not in the list you can add a custom
15- translation file into your application by following the
16- [ Rails translations guide] ( http://guides.rubyonrails.org/i18n.html#how-to-store-your-custom-translations ) .
13+ solidus_i18n Version 2.0+ only contains translation files.
14+
15+ Previous versions of solidus_i18n included extra functionality like locale
16+ selectors and which is now built in to Solidus 2.6+. Configuration for
17+ ` routing-fitler ` has also been removed and must be configured manually
18+ (See [ Locale in URL] ( #locale-in-url ) ).
1719
1820## Installation
1921
2022Add the following to your ` Gemfile ` :
2123
2224``` ruby
23- gem ' solidus_i18n' , github: ' solidusio-contrib/solidus_i18n' , branch: ' master'
25+ gem ' solidus_i18n' , ' ~> 2.0'
26+ gem ' rails-i18n' , ' ~> 5.1'
27+ gem ' kaminari-i18n' , ' ~> 0.5.0'
2428```
2529
26- Run ` bundle install `
30+ ## Locale in URL
2731
28- You can use the generator to install migrations and append solidus_i18n assets to
29- your app solidus manifest file .
32+ Older versions of solidus_i18n included the routing-filter gem and configured routes to include the locale in the URL.
33+ This is still supported (maybe even recommended) but requires some additional configuration .
3034
31- bin/rails g solidus_i18n: install
35+ 1 . Add this gem to your ` Gemfile ` , then run ` bundle install`
3236
33- This will insert these lines into your Spree assets manifests:
34-
35- In ` vendor/assets/javascripts/spree/frontend/all.js `
36-
37- ```
38- //= require spree/frontend/solidus_i18n
37+ ``` ruby
38+ gem ' routing-filter' , ' ~> 0.6.0'
3939```
4040
41- In ` vendor/assets/javascripts/spree/backend/all.js `
41+ 2 . Add ` filter :locale ` to your ` config/routes.rb `
4242
43- ```
44- //= require spree/backend/solidus_i18n
45- ```
43+ ``` ruby
44+ Rails .application.routes.draw do
45+ filter :locale
4646
47- ## Set default locale
47+ mount Spree ::Core ::Engine , at: ' /'
48+ end
49+ ```
4850
49- In ` config/initializers/spree.rb ` you will find the default locale settings
50- for both frontend and backend. Just replace ` 'en' ` with your default locale
51- code.
51+ 3 . Configure routing-fitler in ` config/initializers/locale_filter.rb ` (optional)
5252
53- ## Add more languages to the frontend locale toggle
53+ ``` ruby
54+ # Do not include the default locale in the URL
55+ RoutingFilter ::Locale .include_default_locale = false
56+ ```
5457
55- Go to Admin -> General Settings -> Localization Setting and add the locales
56- you want your users to be able to select from the locale toggle on the frontend.
58+ ## Supported languages
5759
58- ---
60+ We currently support the [ following locales] ( https://github.com/solidusio-contrib/solidus_i18n/tree/master/config/locales )
61+ by default. If you need a locale that is not in the list you can add a custom
62+ translation file into your application by following the
63+ [ Rails translations guide] ( http://guides.rubyonrails.org/i18n.html#how-to-store-your-custom-translations ) .
5964
6065## Updating Translations
6166
@@ -69,8 +74,6 @@ Substitute <LOCALE> with your locale code (e.g: `it`).
6974This will do a cleanup and prepare ` <LOCALE>.yml ` with all the missing keys.
7075You can then write the translations and open a pull request.
7176
72- ---
73-
7477## Model Translations
7578
7679We ** removed** support for translating models into [ a separate Gem] ( https://github.com/solidusio-contrib/solidus_globalize ) .
@@ -82,8 +85,6 @@ Please update your `Gemfile` if you still need the model translations.
8285gem ' solidus_globalize' , github: ' solidusio-contrib/solidus_globalize' , branch: ' master'
8386```
8487
85- ---
86-
8788## Upgrading
8889
8990** 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** !
0 commit comments