i81n 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "i81n"
5
- s.version = "0.2.2"
5
+ s.version = "0.3.0"
6
6
  s.authors = ["jugyo"]
7
7
  s.email = ["jugyo.org@gmail.com"]
8
8
  s.homepage = "https://github.com/jugyo/i81n"
@@ -1,14 +1,14 @@
1
1
  require 'i18n'
2
2
  class I18n::Backend::I81n < I18n::Backend::Simple
3
- attr_reader :ignore_pattern
3
+ attr_reader :ignore
4
4
 
5
- def initialize(ignore_pattern = nil)
6
- @ignore_pattern = ignore_pattern
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 ignore_pattern && ignore_pattern =~ key.to_s
11
+ if ignore && ignore =~ key.to_s
12
12
  super
13
13
  else
14
14
  super || key.to_s
@@ -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.2.2
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-17 00:00:00.000000000 Z
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: &14600820 !ruby/object:Gem::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: *14600820
24
+ version_requirements: *14846660
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: shoulda
27
- requirement: &14531960 !ruby/object:Gem::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: *14531960
35
+ version_requirements: *14777940
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &14530700 !ruby/object:Gem::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: *14530700
46
+ version_requirements: *14776600
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &14529740 !ruby/object:Gem::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: *14529740
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
@@ -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