tr8n_client_sdk 4.0.1 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7f8925013525f8938a75594e1d5eb16c02c5acd
4
- data.tar.gz: 0886a469ae942bafc104d47a171616c0d80b38c5
3
+ metadata.gz: d2defd5608b2e9c1476f2a93031a8b52e94f705f
4
+ data.tar.gz: bb1008595ce6445b0ffca0a4da20d43fad4f9e65
5
5
  SHA512:
6
- metadata.gz: 6dd77ef8619a5962632926515074a37ef26c31452f7c2301683fc9e70891f5623271ffae9419cbcade8852a896b9318d1c284714bf5d647ad368a3902b3d7f7d
7
- data.tar.gz: a41ab827d15eb401d369e85901f6bd77ef19d2d53f42c568f40a0ea5deb86987cd47358c6dc58a3fc06a38c9254bc8726303eda24842e04e084e90afe4c0b132
6
+ metadata.gz: bc3a5d34310964283249dd86313755a890599094216b848ba075f7658bcc461d503df53ea625ac6b76ee545756d17482550f9276e14ef9bb729b939be7e5ac97
7
+ data.tar.gz: ebda153ddc6ad57fb33e61530a260b966d1566a06eece81306fbda0daa0b7dd767bff5699d1bf60d3dea506690460be211f496904a86d2a992b33688b1c1ed45
@@ -70,11 +70,11 @@ module Tr8nClientSdk
70
70
  def tr8n_init_current_user
71
71
  self.send(Tr8n.config.current_user_method) if Tr8n.config.current_user_method
72
72
  rescue
73
- nil
73
+ Tr8n.config.default_locale
74
74
  end
75
75
 
76
76
  def tr8n_init_client_sdk
77
- return if Tr8n.config.disabled?
77
+ return if Tr8n.config.disabled? or Tr8n.config.application.nil?
78
78
 
79
79
  Tr8n.logger.info("Initializing request...")
80
80
  @tr8n_started_at = Time.now
@@ -94,21 +94,25 @@ module Tr8nClientSdk
94
94
  Tr8n.logger.info("Cookie does not exist")
95
95
  end
96
96
 
97
+ locale ||= tr8n_init_current_locale || Tr8n.config.default_locale
98
+
97
99
  Tr8n.session.current_user = tr8n_init_current_user
98
100
  Tr8n.session.current_translator = translator
99
- Tr8n.session.current_language = tr8n_application.language(locale || tr8n_init_current_locale)
101
+ Tr8n.session.current_language = tr8n_application.language(locale || tr8n_init_current_locale || Tr8n.config.default_locale)
100
102
  Tr8n.session.current_source = tr8n_source
101
103
  Tr8n.session.current_component = tr8n_component
102
104
  end
103
105
 
104
106
  def tr8n_reset_client_sdk
107
+ return if tr8n_application.nil?
108
+
105
109
  @tr8n_finished_at = Time.now
106
110
 
107
111
  Tr8n.logger.info("Resetting request...")
108
112
  tr8n_application.submit_missing_keys
109
113
  Tr8n.session.reset
110
114
 
111
- Tr8n.logger.info("Request took #{@tr8n_finished_at - @tr8n_started_at} mls")
115
+ Tr8n.logger.info("Request took #{@tr8n_finished_at - @tr8n_started_at} mls") if @tr8n_started_at
112
116
  end
113
117
 
114
118
  end
@@ -23,5 +23,5 @@
23
23
 
24
24
 
25
25
  module Tr8nClientSdk
26
- VERSION = "4.0.1"
26
+ VERSION = "4.0.2"
27
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tr8n_client_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.1
4
+ version: 4.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Berkovich
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 4.0.3
33
+ version: 4.0.4
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 4.0.3
40
+ version: 4.0.4
41
41
  description: Client SDK for Tr8n translation engine.
42
42
  email:
43
43
  - michael@tr8nhub.com