i18n-inflector 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,21 @@
1
+ commit e8ada4542f3ec98a669a39443c7e556a61894e44
2
+ Author: Paweł Wilk <siefca@gnu.org>
3
+ Date: Sat Jan 15 14:46:09 2011 +0100
4
+
5
+ README examples fixed
6
+
7
+ commit dc6ff4d63c7df14681c42ee9799c495aed8140de
8
+ Author: Paweł Wilk <siefca@gnu.org>
9
+ Date: Sat Jan 15 14:35:00 2011 +0100
10
+
11
+ Doco fixes
12
+
13
+ commit 6afd66c2780f792c13e9e61491cbcc55d684b882
14
+ Author: Paweł Wilk <siefca@gnu.org>
15
+ Date: Sat Jan 15 01:20:17 2011 +0100
16
+
17
+ Fix for duplicated dependency in Rakefile, typos fixed in README
18
+
1
19
  commit e7a6eb41eab2f76881169eeabb03e9540adeeb0e
2
20
  Author: Paweł Wilk <siefca@gnu.org>
3
21
  Date: Fri Jan 14 17:33:44 2011 +0100
data/Gemfile CHANGED
@@ -9,7 +9,6 @@ gem "test_declarative", ">=0.0.4", :group => [:development, :test]
9
9
  gem "yard", ">=0.6.4", :group => [:development, :test]
10
10
  gem "bundler", ">=1.0.7", :group => [:development, :test]
11
11
  gem "hoe-bundler", ">=1.0.0", :group => [:development, :test]
12
- gem "hoe-yard", ">=0.1.2", :group => [:development, :test]
13
12
  gem "hoe", ">=2.8.0", :group => [:development, :test]
14
13
 
15
14
  # vim: syntax=ruby
data/README.rdoc CHANGED
@@ -10,17 +10,23 @@
10
10
 
11
11
  == Description
12
12
 
13
- This backend module for Ruby's I18n overwrites the Simple backend
14
- translate method so that it will interpolate additional inflection
15
- tokens present in translations. These tokens may appear in *patterns*
16
- which are contained within <tt>@{</tt> and <tt>}</tt>
17
- symbols.
13
+ This library contains a backend module for I18n that adds some extra
14
+ functionality to standard backend. It overwrites the translate method
15
+ so that it will interpolate additional inflection tokens present in
16
+ translations. These tokens may appear in *patterns* which are contained
17
+ within <tt>@{</tt> and <tt>}</tt> symbols. Configuration is stored
18
+ also in translation data, in a scope <tt><locale>.i18n.inflections</tt>,
19
+ where <tt>locale</tt> is a locale subtree.
18
20
 
19
21
  You can choose different kinds (gender, title, person, time, author, etc.)
20
22
  of tokens to group them in a meaningful, semantical sets. That means you can
21
23
  apply Inflector to do simple inflection by a gender or a person, when some
22
24
  language requires it.
23
25
 
26
+ It adds the +inflector+ object to the default backend so you can use many
27
+ methods for accessing loaded inflection data at runtime, or set up global
28
+ switches that are controlling the engine.
29
+
24
30
  Example translation data:
25
31
 
26
32
  en:
@@ -40,12 +46,12 @@ Example translation data:
40
46
  == Why?
41
47
 
42
48
  It's intended to be used in a web projects or other projects where
43
- tranlations are performed by many people, yet there is a need to
49
+ translations are performed by many people, yet there is a need to
44
50
  substitute fragments of text depending on user's gender, person or
45
51
  other data.
46
52
 
47
53
  To achieve similar functionality lambdas can be used but including
48
- proc objects in translations may be considered as the unsafe idea.
54
+ proc objects in translations may be considered as unsafe.
49
55
 
50
56
  If you have a troop of happy translators that shouldn't have the
51
57
  ability to execute any code yet you need some simple inflection
@@ -90,6 +96,7 @@ Detailed example:
90
96
  f: "female"
91
97
  m: "male"
92
98
  n: "neuter"
99
+ o: "other"
93
100
  default: n
94
101
 
95
102
  welcome: "Dear @{f:Lady|m:Sir|n:You|All}"
@@ -98,15 +105,23 @@ Detailed example:
98
105
  I18n.t('welcome')
99
106
  # => "Dear You"
100
107
 
101
- I18n.t('welcome', :gender => :male)
108
+ I18n.t('welcome', :gender => :m)
102
109
  # => "Dear Sir"
103
110
 
111
+ I18n.t('welcome', :gender => :unknown)
112
+ # => "Dear You"
113
+
114
+ I18n.inflector.options.unknown_defaults = false
104
115
  I18n.t('welcome', :gender => :unknown)
105
116
  # => "Dear All"
106
117
 
107
- I18n.t('welcome', :gender => nil)
118
+ I18n.t('welcome', :gender => :o)
108
119
  # => "Dear All"
109
120
 
121
+ I18n.inflector.options.excluded_defaults = true
122
+ I18n.t('welcome', :gender => :o)
123
+ # => "Dear You"
124
+
110
125
  == Tests
111
126
 
112
127
  You can run tests both with
@@ -124,7 +139,7 @@ See {I18n::Backend::Inflector} module documentation for detailed information abo
124
139
 
125
140
  == See also
126
141
 
