tml 4.4.2 → 4.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tml/config.rb +102 -86
- data/lib/tml/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44adb9e80172d8023dcf8e7b3919a3be0ff499af
|
4
|
+
data.tar.gz: 08a06206541073c22a546ed0315cd4b4a54d0bc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5208fe912e0d3b62291ae86b544f6048a096d8a681b3dc3ce33ae3dd074ba7bfd3dc9a3fcd5c02bb2cea4485a7864f26c3dc652bac00aef06ba64696d6e5df1f
|
7
|
+
data.tar.gz: d0f6454db79e4efa6bfa929698bdf93ceaa1ef5a80f65f67ac0b481380cc18c6718d36ed6346679ff4319ca3e916e98acc8aaf94f40a33b56d869f42470131b8
|
data/lib/tml/config.rb
CHANGED
@@ -75,19 +75,27 @@ module Tml
|
|
75
75
|
# The class can be extended with a different implementation, as long as the interface is supported
|
76
76
|
class Config
|
77
77
|
# Configuration Attributes
|
78
|
-
attr_accessor :enabled, :
|
78
|
+
attr_accessor :enabled, :locale, :default_level, :format, :application, :context_rules, :logger, :cache, :default_tokens, :localization
|
79
79
|
|
80
80
|
# Used by Rails and Sinatra extensions
|
81
81
|
attr_accessor :current_locale_method, :current_user_method, :translator_options, :i18n_backend
|
82
|
+
attr_accessor :invalidator
|
82
83
|
|
83
84
|
# Used for IRB only
|
84
85
|
attr_accessor :submit_missing_keys_realtime
|
85
86
|
|
86
87
|
def initialize
|
87
88
|
@enabled = true
|
88
|
-
@default_locale = 'en'
|
89
89
|
@default_level = 0
|
90
90
|
@format = :html
|
91
|
+
@subdomains = false
|
92
|
+
|
93
|
+
@locale = {
|
94
|
+
default: 'en',
|
95
|
+
method: 'current_locale',
|
96
|
+
subdomain: false,
|
97
|
+
extension: false
|
98
|
+
}
|
91
99
|
|
92
100
|
# if running from IRB, make it default to TRUE
|
93
101
|
@submit_missing_keys_realtime = (%w(irb pry).include?($0 || ''))
|
@@ -172,82 +180,90 @@ module Tml
|
|
172
180
|
@default_tokens = {
|
173
181
|
:html => {
|
174
182
|
:data => {
|
175
|
-
:ndash =>
|
176
|
-
:mdash =>
|
177
|
-
:iexcl =>
|
178
|
-
:iquest =>
|
179
|
-
:quot =>
|
180
|
-
:ldquo =>
|
181
|
-
:rdquo =>
|
182
|
-
:lsquo =>
|
183
|
-
:rsquo =>
|
184
|
-
:laquo =>
|
185
|
-
:raquo =>
|
186
|
-
:nbsp =>
|
187
|
-
:lsaquo =>
|
188
|
-
:rsaquo =>
|
189
|
-
:br =>
|
190
|
-
:lbrace =>
|
191
|
-
:rbrace =>
|
192
|
-
:trade =>
|
183
|
+
:ndash => '–', # –
|
184
|
+
:mdash => '—', # —
|
185
|
+
:iexcl => '¡', # ¡
|
186
|
+
:iquest => '¿', # ¿
|
187
|
+
:quot => '"', # '
|
188
|
+
:ldquo => '“', # “
|
189
|
+
:rdquo => '”', # ”
|
190
|
+
:lsquo => '‘', # ‘
|
191
|
+
:rsquo => '’', # ’
|
192
|
+
:laquo => '«', # «
|
193
|
+
:raquo => '»', # »
|
194
|
+
:nbsp => ' ', # space
|
195
|
+
:lsaquo => '‹', # ‹
|
196
|
+
:rsaquo => '›', # ›
|
197
|
+
:br => '<br/>', # line break
|
198
|
+
:lbrace => '{',
|
199
|
+
:rbrace => '}',
|
200
|
+
:trade => '™', # TM
|
193
201
|
},
|
194
202
|
:decoration => {
|
195
|
-
:strong =>
|
196
|
-
:bold =>
|
197
|
-
:b =>
|
198
|
-
:em =>
|
199
|
-
:italic =>
|
200
|
-
:i =>
|
203
|
+
:strong => '<strong>{$0}</strong>',
|
204
|
+
:bold => '<strong>{$0}</strong>',
|
205
|
+
:b => '<strong>{$0}</strong>',
|
206
|
+
:em => '<em>{$0}</em>',
|
207
|
+
:italic => '<i>{$0}</i>',
|
208
|
+
:i => '<i>{$0}</i>',
|
201
209
|
:link => "<a href='{$href}'>{$0}</a>",
|
202
|
-
:br =>
|
203
|
-
:strike =>
|
210
|
+
:br => '<br>{$0}',
|
211
|
+
:strike => '<strike>{$0}</strike>',
|
204
212
|
:div => "<div id='{$id}' class='{$class}' style='{$style}'>{$0}</div>",
|
205
213
|
:span => "<span id='{$id}' class='{$class}' style='{$style}'>{$0}</span>",
|
206
|
-
:h1 =>
|
207
|
-
:h2 =>
|
208
|
-
:h3 =>
|
214
|
+
:h1 => '<h1>{$0}</h1>',
|
215
|
+
:h2 => '<h2>{$0}</h2>',
|
216
|
+
:h3 => '<h3>{$0}</h3>',
|
209
217
|
}
|
210
218
|
},
|
211
219
|
:text => {
|
212
220
|
:data => {
|
213
|
-
:ndash =>
|
214
|
-
:mdash =>
|
215
|
-
:iexcl =>
|
216
|
-
:iquest =>
|
217
|
-
:quot => '"
|
218
|
-
:ldquo =>
|
219
|
-
:rdquo =>
|
220
|
-
:lsquo =>
|
221
|
-
:rsquo =>
|
222
|
-
:laquo =>
|
223
|
-
:raquo =>
|
224
|
-
:nbsp =>
|
225
|
-
:lsaquo =>
|
226
|
-
:rsaquo =>
|
227
|
-
:br =>
|
228
|
-
:lbrace =>
|
229
|
-
:rbrace =>
|
230
|
-
:trade =>
|
221
|
+
:ndash => '–',
|
222
|
+
:mdash => '-',
|
223
|
+
:iexcl => '¡',
|
224
|
+
:iquest => '¿',
|
225
|
+
:quot => "'",
|
226
|
+
:ldquo => '“',
|
227
|
+
:rdquo => '”',
|
228
|
+
:lsquo => '‘',
|
229
|
+
:rsquo => '’',
|
230
|
+
:laquo => '«',
|
231
|
+
:raquo => '»',
|
232
|
+
:nbsp => ' ',
|
233
|
+
:lsaquo => '‹',
|
234
|
+
:rsaquo => '›',
|
235
|
+
:br => '\n',
|
236
|
+
:lbrace => '{',
|
237
|
+
:rbrace => '}',
|
238
|
+
:trade => '™',
|
231
239
|
},
|
232
240
|
:decoration => {
|
233
|
-
:strong =>
|
234
|
-
:bold =>
|
235
|
-
:b =>
|
236
|
-
:em =>
|
237
|
-
:italic =>
|
238
|
-
:i =>
|
239
|
-
:link =>
|
240
|
-
:br =>
|
241
|
-
:strike =>
|
242
|
-
:div =>
|
243
|
-
:span =>
|
244
|
-
:h1 =>
|
245
|
-
:h2 =>
|
246
|
-
:h3 =>
|
241
|
+
:strong => '{$0}',
|
242
|
+
:bold => '{$0}',
|
243
|
+
:b => '{$0}',
|
244
|
+
:em => '{$0}',
|
245
|
+
:italic => '{$0}',
|
246
|
+
:i => '{$0}',
|
247
|
+
:link => '{$0}:{$1}',
|
248
|
+
:br => '\n{$0}',
|
249
|
+
:strike => '{$0}',
|
250
|
+
:div => '{$0}',
|
251
|
+
:span => '{$0}',
|
252
|
+
:h1 => '{$0}',
|
253
|
+
:h2 => '{$0}',
|
254
|
+
:h3 => '{$0}',
|
247
255
|
}
|
248
256
|
}
|
249
257
|
}
|
250
258
|
|
259
|
+
@invalidator ||= {
|
260
|
+
enabled: true,
|
261
|
+
path: '/tml/upgrade',
|
262
|
+
auth: lambda do |request|
|
263
|
+
request.params[:access_token] == application[:token]
|
264
|
+
end
|
265
|
+
}
|
266
|
+
|
251
267
|
@localization = {
|
252
268
|
:default_day_names => ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
253
269
|
:default_abbr_day_names => ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
@@ -266,25 +282,25 @@ module Tml
|
|
266
282
|
:date_time => '%m/%d/%Y at %H:%M', # 01/03/1010 at 5:30
|
267
283
|
},
|
268
284
|
:token_mapping => {
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
285
|
+
'%a' => '{short_week_day_name}',
|
286
|
+
'%A' => '{week_day_name}',
|
287
|
+
'%b' => '{short_month_name}',
|
288
|
+
'%B' => '{month_name}',
|
289
|
+
'%p' => '{am_pm}',
|
290
|
+
'%d' => '{days}',
|
291
|
+
'%e' => '{day_of_month}',
|
292
|
+
'%j' => '{year_days}',
|
293
|
+
'%m' => '{months}',
|
294
|
+
'%W' => '{week_num}',
|
295
|
+
'%w' => '{week_days}',
|
296
|
+
'%y' => '{short_years}',
|
297
|
+
'%Y' => '{years}',
|
298
|
+
'%l' => '{trimed_hour}',
|
299
|
+
'%H' => '{full_hours}',
|
300
|
+
'%I' => '{short_hours}',
|
301
|
+
'%M' => '{minutes}',
|
302
|
+
'%S' => '{seconds}',
|
303
|
+
'%s' => '{since_epoch}'
|
288
304
|
}
|
289
305
|
}
|
290
306
|
end
|
@@ -318,16 +334,16 @@ module Tml
|
|
318
334
|
## Application
|
319
335
|
#########################################################
|
320
336
|
|
321
|
-
#def default_locale
|
322
|
-
# return Tml.session.application.default_locale if Tml.session.application
|
323
|
-
# @default_locale
|
324
|
-
#end
|
325
337
|
#
|
326
338
|
#def default_level
|
327
339
|
# return Tml.session.application.default_level if Tml.session.application
|
328
340
|
# @default_level
|
329
341
|
#end
|
330
342
|
|
343
|
+
def default_locale
|
344
|
+
@locale[:default]
|
345
|
+
end
|
346
|
+
|
331
347
|
def default_language
|
332
348
|
@default_language ||= begin
|
333
349
|
file = File.expand_path(File.join(File.dirname(__FILE__), '..', 'tml', 'languages', "#{Tml.config.default_locale}.json"))
|
data/lib/tml/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.4.
|
4
|
+
version: 4.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Berkovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|