translate-rails3-plus 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -20
- data/README.md +89 -89
- data/Rakefile +35 -35
- data/VERSION +1 -1
- data/app/controllers/translate_controller.rb +218 -218
- data/app/helpers/translate_helper.rb +53 -53
- data/app/views/layouts/translate.html.erb +495 -495
- data/app/views/translate/_array_form.html.erb +45 -45
- data/app/views/translate/_pagination.html.erb +24 -24
- data/app/views/translate/_string_form.html.erb +35 -35
- data/app/views/translate/index.html.erb +96 -96
- data/config/routes.rb +5 -5
- data/init.rb +1 -1
- data/lib/tasks/translate.rake +200 -200
- data/lib/translate.rb +17 -17
- data/lib/translate/file.rb +35 -35
- data/lib/translate/keys.rb +194 -194
- data/lib/translate/log.rb +35 -35
- data/lib/translate/routes.rb +11 -11
- data/lib/translate/storage.rb +28 -28
- data/spec/controllers/translate_controller_spec.rb +130 -130
- data/spec/file_spec.rb +54 -54
- data/spec/files/translate/app/models/article.rb +12 -12
- data/spec/files/translate/app/views/category.erb +1 -1
- data/spec/files/translate/app/views/category.html +1 -1
- data/spec/files/translate/app/views/category.html.erb +1 -1
- data/spec/files/translate/app/views/category.rhtml +5 -5
- data/spec/keys_spec.rb +179 -179
- data/spec/log_spec.rb +47 -47
- data/spec/spec_helper.rb +11 -11
- data/spec/storage_spec.rb +33 -33
- metadata +2 -2
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
begin
|
2
|
-
# Using PWD here instead of File.dirname(__FILE__) to be able to symlink to plugin
|
3
|
-
# from within a Rails app.
|
4
|
-
require File.expand_path(ENV['PWD'] + '/../../../spec/spec_helper')
|
5
|
-
rescue LoadError => e
|
6
|
-
puts "You need to install rspec in your base app\n#{e.message}: #{e.backtrace.join("\n")}"
|
7
|
-
exit
|
8
|
-
end
|
9
|
-
|
10
|
-
plugin_spec_dir = File.dirname(__FILE__)
|
11
|
-
ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log")
|
1
|
+
begin
|
2
|
+
# Using PWD here instead of File.dirname(__FILE__) to be able to symlink to plugin
|
3
|
+
# from within a Rails app.
|
4
|
+
require File.expand_path(ENV['PWD'] + '/../../../spec/spec_helper')
|
5
|
+
rescue LoadError => e
|
6
|
+
puts "You need to install rspec in your base app\n#{e.message}: #{e.backtrace.join("\n")}"
|
7
|
+
exit
|
8
|
+
end
|
9
|
+
|
10
|
+
plugin_spec_dir = File.dirname(__FILE__)
|
11
|
+
ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log")
|
data/spec/storage_spec.rb
CHANGED
@@ -1,33 +1,33 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
-
|
3
|
-
describe Translate::Storage do
|
4
|
-
describe "write_to_file" do
|
5
|
-
before(:each) do
|
6
|
-
@storage = Translate::Storage.new(:en)
|
7
|
-
end
|
8
|
-
|
9
|
-
it "writes all I18n messages for a locale to YAML file" do
|
10
|
-
I18n.backend.should_receive(:translations).and_return(translations)
|
11
|
-
@storage.stub!(:file_path).and_return(file_path)
|
12
|
-
file = mock(:file)
|
13
|
-
file.should_receive(:write).with(translations)
|
14
|
-
Translate::File.should_receive(:new).with(file_path).and_return(file)
|
15
|
-
@storage.write_to_file
|
16
|
-
end
|
17
|
-
|
18
|
-
def file_path
|
19
|
-
File.join(File.dirname(__FILE__), "files", "en.yml")
|
20
|
-
end
|
21
|
-
|
22
|
-
def translations
|
23
|
-
{
|
24
|
-
:en => {
|
25
|
-
:article => {
|
26
|
-
:title => "One Article"
|
27
|
-
},
|
28
|
-
:category => "Category"
|
29
|
-
}
|
30
|
-
}
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
+
|
3
|
+
describe Translate::Storage do
|
4
|
+
describe "write_to_file" do
|
5
|
+
before(:each) do
|
6
|
+
@storage = Translate::Storage.new(:en)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "writes all I18n messages for a locale to YAML file" do
|
10
|
+
I18n.backend.should_receive(:translations).and_return(translations)
|
11
|
+
@storage.stub!(:file_path).and_return(file_path)
|
12
|
+
file = mock(:file)
|
13
|
+
file.should_receive(:write).with(translations)
|
14
|
+
Translate::File.should_receive(:new).with(file_path).and_return(file)
|
15
|
+
@storage.write_to_file
|
16
|
+
end
|
17
|
+
|
18
|
+
def file_path
|
19
|
+
File.join(File.dirname(__FILE__), "files", "en.yml")
|
20
|
+
end
|
21
|
+
|
22
|
+
def translations
|
23
|
+
{
|
24
|
+
:en => {
|
25
|
+
:article => {
|
26
|
+
:title => "One Article"
|
27
|
+
},
|
28
|
+
:category => "Category"
|
29
|
+
}
|
30
|
+
}
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: translate-rails3-plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Marklund
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
96
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.6.
|
97
|
+
rubygems_version: 2.6.13
|
98
98
|
signing_key:
|
99
99
|
specification_version: 3
|
100
100
|
summary: Newsdesk translate plugin for Rails 3 and above
|