merb_r18n 0.1 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +5 -4
- data/Rakefile +9 -7
- data/lib/merb_r18n.rb +3 -3
- data/spec/app/{translations → i18n}/en.yml +0 -0
- data/spec/app/{translations → i18n}/ru.yml +0 -0
- data/spec/spec_helper.rb +1 -1
- metadata +7 -7
data/README.rdoc
CHANGED
@@ -8,11 +8,12 @@ information.
|
|
8
8
|
|
9
9
|
== Features
|
10
10
|
|
11
|
-
*
|
11
|
+
* It has special support for countries with two official languages. If there
|
12
|
+
isn’t translation in user locale, it will be found in locales, which
|
12
13
|
user may know (not only in default locale). For example, many people in
|
13
14
|
Belarus can understand Russian, and locale has information about it.
|
14
|
-
* It can
|
15
|
-
|
15
|
+
* It can format numbers and time to the rules of the user locale, translate
|
16
|
+
month and week days name and give other locale information.
|
16
17
|
* It has translation for commons words, like “OK”, “Cancel”, etc.
|
17
18
|
* It storage translation in rich YAML format. You can put procedures and
|
18
19
|
pluralization (“1 comment”, “5 comments”) in your translation.
|
@@ -33,7 +34,7 @@ information.
|
|
33
34
|
end
|
34
35
|
|
35
36
|
You may use another way, just set :locale param.
|
36
|
-
3. Create translations file in <tt>app/
|
37
|
+
3. Create translations file in <tt>app/i18n/</tt>. For example <tt>app/i18n/en.yml</tt>:
|
37
38
|
|
38
39
|
post:
|
39
40
|
add: Add post
|
data/Rakefile
CHANGED
@@ -4,7 +4,8 @@ require 'rake/gempackagetask'
|
|
4
4
|
require 'spec/rake/spectask'
|
5
5
|
|
6
6
|
PKG_NAME = 'merb_r18n'
|
7
|
-
|
7
|
+
gem 'r18n-core'
|
8
|
+
require 'r18n-core/version'
|
8
9
|
|
9
10
|
##############################################################################
|
10
11
|
# Tests
|
@@ -54,15 +55,16 @@ end
|
|
54
55
|
spec = Gem::Specification.new do |s|
|
55
56
|
s.platform = Gem::Platform::RUBY
|
56
57
|
s.name = PKG_NAME
|
57
|
-
s.version =
|
58
|
+
s.version = R18n::VERSION
|
58
59
|
s.summary = 'A plugin for the Merb framework that provides i18n support to
|
59
60
|
translate your site.'
|
60
61
|
s.description = <<-EOF
|
61
62
|
A plugin for the Merb framework that provides i18n support to translate your
|
62
63
|
site in several languages. It is just a wrap for R18n core library.
|
63
|
-
It can
|
64
|
-
translation
|
65
|
-
|
64
|
+
It can format numbers and time to the rules of the user locale,
|
65
|
+
has translation for common words, storage translation in YAML format with
|
66
|
+
pluralization and procedures and has special support for countries
|
67
|
+
with two official languages.
|
66
68
|
EOF
|
67
69
|
|
68
70
|
s.files = FileList[
|
@@ -77,7 +79,7 @@ spec = Gem::Specification.new do |s|
|
|
77
79
|
s.has_rdoc = true
|
78
80
|
|
79
81
|
s.add_dependency 'merb-core'
|
80
|
-
s.add_dependency 'r18n-core',
|
82
|
+
s.add_dependency 'r18n-core', R18n::VERSION
|
81
83
|
|
82
84
|
s.author = 'Andrey "A.I." Sitnik'
|
83
85
|
s.email = 'andrey@sitnik.ru'
|
@@ -92,5 +94,5 @@ end
|
|
92
94
|
desc 'Install merb_r18n as a gem'
|
93
95
|
task :install => [:package] do
|
94
96
|
sudo = RUBY_PLATFORM =~ /win32/ ? '' : 'sudo'
|
95
|
-
sh %{#{sudo} gem install pkg/#{PKG_NAME}-#{
|
97
|
+
sh %{#{sudo} gem install pkg/#{PKG_NAME}-#{R18n::VERSION}}
|
96
98
|
end
|
data/lib/merb_r18n.rb
CHANGED
@@ -18,16 +18,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
=end
|
19
19
|
|
20
20
|
require 'rubygems'
|
21
|
-
gem 'r18n-core', '
|
21
|
+
gem 'r18n-core', '~>0.1'
|
22
22
|
require 'r18n-core'
|
23
23
|
|
24
24
|
# make sure we're running inside Merb
|
25
25
|
if defined?(Merb::Plugins)
|
26
|
-
Merb.push_path(:
|
26
|
+
Merb.push_path(:i18n, Merb.root / "app" / "i18n")
|
27
27
|
|
28
28
|
Merb::Plugins.config[:merb_r18n] = {
|
29
29
|
:default_locale => 'en',
|
30
|
-
:translations_dir => Merb.dir_for(:
|
30
|
+
:translations_dir => Merb.dir_for(:i18n)
|
31
31
|
}
|
32
32
|
|
33
33
|
module Merb
|
File without changes
|
File without changes
|
data/spec/spec_helper.rb
CHANGED
@@ -7,7 +7,7 @@ require File.dirname(__FILE__) / '../lib/merb_r18n'
|
|
7
7
|
require File.dirname(__FILE__) / 'app/controllers/i18n'
|
8
8
|
|
9
9
|
Merb::Plugins.config[:merb_r18n][:translations_dir] =
|
10
|
-
File.dirname(__FILE__) / 'app/
|
10
|
+
File.dirname(__FILE__) / 'app/i18n'
|
11
11
|
|
12
12
|
Merb.start :environment => 'test'
|
13
13
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merb_r18n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrey "A.I." Sitnik
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-23 00:00:00 +03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -30,9 +30,9 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.1.1
|
34
34
|
version:
|
35
|
-
description: A plugin for the Merb framework that provides i18n support to translate your site in several languages. It is just a wrap for R18n core library. It can
|
35
|
+
description: A plugin for the Merb framework that provides i18n support to translate your site in several languages. It is just a wrap for R18n core library. It can format numbers and time to the rules of the user locale, has translation for common words, storage translation in YAML format with pluralization and procedures and has special support for countries with two official languages.
|
36
36
|
email: andrey@sitnik.ru
|
37
37
|
executables: []
|
38
38
|
|
@@ -75,9 +75,9 @@ summary: A plugin for the Merb framework that provides i18n support to translat
|
|
75
75
|
test_files:
|
76
76
|
- spec/spec_helper.rb
|
77
77
|
- spec/app
|
78
|
-
- spec/app/
|
79
|
-
- spec/app/
|
80
|
-
- spec/app/
|
78
|
+
- spec/app/i18n
|
79
|
+
- spec/app/i18n/ru.yml
|
80
|
+
- spec/app/i18n/en.yml
|
81
81
|
- spec/app/views
|
82
82
|
- spec/app/views/i18n
|
83
83
|
- spec/app/views/i18n/index.html.erb
|