tr8n_client_sdk 4.1.1 → 4.1.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 +1 -1
- data/Rakefile +0 -16
- data/lib/tasks/tr8n_client_sdk.rake +9 -1
- data/lib/tr8n_client_sdk/engine.rb +9 -1
- data/lib/tr8n_client_sdk/extensions/action_common_methods.rb +10 -2
- data/lib/tr8n_client_sdk/extensions/action_controller_extension.rb +9 -9
- data/lib/tr8n_client_sdk/extensions/action_view_extension.rb +18 -1
- data/lib/tr8n_client_sdk/railtie.rb +9 -1
- data/lib/tr8n_client_sdk/version.rb +10 -3
- data/lib/tr8n_client_sdk.rb +9 -1
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14deb8e0f333e52babb38244769c2e273c22ca1d
|
4
|
+
data.tar.gz: 1d6dcf211cd1fbd03ed5be570a7ee50fee445f1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ed42b62cd2c8f9da257d5f810c41851a30d9a616cad917fc832036f98e0acedcf2866f797a2d453e9d444bddb9e3b9c4d2244ebbead91ef54e61d5ec7213f3f
|
7
|
+
data.tar.gz: c012cb92eb7f0f920bf6c04f76d4487995556e84e59ba48c43f3c3e76a4a2820429ca971c5e738c11ab6e76d0c3d512a3020ddbec2b0e8e56d39f44259a4e3b1
|
data/README.md
CHANGED
@@ -7,7 +7,7 @@ Tr8n Client SDK for Ruby on Rails
|
|
7
7
|
[![Build Status](https://travis-ci.org/tr8n/tr8n_rails_clientsdk.png?branch=master)](https://travis-ci.org/tr8n/tr8n_rails_clientsdk)
|
8
8
|
[![Coverage Status](https://coveralls.io/repos/tr8n/tr8n_rails_clientsdk/badge.png)](https://coveralls.io/r/tr8n/tr8n_rails_clientsdk)
|
9
9
|
[![Gem Version](https://badge.fury.io/rb/tr8n_client_sdk.png)](http://badge.fury.io/rb/tr8n_client_sdk)
|
10
|
-
[![Dependency Status](https://www.versioneye.com/user/projects/
|
10
|
+
[![Dependency Status](https://www.versioneye.com/user/projects/53cda6a5225426f1e8000165/badge.svg?style=flat)](https://www.versioneye.com/user/projects/53cda6a5225426f1e8000165)
|
11
11
|
[![Project status](http://stillmaintained.com/tr8n/tr8n_ruby_core.png)](http://stillmaintained.com/tr8n/tr8n_ruby_core.png)
|
12
12
|
|
13
13
|
This Client SDK provides extensions necessary for translating Rails based application using the Tr8nHub service.
|
data/Rakefile
CHANGED
@@ -21,22 +21,6 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
21
21
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
22
22
|
end
|
23
23
|
|
24
|
-
#APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
25
|
-
#load 'rails/tasks/engine.rake'
|
26
|
-
#
|
27
|
-
#Dir["#{File.dirname(__FILE__)}/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
|
28
|
-
#
|
29
|
-
#Bundler::GemHelper.install_tasks
|
30
|
-
#
|
31
|
-
#require 'rake/testtask'
|
32
|
-
#
|
33
|
-
#Rake::TestTask.new(:test) do |t|
|
34
|
-
# t.libs << 'lib'
|
35
|
-
# t.libs << 'test'
|
36
|
-
# t.pattern = 'test/**/*_test.rb'
|
37
|
-
# t.verbose = false
|
38
|
-
#end
|
39
|
-
|
40
24
|
Dir["#{File.dirname(__FILE__)}/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
|
41
25
|
|
42
26
|
require 'rspec/core/rake_task'
|
@@ -1,6 +1,14 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c)
|
2
|
+
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
3
3
|
#
|
4
|
+
# _______ _ _ _ ______ _
|
5
|
+
# |__ __| | | | | (_) | ____| | |
|
6
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
7
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
8
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
9
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
10
|
+
# __/ |
|
11
|
+
# |___/
|
4
12
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
13
|
# a copy of this software and associated documentation files (the
|
6
14
|
# "Software"), to deal in the Software without restriction, including
|
@@ -1,6 +1,14 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c)
|
2
|
+
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
3
3
|
#
|
4
|
+
# _______ _ _ _ ______ _
|
5
|
+
# |__ __| | | | | (_) | ____| | |
|
6
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
7
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
8
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
9
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
10
|
+
# __/ |
|
11
|
+
# |___/
|
4
12
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
13
|
# a copy of this software and associated documentation files (the
|
6
14
|
# "Software"), to deal in the Software without restriction, including
|
@@ -1,6 +1,14 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c)
|
2
|
+
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
3
3
|
#
|
4
|
+
# _______ _ _ _ ______ _
|
5
|
+
# |__ __| | | | | (_) | ____| | |
|
6
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
7
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
8
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
9
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
10
|
+
# __/ |
|
11
|
+
# |___/
|
4
12
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
13
|
# a copy of this software and associated documentation files (the
|
6
14
|
# "Software"), to deal in the Software without restriction, including
|
@@ -32,7 +40,7 @@ module Tr8nClientSdk
|
|
32
40
|
# or
|
33
41
|
# tr(:label => label, :description => "", :tokens => {}, :options => {})
|
34
42
|
############################################################
|
35
|
-
def tr(label, description =
|
43
|
+
def tr(label, description = '', tokens = {}, options = {})
|
36
44
|
return label.html_safe if label.tr8n_translated?
|
37
45
|
|
38
46
|
params = Tr8n::Utils.normalize_tr_params(label, description, tokens, options)
|
@@ -1,6 +1,14 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c)
|
2
|
+
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
3
3
|
#
|
4
|
+
# _______ _ _ _ ______ _
|
5
|
+
# |__ __| | | | | (_) | ____| | |
|
6
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
7
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
8
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
9
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
10
|
+
# __/ |
|
11
|
+
# |___/
|
4
12
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
13
|
# a copy of this software and associated documentation files (the
|
6
14
|
# "Software"), to deal in the Software without restriction, including
|
@@ -76,7 +84,6 @@ module Tr8nClientSdk
|
|
76
84
|
def tr8n_init_client_sdk
|
77
85
|
return if Tr8n.config.disabled?
|
78
86
|
|
79
|
-
Tr8n.logger.info("Initializing request...")
|
80
87
|
@tr8n_started_at = Time.now
|
81
88
|
|
82
89
|
Tr8n.session.init
|
@@ -85,13 +92,10 @@ module Tr8nClientSdk
|
|
85
92
|
|
86
93
|
cookie_name = "tr8n_#{tr8n_application.key}"
|
87
94
|
if request.cookies[cookie_name]
|
88
|
-
Tr8n.logger.info("Cookie exists:")
|
89
95
|
cookie_params = Tr8n::Utils.decode_and_verify_params(request.cookies[cookie_name], tr8n_application.secret)
|
90
96
|
Tr8n.logger.info(cookie_params.inspect)
|
91
97
|
locale = cookie_params["locale"]
|
92
98
|
translator = Tr8n::Translator.new(cookie_params["translator"].merge(:application => tr8n_application)) unless cookie_params["translator"].nil?
|
93
|
-
else
|
94
|
-
Tr8n.logger.info("Cookie does not exist")
|
95
99
|
end
|
96
100
|
|
97
101
|
locale ||= tr8n_init_current_locale || Tr8n.config.default_locale
|
@@ -105,13 +109,9 @@ module Tr8nClientSdk
|
|
105
109
|
|
106
110
|
def tr8n_reset_client_sdk
|
107
111
|
return if Tr8n.config.disabled?
|
108
|
-
|
109
112
|
@tr8n_finished_at = Time.now
|
110
|
-
|
111
|
-
Tr8n.logger.info("Resetting request...")
|
112
113
|
tr8n_application.submit_missing_keys
|
113
114
|
Tr8n.session.reset
|
114
|
-
|
115
115
|
Tr8n.logger.info("Request took #{@tr8n_finished_at - @tr8n_started_at} mls") if @tr8n_started_at
|
116
116
|
end
|
117
117
|
|
@@ -1,6 +1,14 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c)
|
2
|
+
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
3
3
|
#
|
4
|
+
# _______ _ _ _ ______ _
|
5
|
+
# |__ __| | | | | (_) | ____| | |
|
6
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
7
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
8
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
9
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
10
|
+
# __/ |
|
11
|
+
# |___/
|
4
12
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
13
|
# a copy of this software and associated documentation files (the
|
6
14
|
# "Software"), to deal in the Software without restriction, including
|
@@ -25,6 +33,15 @@ module Tr8nClientSdk
|
|
25
33
|
module ActionViewExtension
|
26
34
|
extend ActiveSupport::Concern
|
27
35
|
|
36
|
+
def trh(tokens = {}, options = {}, &block)
|
37
|
+
return '' unless block_given?
|
38
|
+
|
39
|
+
label = capture(&block)
|
40
|
+
|
41
|
+
tokenizer = Tr8n::Tokenizers::Dom.new(tokens, options)
|
42
|
+
tokenizer.translate(label).html_safe
|
43
|
+
end
|
44
|
+
|
28
45
|
def tr8n_options_for_select(options, selected = nil, description = nil, lang = Tr8n.session.current_language)
|
29
46
|
options_for_select(options.tro(description), selected)
|
30
47
|
end
|
@@ -1,6 +1,14 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2014 Michael Berkovich,
|
2
|
+
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
3
3
|
#
|
4
|
+
# _______ _ _ _ ______ _
|
5
|
+
# |__ __| | | | | (_) | ____| | |
|
6
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
7
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
8
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
9
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
10
|
+
# __/ |
|
11
|
+
# |___/
|
4
12
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
13
|
# a copy of this software and associated documentation files (the
|
6
14
|
# "Software"), to deal in the Software without restriction, including
|
@@ -1,6 +1,14 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c)
|
2
|
+
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
3
3
|
#
|
4
|
+
# _______ _ _ _ ______ _
|
5
|
+
# |__ __| | | | | (_) | ____| | |
|
6
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
7
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
8
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
9
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
10
|
+
# __/ |
|
11
|
+
# |___/
|
4
12
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
13
|
# a copy of this software and associated documentation files (the
|
6
14
|
# "Software"), to deal in the Software without restriction, including
|
@@ -21,7 +29,6 @@
|
|
21
29
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
30
|
#++
|
23
31
|
|
24
|
-
|
25
32
|
module Tr8nClientSdk
|
26
|
-
VERSION = "4.1.
|
33
|
+
VERSION = "4.1.3"
|
27
34
|
end
|
data/lib/tr8n_client_sdk.rb
CHANGED
@@ -1,6 +1,14 @@
|
|
1
1
|
#--
|
2
|
-
# Copyright (c) 2014 Michael Berkovich,
|
2
|
+
# Copyright (c) 2014 Michael Berkovich, TranslationExchange.com
|
3
3
|
#
|
4
|
+
# _______ _ _ _ ______ _
|
5
|
+
# |__ __| | | | | (_) | ____| | |
|
6
|
+
# | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
|
7
|
+
# | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
|
8
|
+
# | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
|
9
|
+
# |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
|
10
|
+
# __/ |
|
11
|
+
# |___/
|
4
12
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
13
|
# a copy of this software and associated documentation files (the
|
6
14
|
# "Software"), to deal in the Software without restriction, including
|
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.1.
|
4
|
+
version: 4.1.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: 2014-
|
11
|
+
date: 2014-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.1
|
19
|
+
version: '4.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.1
|
26
|
+
version: '4.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: tr8n_core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 4.0
|
33
|
+
version: '4.0'
|
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'
|
41
41
|
description: Client SDK for Tr8n translation engine.
|
42
42
|
email:
|
43
43
|
- michael@tr8nhub.com
|
@@ -45,22 +45,22 @@ executables: []
|
|
45
45
|
extensions: []
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
|
+
- LICENSE
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
48
51
|
- app/views/tr8n_client_sdk/tags/_language_selector.html.erb
|
49
52
|
- app/views/tr8n_client_sdk/tags/_language_strip.html.erb
|
50
53
|
- app/views/tr8n_client_sdk/tags/_powered_by_tr8n.html.erb
|
51
54
|
- app/views/tr8n_client_sdk/tags/_scripts.html.erb
|
52
55
|
- config/routes.rb
|
53
56
|
- lib/tasks/tr8n_client_sdk.rake
|
57
|
+
- lib/tr8n_client_sdk.rb
|
54
58
|
- lib/tr8n_client_sdk/engine.rb
|
55
59
|
- lib/tr8n_client_sdk/extensions/action_common_methods.rb
|
56
60
|
- lib/tr8n_client_sdk/extensions/action_controller_extension.rb
|
57
61
|
- lib/tr8n_client_sdk/extensions/action_view_extension.rb
|
58
62
|
- lib/tr8n_client_sdk/railtie.rb
|
59
63
|
- lib/tr8n_client_sdk/version.rb
|
60
|
-
- lib/tr8n_client_sdk.rb
|
61
|
-
- LICENSE
|
62
|
-
- Rakefile
|
63
|
-
- README.md
|
64
64
|
homepage: https://github.com/tr8n/tr8n_rails_clientsdk
|
65
65
|
licenses:
|
66
66
|
- MIT-LICENSE
|
@@ -81,8 +81,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.
|
84
|
+
rubygems_version: 2.4.1
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: Tr8n Client SDK for Ruby on Rails
|
88
88
|
test_files: []
|
89
|
+
has_rdoc:
|