In Spree (Rails E-commerce App) what is the preferred way to restrict locales?

I only want to support german and english for starter. As I see it, I can easily restrict this in spree core locales.rb

or localization extension by simply deleting the locale files.

But this is not entirely correct. I would like to customize it to build my site in spite of simple enlargement. Can anyone tell me how can I set AVAILABLE_LOCALES?

+2


source to share


1 answer


You can change AVAILABLE_LOCALES in config / initializers / locales.rb. Obviously, there is usually no need to have too much localization. Just change the code that collects all available locales by default.

You may need something like this:



require 'spree/extension'
all_locale_paths = Spree::ExtensionLoader.load_extension_roots.dup << SPREE_ROOT
AVAILABLE_LOCALES = {'en-GB'=>'English', 'de'=>'Deutsch'}

      

+2


source







All Articles