i81n 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/README.md +2 -2
- data/i81n.gemspec +1 -1
- data/lib/i81n.rb +4 -4
- data/test/test_i81n.rb +5 -1
- metadata +11 -11
- data/Gemfile.lock +0 -26
data/.gitignore
ADDED
data/README.md
CHANGED
@@ -19,7 +19,7 @@ Rails をお使いの際は Gemfile に以下を追記して bundle install を
|
|
19
19
|
|
20
20
|
I18n.backend を以下のように設定してください(Rails では config/initializers/i81n.rb 等に書いておくとよいでしょう)。
|
21
21
|
|
22
|
-
I18n.backend = I18n::Backend::I81n.new(/^(helpers\.label|activerecord\.attributes)/)
|
22
|
+
I18n.backend = I18n::Backend::I81n.new(:ignore => /^(helpers\.label|activerecord\.attributes)/)
|
23
23
|
|
24
24
|
使い方
|
25
25
|
----
|
@@ -59,4 +59,4 @@ I18n は I18n::Backend::Simple を拡張することによって上記の機能
|
|
59
59
|
コピーライト
|
60
60
|
----
|
61
61
|
|
62
|
-
Copyright (c) 2011 jugyo. See LICENSE.txt for further details.
|
62
|
+
Copyright (c) 2011 jugyo. See LICENSE.txt for further details.
|
data/i81n.gemspec
CHANGED
data/lib/i81n.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'i18n'
|
2
2
|
class I18n::Backend::I81n < I18n::Backend::Simple
|
3
|
-
attr_reader :
|
3
|
+
attr_reader :ignore
|
4
4
|
|
5
|
-
def initialize(
|
6
|
-
@
|
5
|
+
def initialize(options = {})
|
6
|
+
@ignore = options[:ignore]
|
7
7
|
super()
|
8
8
|
end
|
9
9
|
|
10
10
|
def lookup(locale, key, scope = [], options = {})
|
11
|
-
if
|
11
|
+
if ignore && ignore =~ key.to_s
|
12
12
|
super
|
13
13
|
else
|
14
14
|
super || key.to_s
|
data/test/test_i81n.rb
CHANGED
@@ -3,7 +3,7 @@ require 'helper'
|
|
3
3
|
class TestI81n < Test::Unit::TestCase
|
4
4
|
context '' do
|
5
5
|
setup do
|
6
|
-
I18n.backend = I18n::Backend::I81n.new
|
6
|
+
I18n.backend = I18n::Backend::I81n.new(:ignore => /^aaa\.bbb/)
|
7
7
|
I18n.config.load_path << File.expand_path('../fixtures/en.yml', __FILE__)
|
8
8
|
end
|
9
9
|
|
@@ -26,5 +26,9 @@ class TestI81n < Test::Unit::TestCase
|
|
26
26
|
should "get the translation thet is not stored and have embeded string" do
|
27
27
|
assert_equal('10 times', I18n.t('%{n} times', :n => 10))
|
28
28
|
end
|
29
|
+
|
30
|
+
should "ignore by the regexp" do
|
31
|
+
assert_equal('translation missing: en.aaa.bbb', I18n.t('aaa.bbb'))
|
32
|
+
end
|
29
33
|
end
|
30
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: i81n
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: i18n
|
16
|
-
requirement: &
|
16
|
+
requirement: &14846660 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *14846660
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: shoulda
|
27
|
-
requirement: &
|
27
|
+
requirement: &14777940 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *14777940
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &14776600 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *14776600
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &14775600 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *14775600
|
58
58
|
description: I81n aims that make I18n easy to use.
|
59
59
|
email:
|
60
60
|
- jugyo.org@gmail.com
|
@@ -63,8 +63,8 @@ extensions: []
|
|
63
63
|
extra_rdoc_files: []
|
64
64
|
files:
|
65
65
|
- .document
|
66
|
+
- .gitignore
|
66
67
|
- Gemfile
|
67
|
-
- Gemfile.lock
|
68
68
|
- LICENSE.txt
|
69
69
|
- README.md
|
70
70
|
- Rakefile
|
data/Gemfile.lock
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
i81n (0.2.1)
|
5
|
-
i18n
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: http://rubygems.org/
|
9
|
-
specs:
|
10
|
-
git (1.2.5)
|
11
|
-
i18n (0.5.0)
|
12
|
-
jeweler (1.5.2)
|
13
|
-
bundler (~> 1.0.0)
|
14
|
-
git (>= 1.2.5)
|
15
|
-
rake
|
16
|
-
rake (0.8.7)
|
17
|
-
shoulda (2.11.3)
|
18
|
-
|
19
|
-
PLATFORMS
|
20
|
-
ruby
|
21
|
-
|
22
|
-
DEPENDENCIES
|
23
|
-
bundler
|
24
|
-
i81n!
|
25
|
-
jeweler
|
26
|
-
shoulda
|