tr8n_core 4.0.7 → 4.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/lib/tr8n/api_client.rb +28 -18
- data/lib/tr8n/application.rb +37 -64
- data/lib/tr8n/cache.rb +8 -41
- data/lib/tr8n/cache_adapters/file.rb +1 -2
- data/lib/tr8n/cache_adapters/memcache.rb +2 -2
- data/lib/tr8n/cache_adapters/redis.rb +2 -2
- data/lib/tr8n/config.rb +48 -13
- data/lib/tr8n/decorators/html.rb +3 -10
- data/lib/tr8n/language.rb +25 -112
- data/lib/tr8n/language_case.rb +1 -1
- data/lib/tr8n/session.rb +2 -9
- data/lib/tr8n/source.rb +12 -44
- data/lib/tr8n/{tokens/data_tokenizer.rb → tokenizers/data.rb} +4 -3
- data/lib/tr8n/{tokens/decoration_tokenizer.rb → tokenizers/decoration.rb} +6 -5
- data/lib/tr8n/tokenizers/dom.rb +346 -0
- data/lib/tr8n/tokens/data.rb +15 -22
- data/lib/tr8n/tokens/transform.rb +24 -12
- data/lib/tr8n/translation_key.rb +6 -29
- data/lib/tr8n/utils.rb +5 -0
- data/lib/tr8n_core/version.rb +1 -1
- data/lib/tr8n_core.rb +7 -26
- metadata +30 -100
- data/lib/tr8n/cache_adapters/cdb.rb +0 -87
- data/lib/tr8n/tokens/hidden.rb +0 -57
- data/spec/application_spec.rb +0 -52
- data/spec/base_spec.rb +0 -19
- data/spec/cache/adapters/file_spec.rb +0 -32
- data/spec/cache/adapters/memcache_spec.rb +0 -15
- data/spec/cache/generators/file_generator_spec.rb +0 -30
- data/spec/config_spec.rb +0 -32
- data/spec/decorator_spec.rb +0 -12
- data/spec/decorators/base_spec.rb +0 -14
- data/spec/decorators/default_spec.rb +0 -12
- data/spec/decorators/html_spec.rb +0 -50
- data/spec/ext/array_spec.rb +0 -12
- data/spec/ext/hash_spec.rb +0 -15
- data/spec/ext/string_spec.rb +0 -10
- data/spec/fixtures/application.json +0 -112
- data/spec/fixtures/languages/en-US.json +0 -1424
- data/spec/fixtures/languages/es.json +0 -291
- data/spec/fixtures/languages/ru.json +0 -582
- data/spec/fixtures/translations/ru/basic.json +0 -56
- data/spec/fixtures/translations/ru/counters.json +0 -43
- data/spec/fixtures/translations/ru/genders.json +0 -171
- data/spec/fixtures/translations/ru/last_names.txt +0 -200
- data/spec/fixtures/translations/ru/names.json +0 -1
- data/spec/fixtures/translations/ru/names.txt +0 -458
- data/spec/language_case_rule_spec.rb +0 -57
- data/spec/language_case_spec.rb +0 -58
- data/spec/language_context_rule_spec.rb +0 -75
- data/spec/language_context_spec.rb +0 -333
- data/spec/language_spec.rb +0 -615
- data/spec/logger_spec.rb +0 -15
- data/spec/rules_engine/evaluator_spec.rb +0 -150
- data/spec/rules_engine/parser_spec.rb +0 -31
- data/spec/source_spec.rb +0 -13
- data/spec/spec_helper.rb +0 -101
- data/spec/tokens/data_spec.rb +0 -114
- data/spec/tokens/data_tokenizer_spec.rb +0 -29
- data/spec/tokens/decoration_tokenizer_spec.rb +0 -81
- data/spec/tokens/hidden_spec.rb +0 -24
- data/spec/tokens/method_spec.rb +0 -84
- data/spec/tokens/transform_spec.rb +0 -50
- data/spec/translation_key_spec.rb +0 -96
- data/spec/translation_spec.rb +0 -24
- data/spec/utils_spec.rb +0 -62
@@ -1,291 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"locale":"es",
|
3
|
-
"name":"Español",
|
4
|
-
"english_name":"Spanish",
|
5
|
-
"native_name":"Español",
|
6
|
-
"flag_url":"http://localhost:3000/media/52/47/56/19/6594b760c14053ef4.png",
|
7
|
-
"contexts":{
|
8
|
-
"date":{
|
9
|
-
"keyword":"date",
|
10
|
-
"keys":[
|
11
|
-
"past",
|
12
|
-
"present",
|
13
|
-
"future"
|
14
|
-
],
|
15
|
-
"default_key":"present",
|
16
|
-
"token_expression":"/.*(date|time)(\\d)*$/",
|
17
|
-
"variables":[
|
18
|
-
"@date"
|
19
|
-
],
|
20
|
-
"token_mapping":[
|
21
|
-
"unsupported",
|
22
|
-
"unsupported",
|
23
|
-
{
|
24
|
-
"past":"{$0}",
|
25
|
-
"present":"{$1}",
|
26
|
-
"future":"{$2}"
|
27
|
-
}
|
28
|
-
],
|
29
|
-
"rules":{
|
30
|
-
"future":{
|
31
|
-
"keyword":"future",
|
32
|
-
"description":"{token} is in the past",
|
33
|
-
"conditions":"(< @date (today))",
|
34
|
-
"conditions_expression":[
|
35
|
-
"<",
|
36
|
-
"@date",
|
37
|
-
[
|
38
|
-
"today"
|
39
|
-
]
|
40
|
-
]
|
41
|
-
},
|
42
|
-
"past":{
|
43
|
-
"keyword":"past",
|
44
|
-
"description":"{token} is in the future",
|
45
|
-
"conditions":"(> @date (today))",
|
46
|
-
"conditions_expression":[
|
47
|
-
">",
|
48
|
-
"@date",
|
49
|
-
[
|
50
|
-
"today"
|
51
|
-
]
|
52
|
-
]
|
53
|
-
},
|
54
|
-
"present":{
|
55
|
-
"keyword":"present",
|
56
|
-
"description":"{token} is in the present",
|
57
|
-
"conditions":"(= @date (today))",
|
58
|
-
"conditions_expression":[
|
59
|
-
"=",
|
60
|
-
"@date",
|
61
|
-
[
|
62
|
-
"today"
|
63
|
-
]
|
64
|
-
]
|
65
|
-
}
|
66
|
-
}
|
67
|
-
},
|
68
|
-
"gender":{
|
69
|
-
"keyword":"gender",
|
70
|
-
"keys":[
|
71
|
-
"male",
|
72
|
-
"female",
|
73
|
-
"unknown"
|
74
|
-
],
|
75
|
-
"default_key":"other",
|
76
|
-
"token_expression":"/.*(user|translator|profile|actor|target)(\\d)*$/",
|
77
|
-
"variables":[
|
78
|
-
"@gender"
|
79
|
-
],
|
80
|
-
"token_mapping":[
|
81
|
-
{
|
82
|
-
"other":"{$0}"
|
83
|
-
},
|
84
|
-
{
|
85
|
-
"male":"{$0}",
|
86
|
-
"female":"{$1}",
|
87
|
-
"other":"{$0}/{$1}"
|
88
|
-
},
|
89
|
-
{
|
90
|
-
"male":"{$0}",
|
91
|
-
"female":"{$1}",
|
92
|
-
"other":"{$2}"
|
93
|
-
}
|
94
|
-
],
|
95
|
-
"rules":{
|
96
|
-
"female":{
|
97
|
-
"keyword":"female",
|
98
|
-
"description":"{token} is a female",
|
99
|
-
"conditions":"(= 'female' @gender)",
|
100
|
-
"conditions_expression":[
|
101
|
-
"=",
|
102
|
-
"female",
|
103
|
-
"@gender"
|
104
|
-
]
|
105
|
-
},
|
106
|
-
"male":{
|
107
|
-
"keyword":"male",
|
108
|
-
"description":"{token} is a male",
|
109
|
-
"conditions":"(= 'male' @gender)",
|
110
|
-
"conditions_expression":[
|
111
|
-
"=",
|
112
|
-
"male",
|
113
|
-
"@gender"
|
114
|
-
]
|
115
|
-
},
|
116
|
-
"other":{
|
117
|
-
"keyword":"other",
|
118
|
-
"description":"{token}'s gender is unknown"
|
119
|
-
}
|
120
|
-
}
|
121
|
-
},
|
122
|
-
"genders":{
|
123
|
-
"keyword":"genders",
|
124
|
-
"keys":[
|
125
|
-
"male",
|
126
|
-
"female",
|
127
|
-
"unknown",
|
128
|
-
"other"
|
129
|
-
],
|
130
|
-
"default_key":"other",
|
131
|
-
"token_expression":"/.*(users|profiles|actors|targets)(\\d)*$/",
|
132
|
-
"variables":[
|
133
|
-
"@genders"
|
134
|
-
],
|
135
|
-
"token_mapping":[
|
136
|
-
"unsupported",
|
137
|
-
"unsupported",
|
138
|
-
"unsupported",
|
139
|
-
{
|
140
|
-
"male":"{$0}",
|
141
|
-
"female":"{$1}",
|
142
|
-
"unknown":"{$2}",
|
143
|
-
"other":"{$3}"
|
144
|
-
}
|
145
|
-
],
|
146
|
-
"rules":{
|
147
|
-
"female":{
|
148
|
-
"keyword":"female",
|
149
|
-
"description":"{token} contains 1 female",
|
150
|
-
"conditions":"(&& (= 1 (count @genders)) (all @genders 'female'))",
|
151
|
-
"conditions_expression":[
|
152
|
-
"&&",
|
153
|
-
[
|
154
|
-
"=",
|
155
|
-
1,
|
156
|
-
[
|
157
|
-
"count",
|
158
|
-
"@genders"
|
159
|
-
]
|
160
|
-
],
|
161
|
-
[
|
162
|
-
"all",
|
163
|
-
"@genders",
|
164
|
-
"female"
|
165
|
-
]
|
166
|
-
]
|
167
|
-
},
|
168
|
-
"male":{
|
169
|
-
"keyword":"male",
|
170
|
-
"description":"{token} contains 1 male",
|
171
|
-
"conditions":"(&& (= 1 (count @genders)) (all @genders 'male'))",
|
172
|
-
"conditions_expression":[
|
173
|
-
"&&",
|
174
|
-
[
|
175
|
-
"=",
|
176
|
-
1,
|
177
|
-
[
|
178
|
-
"count",
|
179
|
-
"@genders"
|
180
|
-
]
|
181
|
-
],
|
182
|
-
[
|
183
|
-
"all",
|
184
|
-
"@genders",
|
185
|
-
"male"
|
186
|
-
]
|
187
|
-
]
|
188
|
-
},
|
189
|
-
"other":{
|
190
|
-
"keyword":"other",
|
191
|
-
"description":"{token} contains at least 2 people"
|
192
|
-
},
|
193
|
-
"unknown":{
|
194
|
-
"keyword":"unknown",
|
195
|
-
"description":"{token} contains 1 person with unknown gender",
|
196
|
-
"conditions":"(&& (= 1 (count @genders)) (all @genders 'unknown'))",
|
197
|
-
"conditions_expression":[
|
198
|
-
"&&",
|
199
|
-
[
|
200
|
-
"=",
|
201
|
-
1,
|
202
|
-
[
|
203
|
-
"count",
|
204
|
-
"@genders"
|
205
|
-
]
|
206
|
-
],
|
207
|
-
[
|
208
|
-
"all",
|
209
|
-
"@genders",
|
210
|
-
"unknown"
|
211
|
-
]
|
212
|
-
]
|
213
|
-
}
|
214
|
-
}
|
215
|
-
},
|
216
|
-
"list":{
|
217
|
-
"keyword":"list",
|
218
|
-
"keys":[
|
219
|
-
"one",
|
220
|
-
"other"
|
221
|
-
],
|
222
|
-
"default_key":"other",
|
223
|
-
"token_expression":"/.*(items|list)(\\d)*$/",
|
224
|
-
"variables":[
|
225
|
-
"@count"
|
226
|
-
],
|
227
|
-
"token_mapping":[
|
228
|
-
"unsupported",
|
229
|
-
{
|
230
|
-
"one":"{$0}",
|
231
|
-
"other":"{$1}"
|
232
|
-
}
|
233
|
-
],
|
234
|
-
"rules":{
|
235
|
-
"one":{
|
236
|
-
"keyword":"one",
|
237
|
-
"description":"{token} contains 1 element",
|
238
|
-
"conditions":"(= 1 @count)",
|
239
|
-
"conditions_expression":[
|
240
|
-
"=",
|
241
|
-
1,
|
242
|
-
"@count"
|
243
|
-
]
|
244
|
-
},
|
245
|
-
"other":{
|
246
|
-
"keyword":"other",
|
247
|
-
"description":"{token} contains at least 2 elements"
|
248
|
-
}
|
249
|
-
}
|
250
|
-
},
|
251
|
-
"number":{
|
252
|
-
"keyword":"number",
|
253
|
-
"keys":[
|
254
|
-
"one",
|
255
|
-
"other"
|
256
|
-
],
|
257
|
-
"default_key":"other",
|
258
|
-
"token_expression":"/.*(count|num|minutes|seconds|hours|sum|total)(\\d)*$/",
|
259
|
-
"variables":[
|
260
|
-
"@n"
|
261
|
-
],
|
262
|
-
"token_mapping":[
|
263
|
-
"unsupported",
|
264
|
-
{
|
265
|
-
"one":"{$0}",
|
266
|
-
"other":"{$1}"
|
267
|
-
}
|
268
|
-
],
|
269
|
-
"rules":{
|
270
|
-
"one":{
|
271
|
-
"keyword":"one",
|
272
|
-
"description":"{n} is 1",
|
273
|
-
"examples":"1",
|
274
|
-
"conditions":"(= @n 1)",
|
275
|
-
"conditions_expression":[
|
276
|
-
"=",
|
277
|
-
"@n",
|
278
|
-
1
|
279
|
-
]
|
280
|
-
},
|
281
|
-
"other":{
|
282
|
-
"keyword":"other",
|
283
|
-
"examples":"0, 2-999; 1.2, 2.07..."
|
284
|
-
}
|
285
|
-
}
|
286
|
-
}
|
287
|
-
},
|
288
|
-
"cases":{
|
289
|
-
|
290
|
-
}
|
291
|
-
}
|