Search code examples
ruby-on-railsruby-on-rails-4spree

Spree 3.1: Multilanguage links


I need to store more links for one thing (e.g. social networks) in multi language shop. Should I store links in preferences like this:

AppConfiguration.class_eval do
  preference :fb_de, :string, default: 'https://fb.com/example_de'
  preference :fb_en, :string, default: 'https://fb.com/example_en'
end

or should I store them in translation file or somewhere else?


Solution

  • The best practice is to store them in the translation file.

    It the future it will allow you to introduce new languages, by simply enabling them in the configuration and by defining new entries in the translation file, without adding any additional logic.