127
- See {i18n-inflector-rails}[https://rubygems.org/gems/i18n-inflector-rails] if you need
142
+ See {i18n-inflector-rails}[https://rubygems.org/gems/i18n-inflector-rails/file/README.rdoc] if you need
128
143
  the Rails plug-in that integrates this module with ActionController.
129
144
 
130
145
  == Credits
data/Rakefile CHANGED
@@ -46,8 +46,11 @@ Hoe.spec 'i18n-inflector' do
46
46
  extra_dev_deps << ['test_declarative', '>= 0.0.4'] <<
47
47
  ['yard', '>= 0.6.4'] <<
48
48
  ['bundler', '>= 1.0.7'] <<
49
- ['hoe-bundler', '>= 1.0.0'] <<
50
- ['hoe-yard', '>= 0.1.2']
49
+ ['hoe-bundler', '>= 1.0.0']
50
+
51
+ unless extra_dev_deps.flatten.include?('hoe-yard')
52
+ extra_dev_deps << ['hoe-yard', '>= 0.1.2']
53
+ end
51
54
  end
52
55
 
53
56
  task 'Manifest.txt' do
@@ -14,15 +14,15 @@ module I18n
14
14
  # @private
15
15
  EMAIL = 'pw@gnu.org'
16
16
  # @private
17
- VERSION = '2.0.0'
17
+ VERSION = '2.0.1'
18
18
  # @private
19
19
  NAME = 'i18n-inflector'
20
20
  # @private
21
- SUMMARY = 'Simple Inflector backend module for I18n'
21
+ SUMMARY = 'Simple inflection module for I18n'
22
22
  # @private
23
23
  URL = 'https://rubygems.org/gems/i18n-inflector/'
24
24
  # @private
25
- DESCRIPTION = 'This backend module for I18n inflects translations using pattern interpolation.'
25
+ DESCRIPTION = 'Enhances simple I18n backend so that it inflects translations using pattern interpolation.'
26
26
 
27
27
  end
28
28
  end
data.tar.gz.sig CHANGED
@@ -1,2 +1,4 @@
1
- γ�����*E��d��������}&ˆ�.� ����+—i�@��5#q'4e��VBbl���h�Ţx��0�G�������<���,A��
2
- /ǩXn�?75q
1
+ FF���{({vI��Y�����?��R�-z��Kl
2
+ 0�� :��-��W@ )�IFW2 Ԭ��� ���BZ�[#��P4����i�h��m��g�M�Q�b�; X k
3
+ yJG>+�����gC�S��b4�ri�
4
+ D+.$+֤俆RP���
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 2
7
7
  - 0
8
- - 0
9
- version: 2.0.0
8
+ - 1
9
+ version: 2.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - "Pawe\xC5\x82 Wilk"
@@ -34,7 +34,7 @@ cert_chain:
34
34
  NK3TIZaPCh1S2/ES6wXNvjQ+5EnEEL9j/pSEop9DYEBPaM2WDVR5i0jJTAaRWw==
35
35
  -----END CERTIFICATE-----
36
36
 
37
- date: 2011-01-14 00:00:00 +01:00
37
+ date: 2011-01-15 00:00:00 +01:00
38
38
  default_executable:
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
@@ -127,24 +127,9 @@ dependencies:
127
127
  type: :development
128
128
  prerelease: false
129
129
  version_requirements: *id006
130
- - !ruby/object:Gem::Dependency
131
- name: hoe-yard
132
- requirement: &id007 !ruby/object:Gem::Requirement
133
- none: false
134
- requirements:
135
- - - ">="
136
- - !ruby/object:Gem::Version
137
- segments:
138
- - 0
139
- - 1
140
- - 2
141
- version: 0.1.2
142
- type: :development
143
- prerelease: false
144
- version_requirements: *id007
145
130
  - !ruby/object:Gem::Dependency
146
131
  name: hoe
147
- requirement: &id008 !ruby/object:Gem::Requirement
132
+ requirement: &id007 !ruby/object:Gem::Requirement
148
133
  none: false
149
134
  requirements:
150
135
  - - ">="
@@ -156,8 +141,8 @@ dependencies:
156
141
  version: 2.8.0
157
142
  type: :development
158
143
  prerelease: false
159
- version_requirements: *id008
160
- description: This backend module for I18n inflects translations using pattern interpolation.
144
+ version_requirements: *id007
145
+ description: Enhances simple I18n backend so that it inflects translations using pattern interpolation.
161
146
  email:
162
147
  - pw@gnu.org
163
148
  executables: []
@@ -209,7 +194,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
209
194
  requirements:
210
195
  - - ">="
211
196
  - !ruby/object:Gem::Version
212
- hash: -4381976785279493702
197
+ hash: -2908677002477829649
213
198
  segments:
214
199
  - 0
215
200
  version: "0"
@@ -218,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
203
  requirements:
219
204
  - - ">="
220
205
  - !ruby/object:Gem::Version
221
- hash: -4381976785279493702
206
+ hash: -2908677002477829649
222
207
  segments:
223
208
  - 0
224
209
  version: "0"
@@ -228,6 +213,6 @@ rubyforge_project: i18n-inflector
228
213
  rubygems_version: 1.3.7
229
214
  signing_key:
230
215
  specification_version: 3
231
- summary: Simple Inflector backend module for I18n
216
+ summary: Simple inflection module for I18n
232
217
  test_files:
233
218
  - test/inflector_test.rb
metadata.gz.sig CHANGED
Binary file