tml-rails 4.3.7 → 4.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9326f9cd017dbc9d697e2c7dab50c0ff2d70c41b
4
- data.tar.gz: 1898fcb898316d57b4de91356a66524dd18c5a4c
3
+ metadata.gz: d58569d9a19077d22a7ec8c0f4f726c09f7eeca5
4
+ data.tar.gz: 99f84397023f4555a8141a0297e418a559a76ec3
5
5
  SHA512:
6
- metadata.gz: 598ce0a929c08a22c956d35857bb63f5e52959b3e2381e5a3a1ec79bd0c5df1223b56efdee91bf72edd1f5c3bda03659a271639a7a61921b704724d7be442b6e
7
- data.tar.gz: 2470d1f1ac1f5024299fadaf636e7408e5cc38c50a251493d00c1ae7263bf7fc65904b69385d218a6f28f16a1fcda1c5bfe73932156797403ffbd6c6b91eebd8
6
+ metadata.gz: 4f9b99b2b554941190e24a622cd3cbf86f4b5009e4da40c6f492db3b47e35b57f4b0302834a8e0724fe8799e6139a37fdefd1823754fe1242a2ae9e8bc5be26c
7
+ data.tar.gz: d9ab7bacfe0bf81aa9d7c83d8d6d5b71d0e4bffceb398d3d9a03c49d828234db7cc8ed90ba0e31e50aa22d4b6820d8c07e52e5d753cf937acb391b0979da3013
@@ -0,0 +1,95 @@
1
+ #--
2
+ # Copyright (c) 2015 Translation Exchange Inc.
3
+ #
4
+ # http://translationexchange.com
5
+ #
6
+ # _______ _ _ _ ______ _
7
+ # |__ __| | | | | (_) | ____| | |
8
+ # | |_ __ __ _ _ __ ___| | __ _| |_ _ ___ _ __ | |__ __ _____| |__ __ _ _ __ __ _ ___
9
+ # | | '__/ _` | '_ \/ __| |/ _` | __| |/ _ \| '_ \| __| \ \/ / __| '_ \ / _` | '_ \ / _` |/ _ \
10
+ # | | | | (_| | | | \__ \ | (_| | |_| | (_) | | | | |____ > < (__| | | | (_| | | | | (_| | __/
11
+ # |_|_| \__,_|_| |_|___/_|\__,_|\__|_|\___/|_| |_|______/_/\_\___|_| |_|\__,_|_| |_|\__, |\___|
12
+ # __/ |
13
+ # |___/
14
+ # Permission is hereby granted, free of charge, to any person obtaining
15
+ # a copy of this software and associated documentation files (the
16
+ # "Software"), to deal in the Software without restriction, including
17
+ # without limitation the rights to use, copy, modify, merge, publish,
18
+ # distribute, sublicense, and/or sell copies of the Software, and to
19
+ # permit persons to whom the Software is furnished to do so, subject to
20
+ # the following conditions:
21
+ #
22
+ # The above copyright notice and this permission notice shall be
23
+ # included in all copies or substantial portions of the Software.
24
+ #
25
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
29
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
30
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
31
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32
+ #++
33
+
34
+ I18n.backend = I18n::Backend::Tml.new
35
+
36
+ Tml.configure do |config|
37
+ config.application = {
38
+ token: 'YOUR TOKEN'
39
+ }
40
+
41
+ # If you are using Rails.cache, use the following settings:
42
+
43
+ config.cache = {
44
+ :enabled => true,
45
+ :adapter => :rails,
46
+ :version => 1
47
+ }
48
+
49
+ # If you are using File based pre-generated cache, use the following settings:
50
+
51
+ #config.cache = {
52
+ # :enabled => true,
53
+ # :adapter => 'file',
54
+ # :path => 'config/tml',
55
+ # :version => 'current',
56
+ # :segmented => false
57
+ #}
58
+
59
+ # If you are using Redis, use the following settings:
60
+
61
+ #config.cache = {
62
+ # :enabled => true,
63
+ # :adapter => 'redis',
64
+ # :host => 'localhost',
65
+ # :port => 6379,
66
+ # :db => 0,
67
+ # :namespace => 'translations',
68
+ #}
69
+
70
+ # If you are using Memcache, use the following settings:
71
+
72
+ #config.cache = {
73
+ # :enabled => true,
74
+ # :adapter => 'memcache',
75
+ # :host => 'localhost:11211',
76
+ # :version => 1,
77
+ # :namespace => 'translations',
78
+ #}
79
+
80
+ # For debugging, uncomment the following lines:
81
+
82
+ #config.logger = {
83
+ # :enabled => true,
84
+ # :path => "#{Rails.root}/log/tml.log",
85
+ # :level => 'debug'
86
+ #}
87
+
88
+ # To use Rails logger instead, use:
89
+
90
+ #config.logger = {
91
+ # :enabled => true,
92
+ # :type => :rails
93
+ #}
94
+
95
+ end
data/lib/tasks/tml.rake CHANGED
@@ -33,6 +33,17 @@ require 'tml'
33
33
 
34
34
  namespace :tml do
35
35
 
36
+ desc 'initializes tml'
37
+ task :init => :environment do
38
+ unless File.exists?("#{Rails.root}/config/initializers/tml.rb")
39
+ root = File.expand_path('../templates', __FILE__)
40
+ system "cp #{root}/tml.rb #{Rails.root}/config/initializers"
41
+ puts 'Please update config/initializers/tml.rb with your application token'
42
+ else
43
+ puts 'Tml initializer file already exists'
44
+ end
45
+ end
46
+
36
47
  namespace :cache do
37
48
 
38
49
  desc 'upgrades shared translation cache'
@@ -55,7 +55,7 @@ module TmlRails
55
55
 
56
56
  def tml_user_preferred_locale
57
57
  tml_browser_accepted_locales.each do |locale|
58
- next unless Tml.session.application.locales.include?(locale)
58
+ next unless Tml.session.application and Tml.session.application.locales.include?(locale)
59
59
  return locale
60
60
  end
61
61
  Tml.config.default_locale
@@ -30,5 +30,5 @@
30
30
  #++
31
31
 
32
32
  module TmlRails
33
- VERSION = '4.3.7'
33
+ VERSION = '4.3.8'
34
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tml-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.7
4
+ version: 4.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Berkovich
@@ -59,6 +59,7 @@ files:
59
59
  - app/views/tml_rails/tags/_scripts.html.erb
60
60
  - config/routes.rb
61
61
  - lib/i18n/backend/tml.rb
62
+ - lib/tasks/templates/tml.rb
62
63
  - lib/tasks/tml.rake
63
64
  - lib/tml-rails.rb
64
65
  - lib/tml/cache_adapters/rails.rb