tml 5.6.2 → 5.6.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/tml/api/client.rb +11 -1
- data/lib/tml/application.rb +7 -1
- data/lib/tml/config.rb +1 -1
- data/lib/tml/session.rb +1 -1
- 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: 0b28ce58d9d3fe39e6cef50feaa40f95d7c8085b
|
4
|
+
data.tar.gz: 45486d668ce805a7da21a2c68737e8d3cde136dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd3fd07ed74dff0535f06ca7d0c0add72c8e88846d6007980eda941707b82090a2137d151a9b1ca6d2d3693a8f283a34a41bba43f5c102307e017e70efd2ef7f
|
7
|
+
data.tar.gz: b1d30eae76286ae3d64c0ab0c4f3904cf56125098239d86a1b1310bd7ce07958c692e25ad471efe4f1865c010eec7e7f817c21630749f0450d9e1a0bf36dacd0
|
data/README.md
CHANGED
@@ -50,7 +50,10 @@ The library can be invoked from the IRB. To use TML client you must require it,
|
|
50
50
|
|
51
51
|
```ruby
|
52
52
|
irb(main)> require 'tml'
|
53
|
-
irb(main)> app = Tml.session.init(
|
53
|
+
irb(main)> app = Tml.session.init({
|
54
|
+
key: APP_KEY,
|
55
|
+
token: SDK_ACCESS_TOKEN
|
56
|
+
})
|
54
57
|
```
|
55
58
|
|
56
59
|
Now you can use the application to get any language registered with your app:
|
data/lib/tml/api/client.rb
CHANGED
@@ -236,7 +236,17 @@ class Tml::Api::Client < Tml::Base
|
|
236
236
|
# prepares API path
|
237
237
|
def prepare_api_path(path)
|
238
238
|
return path if path.match(/^https?:\/\//)
|
239
|
-
|
239
|
+
clean_path = trim_prepending_slash(path)
|
240
|
+
|
241
|
+
if clean_path.index("v1") == 0 || clean_path.index("v2") == 0
|
242
|
+
"/#{clean_path}"
|
243
|
+
else
|
244
|
+
"#{API_PATH}/#{clean_path}"
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
def trim_prepending_slash(str)
|
249
|
+
str.index("/") == 0 ? str[1..-1] : str
|
240
250
|
end
|
241
251
|
|
242
252
|
# prepares request
|
data/lib/tml/application.rb
CHANGED
@@ -242,7 +242,13 @@ class Tml::Application < Tml::Base
|
|
242
242
|
source.reset_cache
|
243
243
|
end
|
244
244
|
|
245
|
-
|
245
|
+
if Tml.config.disable_async_keys_registration
|
246
|
+
api_client.post('sources/register_keys', {:source_keys => params.to_json})
|
247
|
+
else
|
248
|
+
Thread.new do
|
249
|
+
api_client.post('sources/register_keys', {:source_keys => params.to_json})
|
250
|
+
end
|
251
|
+
end
|
246
252
|
rescue Tml::Exception => e
|
247
253
|
Tml.logger.error('Failed to register missing translation keys...')
|
248
254
|
Tml.logger.error(e)
|
data/lib/tml/config.rb
CHANGED
@@ -75,7 +75,7 @@ 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, :locale, :default_level, :format, :application, :postoffice, :context_rules, :logger, :cache, :default_tokens, :localization
|
78
|
+
attr_accessor :enabled, :locale, :default_level, :format, :application, :postoffice, :context_rules, :logger, :cache, :default_tokens, :localization, :disable_async_keys_registration
|
79
79
|
attr_accessor :auto_init, :source_separator, :domain
|
80
80
|
|
81
81
|
# Used by Rails and Sinatra extensions
|
data/lib/tml/session.rb
CHANGED
@@ -125,7 +125,7 @@ module Tml
|
|
125
125
|
params = Tml::Utils.normalize_tr_params(label, description, tokens, options)
|
126
126
|
return params[:label] if params[:label].tml_translated?
|
127
127
|
|
128
|
-
params[:options][:caller] ||= caller
|
128
|
+
params[:options][:caller] ||= caller(1, 1)
|
129
129
|
|
130
130
|
if Tml.config.disabled?
|
131
131
|
return Tml.config.default_language.translate(params[:label], params[:tokens], params[:options]).tml_translated
|
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: 5.6.
|
4
|
+
version: 5.6.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:
|
11
|
+
date: 2017-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|