tr8n_client_sdk 3.3.1 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,14 +1,6 @@
1
1
  #--
2
- # Copyright (c) 2015 Translation Exchange Inc. http://translationexchange.com
2
+ # Copyright (c) 2014 Michael Berkovich, tr8nhub.com
3
3
  #
4
- # _______ _ _ _ ______ _
5
- # |__ __| | | | | (_) | ____| | |
6
- # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
- # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
- # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
- # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
- # __/ |
11
- # |___/
12
4
  # Permission is hereby granted, free of charge, to any person obtaining
13
5
  # a copy of this software and associated documentation files (the
14
6
  # "Software"), to deal in the Software without restriction, including
@@ -46,7 +38,7 @@ module Tr8nClientSdk
46
38
  end
47
39
  ActiveSupport.on_load(:action_controller) do
48
40
  include Tr8nClientSdk::ActionControllerExtension
49
- end
41
+ end
50
42
  end
51
43
  end
52
44
  end
@@ -1,14 +1,6 @@
1
1
  #--
2
- # Copyright (c) 2015 Translation Exchange Inc. http://translationexchange.com
2
+ # Copyright (c) 2013 Michael Berkovich, tr8nhub.com
3
3
  #
4
- # _______ _ _ _ ______ _
5
- # |__ __| | | | | (_) | ____| | |
6
- # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
- # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
- # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
- # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
- # __/ |
11
- # |___/
12
4
  # Permission is hereby granted, free of charge, to any person obtaining
13
5
  # a copy of this software and associated documentation files (the
14
6
  # "Software"), to deal in the Software without restriction, including
@@ -29,6 +21,7 @@
29
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
22
  #++
31
23
 
24
+
32
25
  module Tr8nClientSdk
33
- VERSION = '3.3.1'
26
+ VERSION = "4.0.1"
34
27
  end
@@ -1,14 +1,6 @@
1
1
  #--
2
- # Copyright (c) 2015 Translation Exchange Inc. http://translationexchange.com
2
+ # Copyright (c) 2014 Michael Berkovich, tr8nhub.com
3
3
  #
4
- # _______ _ _ _ ______ _
5
- # |__ __| | | | | (_) | ____| | |
6
- # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
- # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
- # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
- # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
- # __/ |
11
- # |___/
12
4
  # Permission is hereby granted, free of charge, to any person obtaining
13
5
  # a copy of this software and associated documentation files (the
14
6
  # "Software"), to deal in the Software without restriction, including
@@ -29,12 +21,9 @@
29
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
22
  #++
31
23
 
32
- require "tr8n_core"
33
- require "tr8n_client_sdk/core/string"
34
24
  require "tr8n_client_sdk/railtie"
35
25
  require "tr8n_client_sdk/engine"
36
- require "tr8n/cache_adapters/rails"
37
- require "i18n/backend/tr8n"
26
+ require "tr8n_core"
38
27
 
39
28
  module Tr8nClientSdk
40
29
 
metadata CHANGED
@@ -1,70 +1,66 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tr8n_client_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.1
4
+ version: 4.0.1
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-01-07 00:00:00.000000000 Z
11
+ date: 2014-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 4.0.0
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: '0'
26
+ version: 4.0.0
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.2'
33
+ version: 4.0.3
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.2'
40
+ version: 4.0.3
41
41
  description: Client SDK for Tr8n translation engine.
42
42
  email:
43
- - michael@translationexchange.com
43
+ - michael@tr8nhub.com
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - LICENSE
49
- - README.md
50
- - Rakefile
51
- - app/controllers/tr8n_client_sdk/cache_controller.rb
52
48
  - app/views/tr8n_client_sdk/tags/_language_selector.html.erb
53
49
  - app/views/tr8n_client_sdk/tags/_language_strip.html.erb
54
50
  - app/views/tr8n_client_sdk/tags/_powered_by_tr8n.html.erb
55
51
  - app/views/tr8n_client_sdk/tags/_scripts.html.erb
56
52
  - config/routes.rb
57
- - lib/i18n/backend/tr8n.rb
58
- - lib/tasks/tr8n.rake
59
- - lib/tr8n/cache_adapters/rails.rb
60
- - lib/tr8n_client_sdk.rb
61
- - lib/tr8n_client_sdk/core/string.rb
53
+ - lib/tasks/tr8n_client_sdk.rake
62
54
  - lib/tr8n_client_sdk/engine.rb
