forked from rgiard/spree-product-translations
-
Notifications
You must be signed in to change notification settings - Fork 0
/
product_translations_extension.rb
43 lines (33 loc) · 1018 Bytes
/
product_translations_extension.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Uncomment this if you reference any of your controllers in activate
# require_dependency 'application'
class ProductTranslationsExtension < Spree::Extension
version "1.0"
description "Makes product details, properties, prototypes and taxonomies translatable using the Globalize 2 plugin"
def activate
# add content translations using Globalize 2's helpers
Product.class_eval do
translates :name, :description, :meta_description, :meta_keywords
end
Property.class_eval do
translates :presentation
end
Prototype.class_eval do
translates :name
end
Taxonomy.class_eval do
translates :name
end
Taxon.class_eval do
translates :name
end
OptionType.class_eval do
translates :presentation
end
OptionValue.class_eval do
translates :presentation
end
# Enable I18n fallbacks
require "i18n/backend/fallbacks"
I18n.default_locale = Spree::Config[:default_locale]
end
end