i18n-inflector 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +12 -0
- data/Gemfile +0 -1
- data/README.rdoc +45 -14
- data/Rakefile +5 -2
- data/lib/i18n-inflector/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +7 -22
- metadata.gz.sig +0 -0
data/ChangeLog
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
commit d8aedac664b622abd120e6b00f4de63b060fa887
|
2
|
+
Author: Paweł Wilk <siefca@gnu.org>
|
3
|
+
Date: Sat Jan 15 15:01:05 2011 +0100
|
4
|
+
|
5
|
+
Compatibility release 1.0.11
|
6
|
+
|
7
|
+
commit e5390e53a44e610883d818d8230515157df5e6a8
|
8
|
+
Author: Paweł Wilk <siefca@gnu.org>
|
9
|
+
Date: Sat Jan 15 14:58:30 2011 +0100
|
10
|
+
|
11
|
+
Fixed doco and Rakefile
|
12
|
+
|
1
13
|
commit dc81afa48b36336b9efde0ce9019637edc0474f8
|
2
14
|
Author: Paweł Wilk <siefca@gnu.org>
|
3
15
|
Date: Mon Jan 10 04:23:49 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
@@ -8,26 +8,52 @@
|
|
8
8
|
* https://github.com/siefca/i18n-inflector/tree
|
9
9
|
* mailto:pw@gnu.org
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
11
|
+
This library contains a backend module for I18n that adds some extra
|
12
|
+
functionality to standard backend. It overwrites the translate method
|
13
|
+
so that it will interpolate additional inflection tokens present in
|
14
|
+
translations. These tokens may appear in *patterns* which are contained
|
15
|
+
within <tt>@{</tt> and <tt>}</tt> symbols. Configuration is stored
|
16
|
+
also in translation data, in a scope <tt><locale>.i18n.inflections</tt>,
|
17
|
+
where <tt>locale</tt> is a locale subtree.
|
18
18
|
|
19
19
|
You can choose different kinds (gender, title, person, time, author, etc.)
|
20
20
|
of tokens to group them in a meaningful, semantical sets. That means you can
|
21
21
|
apply Inflector to do simple inflection by a gender or a person, when some
|
22
22
|
language requires it.
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
It adds the +inflector+ object to the default backend so you can use many
|
25
|
+
methods for accessing loaded inflection data at runtime, or set up global
|
26
|
+
switches that are controlling the engine.
|
27
|
+
|
28
|
+
Example translation data:
|
29
|
+
|
30
|
+
en:
|
31
|
+
i18n:
|
32
|
+
inflections:
|
33
|
+
gender:
|
34
|
+
f: "female"
|
35
|
+
m: "male"
|
36
|
+
n: "neuter"
|
37
|
+
male: @m
|
38
|
+
female: @f
|
39
|
+
default: neuter
|
40
|
+
|
41
|
+
|
42
|
+
welcome: "Dear {f:Lady|m:Sir|n:You|All}"
|
43
|
+
|
44
|
+
== Why?
|
45
|
+
|
46
|
+
It's intended to be used in a web projects or other projects where
|
47
|
+
translations are performed by many people, yet there is a need to
|
48
|
+
substitute fragments of text depending on user's gender, person or
|
49
|
+
other data.
|
50
|
+
|
51
|
+
To achieve similar functionality lambdas can be used but including
|
52
|
+
proc objects in translations may be considered as unsafe.
|
27
53
|
|
28
54
|
If you have a troop of happy translators that shouldn't have the
|
29
55
|
ability to execute any code yet you need some simple inflection
|
30
|
-
then you
|
56
|
+
then you should use this module.
|
31
57
|
|
32
58
|
== Requirements
|
33
59
|
|
@@ -70,14 +96,14 @@ Detailed example:
|
|
70
96
|
I18n.t('welcome')
|
71
97
|
# => "Dear You"
|
72
98
|
|
73
|
-
I18n.t('welcome', :gender => :
|
99
|
+
I18n.t('welcome', :gender => :m)
|
74
100
|
# => "Dear Sir"
|
75
101
|
|
76
102
|
I18n.t('welcome', :gender => :unknown)
|
77
|
-
# => "Dear
|
103
|
+
# => "Dear You"
|
78
104
|
|
79
105
|
I18n.t('welcome', :gender => nil)
|
80
|
-
# => "Dear
|
106
|
+
# => "Dear You"
|
81
107
|
|
82
108
|
== Tests
|
83
109
|
|
@@ -97,6 +123,11 @@ See {I18n::Backend::Inflector} module documentation for detailed information.
|
|
97
123
|
See {i18n-inflector-rails}[https://rubygems.org/gems/i18n-inflector-rails] if you need
|
98
124
|
the Rails plug-in that integrates this module with ActionController.
|
99
125
|
|
126
|
+
== Credits
|
127
|
+
|
128
|
+
{Heise Media Polska}[http://www.heise-online.pl/] supports Free Software and has
|
129
|
+
contributed to this library by paying for me to eat when I've been coding.
|
130
|
+
|
100
131
|
== License
|
101
132
|
|
102
133
|
Copyright (c) 2011 by Paweł Wilk.
|
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
|
-
|
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
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 11
|
9
|
+
version: 1.0.11
|
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-
|
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: &
|
132
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
148
133
|
none: false
|
149
134
|
requirements:
|
150
135
|
- - ">="
|
@@ -156,7 +141,7 @@ dependencies:
|
|
156
141
|
version: 2.8.0
|
157
142
|
type: :development
|
158
143
|
prerelease: false
|
159
|
-
version_requirements: *
|
144
|
+
version_requirements: *id007
|
160
145
|
description: This backend module for I18n inflects translations using pattern interpolation.
|
161
146
|
email:
|
162
147
|
- pw@gnu.org
|
@@ -205,7 +190,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
205
190
|
requirements:
|
206
191
|
- - ">="
|
207
192
|
- !ruby/object:Gem::Version
|
208
|
-
hash:
|
193
|
+
hash: 2575214196482507959
|
209
194
|
segments:
|
210
195
|
- 0
|
211
196
|
version: "0"
|
@@ -214,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
199
|
requirements:
|
215
200
|
- - ">="
|
216
201
|
- !ruby/object:Gem::Version
|
217
|
-
hash:
|
202
|
+
hash: 2575214196482507959
|
218
203
|
segments:
|
219
204
|
- 0
|
220
205
|
version: "0"
|
metadata.gz.sig
CHANGED
Binary file
|