63
55
  - lib/tr8n_client_sdk/extensions/action_common_methods.rb
64
56
  - lib/tr8n_client_sdk/extensions/action_controller_extension.rb
65
57
  - lib/tr8n_client_sdk/extensions/action_view_extension.rb
66
58
  - lib/tr8n_client_sdk/railtie.rb
67
59
  - lib/tr8n_client_sdk/version.rb
60
+ - lib/tr8n_client_sdk.rb
61
+ - LICENSE
62
+ - Rakefile
63
+ - README.md
68
64
  homepage: https://github.com/tr8n/tr8n_rails_clientsdk
69
65
  licenses:
70
66
  - MIT-LICENSE
@@ -85,9 +81,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
81
  version: '0'
86
82
  requirements: []
87
83
  rubyforge_project:
88
- rubygems_version: 2.4.1
84
+ rubygems_version: 2.0.3
89
85
  signing_key:
90
86
  specification_version: 4
91
87
  summary: Tr8n Client SDK for Ruby on Rails
92
88
  test_files: []
93
- has_rdoc:
@@ -1,39 +0,0 @@
1
- #--
2
- # Copyright (c) 2015 Translation Exchange Inc. http://translationexchange.com
3
- #
4
- # _______ _ _ _ ______ _
5
- # |__ __| | | | | (_) | ____| | |
6
- # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
- # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
- # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
- # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
- # __/ |
11
- # |___/
12
- # Permission is hereby granted, free of charge, to any person obtaining
13
- # a copy of this software and associated documentation files (the
14
- # "Software"), to deal in the Software without restriction, including
15
- # without limitation the rights to use, copy, modify, merge, publish,
16
- # distribute, sublicense, and/or sell copies of the Software, and to
17
- # permit persons to whom the Software is furnished to do so, subject to
18
- # the following conditions:
19
- #
20
- # The above copyright notice and this permission notice shall be
21
- # included in all copies or substantial portions of the Software.
22
- #
23
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
- #++
31
-
32
- module Tr8nClientSdk
33
- class CacheController < ApplicationController
34
- def upgrade
35
- Tr8n.cache.upgrade_version
36
- redirect_to(request.env['HTTP_REFERER'] || '/')
37
- end
38
- end
39
- end
@@ -1,62 +0,0 @@
1
- #--
2
- # Copyright (c) 2015 Translation Exchange Inc. http://translationexchange.com
3
- #
4
- # _______ _ _ _ ______ _
5
- # |__ __| | | | | (_) | ____| | |
6
- # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
- # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
- # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
- # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
- # __/ |
11
- # |___/
12
- # Permission is hereby granted, free of charge, to any person obtaining
13
- # a copy of this software and associated documentation files (the
14
- # "Software"), to deal in the Software without restriction, including
15
- # without limitation the rights to use, copy, modify, merge, publish,
16
- # distribute, sublicense, and/or sell copies of the Software, and to
17
- # permit persons to whom the Software is furnished to do so, subject to
18
- # the following conditions:
19
- #
20
- # The above copyright notice and this permission notice shall be
21
- # included in all copies or substantial portions of the Software.
22
- #
23
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
- #++
31
-
32
- require 'i18n/backend/base'
33
- require 'tr8n_core'
34
-
35
- module I18n
36
- module Backend
37
- class Tr8n < I18n::Backend::Simple
38
-
39
- module Implementation
40
- include Base, Flatten
41
-
42
- def application
43
- ::Tr8n.session.application
44
- end
45
-
46
- def available_locales
47
- application.locales
48
- end
49
-
50
- def lookup(locale, key, scope = [], options = {})
51
- default_key = super(application.default_locale, key, scope, options)
52
- default_key ||= key
53
- application.language(locale.to_s).translate(default_key)
54
- end
55
-
56
- end
57
-
58
- include Implementation
59
- end
60
- end
61
- end
62
-
data/lib/tasks/tr8n.rake DELETED
@@ -1,60 +0,0 @@
1
- #--
2
- # Copyright (c) 2015 Translation Exchange Inc. http://translationexchange.com
3
- #
4
- # _______ _ _ _ ______ _
5
- # |__ __| | | | | (_) | ____| | |
6
- # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
7
- # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
8
- # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
9
- # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
10
- # __/ |
11
- # |___/
12
- # Permission is hereby granted, free of charge, to any person obtaining
13
- # a copy of this software and associated documentation files (the
14
- # "Software"), to deal in the Software without restriction, including
15
- # without limitation the rights to use, copy, modify, merge, publish,
16
- # distribute, sublicense, and/or sell copies of the Software, and to
17
- # permit persons to whom the Software is furnished to do so, subject to
18
- # the following conditions:
19
- #
20
- # The above copyright notice and this permission notice shall be
21
- # included in all copies or substantial portions of the Software.
22
- #
23
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30
- #++
31
-
32
- require 'tr8n_core'
33
-
34
- namespace :tr8n do
35
-
36
- namespace :cache do
37
-
38
- desc 'upgrades shared translation cache'
39
- task :upgrade => :environment do
40
- Tr8n.cache.upgrade_version
41
- end
42
-
43
- desc 'generates local file cache'
44
- task :generate => :environment do
45
- Tr8nCore::Generators::Cache::File.new.run
46
- end
47
-
48
- desc 'rolls back to the previous version'
49
- task :rollback => :environment do
50
- Tr8nCore::Generators::Cache::File.new.rollback
51
- end
52
-
53
- desc 'rolls up to the next version'
54
- task :rollup => :environment do
55
- Tr8nCore::Generators::Cache::File.new.rollup
56
- end
57
-
58
- end
59
-
60
- end
@@ -1,98 +0,0 @@
1
- # encoding: UTF-8
2
- #--
3
- # Copyright (c) 2015 Translation Exchange Inc. http://translationexchange.com
4
- #
5
- # _______ _ _ _ ______ _
6
- # |__ __| | | | | (_) | ____| | |
7
- # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
8
- # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
9
- # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
10
- # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
11
- # __/ |
12
- # |___/
13
- # Permission is hereby granted, free of charge, to any person obtaining
14
- # a copy of this software and associated documentation files (the
15
- # "Software"), to deal in the Software without restriction, including
16
- # without limitation the rights to use, copy, modify, merge, publish,
17
- # distribute, sublicense, and/or sell copies of the Software, and to
18
- # permit persons to whom the Software is furnished to do so, subject to
19
- # the following conditions:
20
- #
21
- # The above copyright notice and this permission notice shall be
22
- # included in all copies or substantial portions of the Software.
23
- #
24
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31
- #++
32
-
33
- class Tr8n::CacheAdapters::Rails < Tr8n::Cache
34
-
35
- def initialize
36
- Tr8n.logger.info('Initializing Rails cache...')
37
- @cache = Rails.cache
38
- end
39
-
40
- def cache_name
41
- @cache.class.name
42
- end
43
-
44
- def read_only?
45
- false
46
- end
47
-
48
- def fetch(key, opts = {})
49
- miss = false
50
- data = @cache.fetch(versioned_key(key, opts)) do
51
- info("Cache miss: #{key}")
52
- miss = true
53
- if block_given?
54
- yield
55
- else
56
- nil
57
- end
58
- end
59
- info("Cache hit: #{key}") unless miss
60
- data
61
- rescue Exception => ex
62
- warn("Failed to retrieve data: #{ex.message}")
63
- return nil unless block_given?
64
- yield
65
- end
66
-
67
- def store(key, data, opts = {})
68
- info("Cache store: #{key}")
69
- @cache.write(versioned_key(key, opts), data)
70
- data
71
- rescue Exception => ex
72
- warn("Failed to store data: #{ex.message}")
73
- key
74
- end
75
-
76
- def delete(key, opts = {})
77
- info("Cache delete: #{key}")
78
- @cache.delete(versioned_key(key, opts))
79
- key
80
- rescue Exception => ex
81
- warn("Failed to delete data: #{ex.message}")
82
- key
83
- end
84
-
85
- def exist?(key, opts = {})
86
- data = @cache.fetch(versioned_key(key, opts))
87
- not data.nil?
88
- rescue Exception => ex
89
- warn("Failed to check if key exists: #{ex.message}")
90
- false
91
- end
92
-
93
- def clear(opts = {})
94
- info("Cache clear")
95
- rescue Exception => ex
96
- warn("Failed to clear cache: #{ex.message}")
97
- end
98
- end