tr8n_client_sdk 4.0.2 → 4.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +30 -2
- data/app/views/tr8n_client_sdk/tags/_scripts.html.erb +9 -22
- data/lib/tr8n_client_sdk/extensions/action_common_methods.rb +4 -3
- data/lib/tr8n_client_sdk/extensions/action_controller_extension.rb +2 -2
- data/lib/tr8n_client_sdk/extensions/action_view_extension.rb +5 -0
- data/lib/tr8n_client_sdk/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bd47d6a7e150ca61959d010bed7a5e5fce2986f
|
4
|
+
data.tar.gz: 14cf895ed96d97eb42bd5cdbc19d6ee1716a5f71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 056e464b458b15337792a6afb10238b0eb6b93dbe12ed3fc03b95d4e475e63a5dfe79ac62182c98072b53795bb62f4e4256b5c8e457fa826de6c186e27bd1e80
|
7
|
+
data.tar.gz: 08272d63b4d2b94471d3f8ca20899195e859fcd1d81d27fcb3f88fd28d13915d348e2208052c020db71d607f8be9b2121c480925bbe716f1ad2e29435a93fcc5
|
data/README.md
CHANGED
@@ -37,6 +37,24 @@ This application is running at:
|
|
37
37
|
http://rails.tr8nhub.com
|
38
38
|
|
39
39
|
|
40
|
+
Another sample application that uses this SDK is available here:
|
41
|
+
|
42
|
+
https://github.com/tr8n/tr8n_samples_bookface_rails
|
43
|
+
|
44
|
+
Install it and see how it works.
|
45
|
+
|
46
|
+
|
47
|
+
Registering Your App on Tr8nHub.com
|
48
|
+
===================================
|
49
|
+
|
50
|
+
Before you can proceed with the integration, please visit http://tr8nhub.com register as a user and create a new application.
|
51
|
+
|
52
|
+
Once you have created a new application, go to the security tab in the application administration section and copy your application key and secret.
|
53
|
+
|
54
|
+
<img src="http://wiki.tr8nhub.com/images/thumb/f/f7/Application_Settings.png/800px-Application_Settings.png">
|
55
|
+
|
56
|
+
You will need to enter them in the initialization function of the Tr8n SDK.
|
57
|
+
|
40
58
|
|
41
59
|
Integration Instructions
|
42
60
|
===================================
|
@@ -194,7 +212,17 @@ If you need to adjust those method names, you can set them in the config:
|
|
194
212
|
|
195
213
|
|
196
214
|
|
215
|
+
Where can I get more information?
|
216
|
+
==================
|
217
|
+
|
218
|
+
* Register on Tr8nHub.com: https://tr8nhub.com
|
219
|
+
|
220
|
+
* Read Tr8nHub's documentation: http://wiki.tr8nhub.com
|
221
|
+
|
222
|
+
* Visit Tr8nHub's blog: http://blog.tr8nhub.com
|
223
|
+
|
224
|
+
* Follow Tr8nHub on Twitter: https://twitter.com/Tr8nHub
|
197
225
|
|
198
|
-
|
226
|
+
* Connect with Tr8nHub on Facebook: https://www.facebook.com/pages/tr8nhubcom/138407706218622
|
199
227
|
|
200
|
-
|
228
|
+
* If you have any questions or suggestions, contact us: feedback@tr8nhub.com
|
@@ -19,24 +19,14 @@
|
|
19
19
|
function tr8n_add_css(doc, value, inline) {
|
20
20
|
var css = null;
|
21
21
|
if (inline) {
|
22
|
-
css = doc.createElement('style');
|
23
|
-
css.
|
24
|
-
|
25
|
-
css.styleSheet.cssText = value;
|
26
|
-
} else {
|
27
|
-
css.appendChild(document.createTextNode(value));
|
28
|
-
}
|
22
|
+
css = doc.createElement('style'); css.type = 'text/css';
|
23
|
+
if (css.styleSheet) css.styleSheet.cssText = value;
|
24
|
+
else css.appendChild(document.createTextNode(value));
|
29
25
|
} else {
|
30
|
-
css = doc.createElement('link');
|
31
|
-
css.setAttribute('
|
32
|
-
css.setAttribute('
|
33
|
-
css.setAttribute('
|
34
|
-
|
35
|
-
if (value.indexOf('//') != -1) {
|
36
|
-
css.setAttribute('href', value);
|
37
|
-
} else {
|
38
|
-
css.setAttribute('href', '<%= tr8n_application.host %>' + value);
|
39
|
-
}
|
26
|
+
css = doc.createElement('link'); css.setAttribute('type', 'text/css');
|
27
|
+
css.setAttribute('rel', 'stylesheet'); css.setAttribute('media', 'screen');
|
28
|
+
if (value.indexOf('//') != -1) css.setAttribute('href', value);
|
29
|
+
else css.setAttribute('href', '<%= tr8n_application.host %>' + value);
|
40
30
|
}
|
41
31
|
doc.getElementsByTagName('head')[0].appendChild(css);
|
42
32
|
return css;
|
@@ -46,11 +36,8 @@
|
|
46
36
|
var script = doc.createElement('script');
|
47
37
|
script.setAttribute('id', id);
|
48
38
|
script.setAttribute('type', 'application/javascript');
|
49
|
-
if (src.indexOf('//') != -1)
|
50
|
-
|
51
|
-
} else {
|
52
|
-
script.setAttribute('src', '<%= tr8n_application.host %>' + src);
|
53
|
-
}
|
39
|
+
if (src.indexOf('//') != -1) script.setAttribute('src', src);
|
40
|
+
else script.setAttribute('src', '<%= tr8n_application.host %>' + src);
|
54
41
|
script.setAttribute('charset', 'UTF-8');
|
55
42
|
if (onload) script.onload = onload;
|
56
43
|
doc.getElementsByTagName('head')[0].appendChild(script);
|
@@ -44,7 +44,7 @@ module Tr8nClientSdk
|
|
44
44
|
end
|
45
45
|
|
46
46
|
if Tr8n.config.disabled?
|
47
|
-
return Tr8n
|
47
|
+
return Tr8n.config.default_language.translate(params[:label], params[:tokens], params[:options]).tr8n_translated.html_safe
|
48
48
|
end
|
49
49
|
|
50
50
|
# Translate individual sentences
|
@@ -59,8 +59,9 @@ module Tr8nClientSdk
|
|
59
59
|
|
60
60
|
tr8n_current_language.translate(params).tr8n_translated.html_safe
|
61
61
|
rescue Tr8n::Exception => ex
|
62
|
-
|
63
|
-
Tr8n
|
62
|
+
#pp ex, ex.backtrace
|
63
|
+
Tr8n.logger.error(ex.message)
|
64
|
+
#Tr8n.logger.error(ex.message + "\n=> " + ex.backtrace.join("\n=> "))
|
64
65
|
label
|
65
66
|
end
|
66
67
|
|
@@ -74,7 +74,7 @@ module Tr8nClientSdk
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def tr8n_init_client_sdk
|
77
|
-
return if Tr8n.config.disabled?
|
77
|
+
return if Tr8n.config.disabled?
|
78
78
|
|
79
79
|
Tr8n.logger.info("Initializing request...")
|
80
80
|
@tr8n_started_at = Time.now
|
@@ -104,7 +104,7 @@ module Tr8nClientSdk
|
|
104
104
|
end
|
105
105
|
|
106
106
|
def tr8n_reset_client_sdk
|
107
|
-
return if
|
107
|
+
return if Tr8n.config.disabled?
|
108
108
|
|
109
109
|
@tr8n_finished_at = Time.now
|
110
110
|
|
@@ -67,6 +67,7 @@ module Tr8nClientSdk
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def tr8n_language_selector_tag(opts = {})
|
70
|
+
return unless Tr8n.config.enabled?
|
70
71
|
render(:partial => '/tr8n_client_sdk/tags/language_selector', :locals => {:opts => opts})
|
71
72
|
end
|
72
73
|
|
@@ -137,6 +138,10 @@ module Tr8nClientSdk
|
|
137
138
|
time.tr(:monthname_abbr_year_time).gsub('/ ', '/').sub(/^[0:]*/,"")
|
138
139
|
end
|
139
140
|
end
|
141
|
+
|
142
|
+
def tr8n_url_tag(path)
|
143
|
+
tr8n_application.url_for(path)
|
144
|
+
end
|
140
145
|
|
141
146
|
######################################################################
|
142
147
|
## Language Direction Support
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tr8n_client_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Berkovich
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 4.0.
|
33
|
+
version: 4.0.6
|
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.
|
40
|
+
version: 4.0.6
|
41
41
|
description: Client SDK for Tr8n translation engine.
|
42
42
|
email:
|
43
43
|
- michael@tr8nhub.com
|