spree_product_translation 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +10 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/.travis.yml +4 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +22 -0
- data/Gemfile.lock +231 -0
- data/LICENSE +26 -0
- data/README.md +36 -0
- data/Rakefile +31 -0
- data/Versionfile +10 -0
- data/app/assets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/images/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/images/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/ui-icons_888888_256x240.png +0 -0
- data/app/assets/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/javascripts/admin/jquery-ui-custom.js +11605 -0
- data/app/assets/javascripts/admin/jquery.livequery.js +226 -0
- data/app/assets/javascripts/admin/spree_product_translation.js +2 -0
- data/app/assets/stylesheets/admin/jquery-ui-smoothness.css +291 -0
- data/app/assets/stylesheets/admin/spree_product_translation.css +4 -0
- data/app/overrides/product_translation_js.rb +5 -0
- data/app/overrides/product_translation_meta_tabs.rb +5 -0
- data/app/overrides/product_translation_tabs.rb +5 -0
- data/app/views/admin/option_types/_form.html.erb +24 -0
- data/app/views/admin/option_types/_option_value_fields.html.erb +14 -0
- data/app/views/admin/product_properties/_product_property_fields.html.erb +18 -0
- data/app/views/admin/products/_product_form_left.html.erb +31 -0
- data/app/views/admin/products/_product_form_meta.html.erb +21 -0
- data/app/views/admin/properties/_form.html.erb +24 -0
- data/app/views/admin/taxons/_form.html.erb +35 -0
- data/config/initializers/application_helper.rb +19 -0
- data/config/routes.rb +3 -0
- data/db/migrate/20090824173314_add_translation_tables.rb +21 -0
- data/db/migrate/20110303123348_add_description_to_taxon_translations.rb +9 -0
- data/db/migrate/20110827074357_add_product_property_translation_table.rb +9 -0
- data/db/migrate/20111113141834_add_description_to_option_values.rb +11 -0
- data/lib/generators/spree_product_translation/install/install_generator.rb +29 -0
- data/lib/spree_product_translation.rb +2 -0
- data/lib/spree_product_translation/engine.rb +82 -0
- data/lib/tasks/spree_products_translations.rake +85 -0
- data/script/rails +7 -0
- data/spec/models/option_type_spec.rb +33 -0
- data/spec/models/product_spec.rb +41 -0
- data/spec/models/property_spec.rb +25 -0
- data/spec/models/prototype_spec.rb +28 -0
- data/spec/models/taxon_spec.rb +31 -0
- data/spec/models/taxonomy_spec.rb +31 -0
- data/spec/spec_helper.rb +31 -0
- data/spree_product_translation.gemspec +23 -0
- metadata +143 -0
data/script/rails
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
+
|
4
|
+
|
5
|
+
ENGINE_PATH = File.expand_path('../..', __FILE__)
|
6
|
+
load File.expand_path('../../spec/dummy/script/rails', __FILE__)
|
7
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe OptionType do
|
5
|
+
describe 'translation system' do
|
6
|
+
before(:all) do
|
7
|
+
@option_type = OptionType.new(:name => 'test_option_type')
|
8
|
+
|
9
|
+
I18n.locale = 'en-US'
|
10
|
+
@option_type.presentation = 'english presentation'
|
11
|
+
|
12
|
+
I18n.locale = 'pt-BR'
|
13
|
+
@option_type.presentation = 'apresentação em português'
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
describe " should translate the presentation" do
|
18
|
+
it 'to en_US' do
|
19
|
+
I18n.locale = 'en-US'
|
20
|
+
@option_type.presentation.should eql 'english presentation'
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'to pt-BR' do
|
24
|
+
I18n.locale = 'pt-BR'
|
25
|
+
@option_type.presentation.should eql 'apresentação em português'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Product do
|
5
|
+
describe 'translation system' do
|
6
|
+
before(:all) do
|
7
|
+
I18n.locale = 'en-US'
|
8
|
+
@product = Product.new(
|
9
|
+
:price => 10,
|
10
|
+
:permalink => 'TEST',
|
11
|
+
:name => 'english name',
|
12
|
+
:description => 'english description',
|
13
|
+
:meta_description => 'english meta_description',
|
14
|
+
:meta_keywords => 'english meta_keywords'
|
15
|
+
)
|
16
|
+
I18n.locale = 'pt-BR'
|
17
|
+
@product.name = 'nome em português'
|
18
|
+
@product.description = 'descrição em português'
|
19
|
+
@product.meta_description = 'meta descrição em português'
|
20
|
+
@product.meta_keywords = 'meta palavras-chave em português'
|
21
|
+
end
|
22
|
+
|
23
|
+
describe " should translate the product" do
|
24
|
+
it 'to en_US' do
|
25
|
+
I18n.locale = 'en-US'
|
26
|
+
@product.name.should eql 'english name'
|
27
|
+
@product.description.should eql 'english description'
|
28
|
+
@product.meta_description.should eql 'english meta_description'
|
29
|
+
@product.meta_keywords.should eql 'english meta_keywords'
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'to pt-BR' do
|
33
|
+
I18n.locale = 'pt-BR'
|
34
|
+
@product.name.should eql 'nome em português'
|
35
|
+
@product.description.should eql 'descrição em português'
|
36
|
+
@product.meta_description.should eql 'meta descrição em português'
|
37
|
+
@product.meta_keywords.should eql 'meta palavras-chave em português'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Property do
|
5
|
+
describe 'translation system' do
|
6
|
+
before(:all) do
|
7
|
+
I18n.locale = 'en-US'
|
8
|
+
@property = Property.new(:name => "some name for validation", :presentation => 'english presentation')
|
9
|
+
I18n.locale = 'pt-BR'
|
10
|
+
@property.presentation = 'apresentação em português'
|
11
|
+
end
|
12
|
+
|
13
|
+
describe " should translate the product" do
|
14
|
+
it 'to en_US' do
|
15
|
+
I18n.locale = 'en-US'
|
16
|
+
@property.presentation.should eql 'english presentation'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'to pt-BR' do
|
20
|
+
I18n.locale = 'pt-BR'
|
21
|
+
@property.presentation.should eql 'apresentação em português'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Prototype do
|
5
|
+
describe 'translation system' do
|
6
|
+
before(:all) do
|
7
|
+
I18n.locale = 'en-US'
|
8
|
+
@prototype = Prototype.new(:name => 'english name')
|
9
|
+
|
10
|
+
I18n.locale = 'pt-BR'
|
11
|
+
@prototype.name = 'nome em português'
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
describe " should translate the presentation" do
|
16
|
+
it 'to en_US' do
|
17
|
+
I18n.locale = 'en-US'
|
18
|
+
@prototype.name.should eql 'english name'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'to pt-BR' do
|
22
|
+
I18n.locale = 'pt-BR'
|
23
|
+
@prototype.name.should eql 'nome em português'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Taxon do
|
5
|
+
describe 'translation system' do
|
6
|
+
before(:all) do
|
7
|
+
I18n.locale = 'en-US'
|
8
|
+
@taxon = Taxon.new(:name => 'english name')
|
9
|
+
|
10
|
+
I18n.locale = 'pt-BR'
|
11
|
+
@taxon.name = 'nome em português'
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
describe " should translate the presentation" do
|
16
|
+
it 'to en_US' do
|
17
|
+
I18n.locale = 'en-US'
|
18
|
+
@taxon.name.should eql 'english name'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'to pt-BR' do
|
22
|
+
I18n.locale = 'pt-BR'
|
23
|
+
@taxon.name.should eql 'nome em português'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Taxonomy do
|
5
|
+
describe 'translation system' do
|
6
|
+
before(:all) do
|
7
|
+
I18n.locale = 'en-US'
|
8
|
+
@taxonomy = Taxonomy.new(:name => 'english name')
|
9
|
+
|
10
|
+
I18n.locale = 'pt-BR'
|
11
|
+
@taxonomy.name = 'nome em português'
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
describe " should translate the presentation" do
|
16
|
+
it 'to en_US' do
|
17
|
+
I18n.locale = 'en-US'
|
18
|
+
@taxonomy.name.should eql 'english name'
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'to pt-BR' do
|
22
|
+
I18n.locale = 'pt-BR'
|
23
|
+
@taxonomy.name.should eql 'nome em português'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# Configure Rails Environment
|
2
|
+
ENV["RAILS_ENV"] = "test"
|
3
|
+
|
4
|
+
|
5
|
+
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
6
|
+
|
7
|
+
|
8
|
+
require 'rspec/rails'
|
9
|
+
|
10
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
11
|
+
# in spec/support/ and its subdirectories.
|
12
|
+
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
13
|
+
|
14
|
+
RSpec.configure do |config|
|
15
|
+
# == Mock Framework
|
16
|
+
#
|
17
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
18
|
+
#
|
19
|
+
# config.mock_with :mocha
|
20
|
+
# config.mock_with :flexmock
|
21
|
+
# config.mock_with :rr
|
22
|
+
config.mock_with :rspec
|
23
|
+
|
24
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
25
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
26
|
+
|
27
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
28
|
+
# examples within a transaction, remove the following line or assign false
|
29
|
+
# instead of true.
|
30
|
+
config.use_transactional_fixtures = true
|
31
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
Gem::Specification.new do |s|
|
3
|
+
s.platform = Gem::Platform::RUBY
|
4
|
+
s.name = 'spree_product_translation'
|
5
|
+
s.version = '0.0.1'
|
6
|
+
s.summary = 'Translate products in multiple languages'
|
7
|
+
s.description = 'Translate products in multiple languages'
|
8
|
+
s.required_ruby_version = '>= 1.8.7'
|
9
|
+
|
10
|
+
s.author = 'Gamaliel A. Toro'
|
11
|
+
s.email = 'argami@gmail.com'
|
12
|
+
s.homepage = 'https://github.com/argami'
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.require_path = 'lib'
|
17
|
+
s.requirements << 'none'
|
18
|
+
|
19
|
+
s.add_dependency 'globalize3', '~> 0.2.0.beta3'
|
20
|
+
s.add_dependency 'spree_core', '>= 0.70.1'
|
21
|
+
s.add_development_dependency 'rspec-rails'
|
22
|
+
end
|
23
|
+
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: spree_product_translation
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Gamaliel A. Toro
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-12-07 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: globalize3
|
16
|
+
requirement: &70094370229600 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.2.0.beta3
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70094370229600
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: spree_core
|
27
|
+
requirement: &70094370228640 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.70.1
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70094370228640
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec-rails
|
38
|
+
requirement: &70094370226820 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70094370226820
|
47
|
+
description: Translate products in multiple languages
|
48
|
+
email: argami@gmail.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- .gitignore
|
54
|
+
- .rspec
|
55
|
+
- .rvmrc
|
56
|
+
- .travis.yml
|
57
|
+
- CHANGELOG.md
|
58
|
+
- Gemfile
|
59
|
+
- Gemfile.lock
|
60
|
+
- LICENSE
|
61
|
+
- README.md
|
62
|
+
- Rakefile
|
63
|
+
- Versionfile
|
64
|
+
- app/assets/images/ui-bg_flat_0_aaaaaa_40x100.png
|
65
|
+
- app/assets/images/ui-bg_flat_75_ffffff_40x100.png
|
66
|
+
- app/assets/images/ui-bg_glass_55_fbf9ee_1x400.png
|
67
|
+
- app/assets/images/ui-bg_glass_65_ffffff_1x400.png
|
68
|
+
- app/assets/images/ui-bg_glass_75_dadada_1x400.png
|
69
|
+
- app/assets/images/ui-bg_glass_75_e6e6e6_1x400.png
|
70
|
+
- app/assets/images/ui-bg_glass_95_fef1ec_1x400.png
|
71
|
+
- app/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png
|
72
|
+
- app/assets/images/ui-icons_222222_256x240.png
|
73
|
+
- app/assets/images/ui-icons_2e83ff_256x240.png
|
74
|
+
- app/assets/images/ui-icons_454545_256x240.png
|
75
|
+
- app/assets/images/ui-icons_888888_256x240.png
|
76
|
+
- app/assets/images/ui-icons_cd0a0a_256x240.png
|
77
|
+
- app/assets/javascripts/admin/jquery-ui-custom.js
|
78
|
+
- app/assets/javascripts/admin/jquery.livequery.js
|
79
|
+
- app/assets/javascripts/admin/spree_product_translation.js
|
80
|
+
- app/assets/stylesheets/admin/jquery-ui-smoothness.css
|
81
|
+
- app/assets/stylesheets/admin/spree_product_translation.css
|
82
|
+
- app/overrides/product_translation_js.rb
|
83
|
+
- app/overrides/product_translation_meta_tabs.rb
|
84
|
+
- app/overrides/product_translation_tabs.rb
|
85
|
+
- app/views/admin/option_types/_form.html.erb
|
86
|
+
- app/views/admin/option_types/_option_value_fields.html.erb
|
87
|
+
- app/views/admin/product_properties/_product_property_fields.html.erb
|
88
|
+
- app/views/admin/products/_product_form_left.html.erb
|
89
|
+
- app/views/admin/products/_product_form_meta.html.erb
|
90
|
+
- app/views/admin/properties/_form.html.erb
|
91
|
+
- app/views/admin/taxons/_form.html.erb
|
92
|
+
- config/initializers/application_helper.rb
|
93
|
+
- config/routes.rb
|
94
|
+
- db/migrate/20090824173314_add_translation_tables.rb
|
95
|
+
- db/migrate/20110303123348_add_description_to_taxon_translations.rb
|
96
|
+
- db/migrate/20110827074357_add_product_property_translation_table.rb
|
97
|
+
- db/migrate/20111113141834_add_description_to_option_values.rb
|
98
|
+
- lib/generators/spree_product_translation/install/install_generator.rb
|
99
|
+
- lib/spree_product_translation.rb
|
100
|
+
- lib/spree_product_translation/engine.rb
|
101
|
+
- lib/tasks/spree_products_translations.rake
|
102
|
+
- script/rails
|
103
|
+
- spec/models/option_type_spec.rb
|
104
|
+
- spec/models/product_spec.rb
|
105
|
+
- spec/models/property_spec.rb
|
106
|
+
- spec/models/prototype_spec.rb
|
107
|
+
- spec/models/taxon_spec.rb
|
108
|
+
- spec/models/taxonomy_spec.rb
|
109
|
+
- spec/spec_helper.rb
|
110
|
+
- spree_product_translation.gemspec
|
111
|
+
homepage: https://github.com/argami
|
112
|
+
licenses: []
|
113
|
+
post_install_message:
|
114
|
+
rdoc_options: []
|
115
|
+
require_paths:
|
116
|
+
- lib
|
117
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
119
|
+
requirements:
|
120
|
+
- - ! '>='
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 1.8.7
|
123
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
|
+
none: false
|
125
|
+
requirements:
|
126
|
+
- - ! '>='
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '0'
|
129
|
+
requirements:
|
130
|
+
- none
|
131
|
+
rubyforge_project:
|
132
|
+
rubygems_version: 1.8.10
|
133
|
+
signing_key:
|
134
|
+
specification_version: 3
|
135
|
+
summary: Translate products in multiple languages
|
136
|
+
test_files:
|
137
|
+
- spec/models/option_type_spec.rb
|
138
|
+
- spec/models/product_spec.rb
|
139
|
+
- spec/models/property_spec.rb
|
140
|
+
- spec/models/prototype_spec.rb
|
141
|
+
- spec/models/taxon_spec.rb
|
142
|
+
- spec/models/taxonomy_spec.rb
|
143
|
+
- spec/spec_helper.rb
|