spree_product_translations 0.0.3 → 0.1.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +18 -10
- data/lib/spree_product_translations.rb +9 -7
- data/lib/tasks/install.rake +9 -8
- metadata +35 -68
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Makes product details, properties, prototypes, taxonomies and option types translatable by bridging the [Globalize3](https://github.com/svenfuchs/globalize3) gem.
|
4
4
|
|
5
|
-
## Installation and configuration
|
5
|
+
## Installation and configuration ##
|
6
6
|
|
7
7
|
In your Gemfile, add:
|
8
8
|
|
@@ -26,44 +26,52 @@ If you have pre-existing data, you'll need to run this rake task:
|
|
26
26
|
|
27
27
|
it will copy the original data over to the new translation tables. Globalize3 doesn't default to the original model table for the default locale like v1 used to.
|
28
28
|
|
29
|
-
## How to use it
|
29
|
+
## How to use it ##
|
30
30
|
|
31
31
|
To edit the content in a specific language, simply change the locale on the language nav, and edit on the admin as usual.
|
32
32
|
|
33
|
-
## Translated fields
|
33
|
+
## Translated fields ##
|
34
34
|
|
35
|
-
Product
|
35
|
+
### Product ###
|
36
36
|
|
37
37
|
* name
|
38
38
|
* description
|
39
39
|
* meta_description
|
40
40
|
* meta_keywords
|
41
41
|
|
42
|
-
Property
|
42
|
+
### Property ###
|
43
43
|
|
44
44
|
* presentation
|
45
45
|
|
46
|
-
Prototype
|
46
|
+
### Prototype ###
|
47
47
|
|
48
48
|
* name
|
49
49
|
|
50
|
-
Taxonomy
|
50
|
+
### Taxonomy ###
|
51
51
|
|
52
52
|
* name
|
53
53
|
|
54
|
-
Taxon
|
54
|
+
### Taxon ###
|
55
55
|
|
56
56
|
* name
|
57
57
|
* description
|
58
58
|
|
59
|
-
OptionType
|
59
|
+
### OptionType ###
|
60
60
|
|
61
61
|
* presentation
|
62
62
|
|
63
|
-
OptionValue
|
63
|
+
### OptionValue ###
|
64
64
|
|
65
65
|
* presentation
|
66
66
|
|
67
|
+
## Fallbacks for empty translations ##
|
68
|
+
|
69
|
+
If you have translations in your database (by using the [spree-simple_product_translations](https://github.com/jeroenj/spree-simple_product_translations) extension for example) with empty translations (being a blank string instead of `nil`) you might want to add this configuration option to an initializer in your app:
|
70
|
+
|
71
|
+
Spree::Config.set :fallbacks_for_empty_translations => true
|
72
|
+
|
73
|
+
It will then use fallbacks for empty strings too.
|
74
|
+
|
67
75
|
## Running tests ##
|
68
76
|
|
69
77
|
The tests are not updated since the original fork of the spree 0.11 compatible version. They will pretty sure fail. Feel free to fork the project and create a pull request with tests.
|
@@ -10,32 +10,34 @@ module SpreeProductTranslations
|
|
10
10
|
Rails.env.production? ? require(c) : load(c)
|
11
11
|
end
|
12
12
|
|
13
|
+
@@fallbacks_for_empty_translations = Spree::Config[:fallbacks_for_empty_translations] != '0' # Booelans are stored as an int as a string
|
14
|
+
|
13
15
|
::Product.class_eval do
|
14
|
-
translates :name, :description, :meta_description, :meta_keywords
|
16
|
+
translates :name, :description, :meta_description, :meta_keywords, :fallbacks_for_empty_translations => @@fallbacks_for_empty_translations
|
15
17
|
end
|
16
18
|
|
17
19
|
::Property.class_eval do
|
18
|
-
translates :presentation
|
20
|
+
translates :presentation, :fallbacks_for_empty_translations => @@fallbacks_for_empty_translations
|
19
21
|
end
|
20
22
|
|
21
23
|
::Prototype.class_eval do
|
22
|
-
translates :name
|
24
|
+
translates :name, :fallbacks_for_empty_translations => @@fallbacks_for_empty_translations
|
23
25
|
end
|
24
26
|
|
25
27
|
::Taxonomy.class_eval do
|
26
|
-
translates :name
|
28
|
+
translates :name, :fallbacks_for_empty_translations => @@fallbacks_for_empty_translations
|
27
29
|
end
|
28
30
|
|
29
31
|
::Taxon.class_eval do
|
30
|
-
translates :name, :description
|
32
|
+
translates :name, :description, :fallbacks_for_empty_translations => @@fallbacks_for_empty_translations
|
31
33
|
end
|
32
34
|
|
33
35
|
::OptionType.class_eval do
|
34
|
-
translates :presentation
|
36
|
+
translates :presentation, :fallbacks_for_empty_translations => @@fallbacks_for_empty_translations
|
35
37
|
end
|
36
38
|
|
37
39
|
::OptionValue.class_eval do
|
38
|
-
translates :presentation
|
40
|
+
translates :presentation, :fallbacks_for_empty_translations => @@fallbacks_for_empty_translations
|
39
41
|
end
|
40
42
|
|
41
43
|
# Enable I18n fallbacks
|
data/lib/tasks/install.rake
CHANGED
@@ -2,7 +2,7 @@ namespace :spree_product_translations do
|
|
2
2
|
desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
|
3
3
|
task :install do
|
4
4
|
Rake::Task['spree_product_translations:install:migrations'].invoke
|
5
|
-
Rake::Task['spree_product_translations:install:assets'].invoke
|
5
|
+
# Rake::Task['spree_product_translations:install:assets'].invoke
|
6
6
|
end
|
7
7
|
|
8
8
|
namespace :install do
|
@@ -10,15 +10,16 @@ namespace :spree_product_translations do
|
|
10
10
|
task :migrations do
|
11
11
|
source = File.join(File.dirname(__FILE__), '..', '..', 'db')
|
12
12
|
destination = File.join(Rails.root, 'db')
|
13
|
+
puts "INFO: Mirroring migrations from #{source} to #{destination}"
|
13
14
|
Spree::FileUtilz.mirror_files(source, destination)
|
14
15
|
end
|
15
16
|
|
16
|
-
desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
|
17
|
-
task :assets do
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
17
|
+
# desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
|
18
|
+
# task :assets do
|
19
|
+
# source = File.join(File.dirname(__FILE__), '..', '..', 'public')
|
20
|
+
# destination = File.join(Rails.root, 'public')
|
21
|
+
# puts "INFO: Mirroring assets from #{source} to #{destination}"
|
22
|
+
# Spree::FileUtilz.mirror_files(source, destination)
|
23
|
+
# end
|
23
24
|
end
|
24
25
|
end
|
metadata
CHANGED
@@ -1,106 +1,73 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree_product_translations
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 3
|
10
|
-
version: 0.0.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0.beta1
|
5
|
+
prerelease: 6
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Jeroen Jacobs
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-09-21 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: globalize3
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &70344217238900 !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
18
|
+
requirements:
|
27
19
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
- 1
|
33
|
-
- 0
|
34
|
-
- beta
|
35
|
-
version: 0.1.0.beta
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.2.0.beta1
|
36
22
|
type: :runtime
|
37
|
-
version_requirements: *id001
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: spree_core
|
40
23
|
prerelease: false
|
41
|
-
|
24
|
+
version_requirements: *70344217238900
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: spree_core
|
27
|
+
requirement: &70344217238180 !ruby/object:Gem::Requirement
|
42
28
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
hash: 185
|
47
|
-
segments:
|
48
|
-
- 0
|
49
|
-
- 40
|
50
|
-
- 3
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
51
32
|
version: 0.40.3
|
52
33
|
type: :runtime
|
53
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70344217238180
|
54
36
|
description:
|
55
|
-
email:
|
37
|
+
email: gems@jeroenj.be
|
56
38
|
executables: []
|
57
|
-
|
58
39
|
extensions: []
|
59
|
-
|
60
40
|
extra_rdoc_files: []
|
61
|
-
|
62
|
-
files:
|
41
|
+
files:
|
63
42
|
- README.md
|
64
43
|
- lib/spree_product_translations.rb
|
65
44
|
- lib/tasks/install.rake
|
66
45
|
- lib/tasks/spree_product_translations.rake
|
67
46
|
- db/migrate/20090824173314_add_translation_tables.rb
|
68
47
|
- db/migrate/20110303123348_add_description_to_taxon_translations.rb
|
69
|
-
has_rdoc: false
|
70
48
|
homepage: https://github.com/jeroenj/spree-product_translations
|
71
49
|
licenses: []
|
72
|
-
|
73
50
|
post_install_message:
|
74
51
|
rdoc_options: []
|
75
|
-
|
76
|
-
require_paths:
|
52
|
+
require_paths:
|
77
53
|
- lib
|
78
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
55
|
none: false
|
80
|
-
requirements:
|
81
|
-
- -
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
hash: 57
|
84
|
-
segments:
|
85
|
-
- 1
|
86
|
-
- 8
|
87
|
-
- 7
|
56
|
+
requirements:
|
57
|
+
- - ! '>='
|
58
|
+
- !ruby/object:Gem::Version
|
88
59
|
version: 1.8.7
|
89
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
61
|
none: false
|
91
|
-
requirements:
|
92
|
-
- -
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
|
95
|
-
|
96
|
-
- 0
|
97
|
-
version: "0"
|
98
|
-
requirements:
|
62
|
+
requirements:
|
63
|
+
- - ! '>'
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 1.3.1
|
66
|
+
requirements:
|
99
67
|
- none
|
100
68
|
rubyforge_project:
|
101
|
-
rubygems_version: 1.
|
69
|
+
rubygems_version: 1.8.10
|
102
70
|
signing_key:
|
103
71
|
specification_version: 3
|
104
72
|
summary: Spree Extension that adds translations to products
|
105
73
|
test_files: []
|
106
|
-
|