tml-rails 4.4.2 → 4.4.3
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 +4 -4
- data/README.md +28 -30
- data/app/views/tml_rails/tags/_language_selector_bootstrap.html.erb +6 -2
- data/app/views/tml_rails/tags/_language_selector_popup.html.erb +6 -2
- data/app/views/tml_rails/tags/_scripts.html.erb +1 -1
- data/lib/tml_rails/extensions/action_common_methods.rb +4 -0
- data/lib/tml_rails/extensions/action_controller_extension.rb +7 -3
- data/lib/tml_rails/extensions/action_view_extension.rb +12 -0
- data/lib/tml_rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8315876d08b00acf7d136a653d4b4532f2354742
|
4
|
+
data.tar.gz: 2a5b78a61e089c7acb94744f9ec4901e8658d67a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e00d95c6f7594f2bd2c46f383894b6232ec9fab1ee472f4c72215a51f0211976b518a5b779b7a8a0c86ed11b126b1886a60129f4c144709d573a4bd154448d2
|
7
|
+
data.tar.gz: 5edcd87ae7c437239e971a06051ca83cdfbe34522da699978d85b3b68ec77e568c72fade41702fc543726750cecb2b15a29db576441d1a17316a8ae1e96d9724
|
data/README.md
CHANGED
@@ -40,11 +40,11 @@ config/initializers/tml.rb
|
|
40
40
|
```ruby
|
41
41
|
Tml.configure do |config|
|
42
42
|
config.application = {
|
43
|
-
:
|
43
|
+
token: YOUR_APPLICATION_TOKEN,
|
44
44
|
}
|
45
45
|
config.cache = {
|
46
|
-
:
|
47
|
-
:
|
46
|
+
enabled: true,
|
47
|
+
adapter: 'rails'
|
48
48
|
}
|
49
49
|
end
|
50
50
|
```
|
@@ -53,21 +53,19 @@ Tml must be used with caching enabled.
|
|
53
53
|
|
54
54
|
If you are already using Rails caching, you probably already specify it in your production file, like the following:
|
55
55
|
|
56
|
-
Memcache
|
57
|
-
|
58
56
|
config/environments/production.rb
|
59
57
|
|
60
58
|
```ruby
|
61
59
|
config.cache_store = :mem_cache_store, { :namespace => 'my_cache' }
|
62
60
|
```
|
63
61
|
|
64
|
-
Memcache for multiple servers
|
62
|
+
Memcache for multiple servers:
|
65
63
|
|
66
64
|
```ruby
|
67
65
|
config.cache_store = :mem_cache_store, '123.456.78.9:1001', '123.456.78.9:1002'
|
68
66
|
```
|
69
67
|
|
70
|
-
Memcache with Dalli
|
68
|
+
Memcache with Dalli:
|
71
69
|
|
72
70
|
```ruby
|
73
71
|
config.cache_store = :mem_cache_store, Dalli::Client.new('localhost:11211', {
|
@@ -75,14 +73,14 @@ config.cache_store = :mem_cache_store, Dalli::Client.new('localhost:11211', {
|
|
75
73
|
})
|
76
74
|
```
|
77
75
|
|
78
|
-
Redis
|
76
|
+
For Redis:
|
79
77
|
|
80
78
|
```ruby
|
81
79
|
config.cache_store = :redis_store, {
|
82
|
-
:
|
83
|
-
:
|
84
|
-
:
|
85
|
-
:
|
80
|
+
host: 'localhost',
|
81
|
+
port: 6379,
|
82
|
+
db: 0,
|
83
|
+
namespace: 'my_cache'
|
86
84
|
}
|
87
85
|
```
|
88
86
|
|
@@ -98,8 +96,8 @@ config/initializers/tml.rb
|
|
98
96
|
|
99
97
|
```ruby
|
100
98
|
config.cache = {
|
101
|
-
:
|
102
|
-
:
|
99
|
+
enabled: true,
|
100
|
+
adapter: 'rails'
|
103
101
|
}
|
104
102
|
```
|
105
103
|
|
@@ -107,10 +105,10 @@ Alternatively, you can provide a separate memcache server to store your translat
|
|
107
105
|
|
108
106
|
```ruby
|
109
107
|
config.cache = {
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
108
|
+
enabled: true,
|
109
|
+
adapter: 'memcache',
|
110
|
+
host: 'localhost:11211',
|
111
|
+
namespace: 'translations'
|
114
112
|
}
|
115
113
|
```
|
116
114
|
|
@@ -118,12 +116,12 @@ You can also use Redis to persist your translations cache:
|
|
118
116
|
|
119
117
|
```ruby
|
120
118
|
config.cache = {
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
119
|
+
enabled: true,
|
120
|
+
adapter: 'redis',
|
121
|
+
host: 'localhost',
|
122
|
+
port: 6379,
|
123
|
+
password: 'password',
|
124
|
+
namespace: 'translations'
|
127
125
|
}
|
128
126
|
```
|
129
127
|
|
@@ -151,10 +149,10 @@ To specify in-memory, file-based cache, provide the following configuration:
|
|
151
149
|
|
152
150
|
```ruby
|
153
151
|
config.cache = {
|
154
|
-
:
|
155
|
-
:
|
156
|
-
:
|
157
|
-
:
|
152
|
+
enabled: true,
|
153
|
+
adapter: 'file',
|
154
|
+
path: 'config/tml',
|
155
|
+
version: 'current'
|
158
156
|
}
|
159
157
|
```
|
160
158
|
|
@@ -176,7 +174,7 @@ In the HEAD section of your layout, add:
|
|
176
174
|
Now you can simply add the default language selector anywhere on your page using:
|
177
175
|
|
178
176
|
```ruby
|
179
|
-
<%= tml_language_selector_tag %>
|
177
|
+
<%= tml_language_selector_tag(:popup) %>
|
180
178
|
```
|
181
179
|
|
182
180
|
The default language selector is used to enable/disable translation modes. It may be useful on staging or translation
|
@@ -203,7 +201,7 @@ To use a list language selector that uses locale in the url parameter, use:
|
|
203
201
|
If you want to see just a list of flags, use:
|
204
202
|
|
205
203
|
```ruby
|
206
|
-
<%= tml_language_selector_tag(:
|
204
|
+
<%= tml_language_selector_tag(:flags, {
|
207
205
|
:flags_only => true
|
208
206
|
}) %>
|
209
207
|
```
|
@@ -59,7 +59,11 @@
|
|
59
59
|
<li role='presentation' class='divider'></li>
|
60
60
|
<li role='presentation'>
|
61
61
|
<a href='javascript:void(0);' onclick='Tml.Utils.toggleInlineTranslations()'>
|
62
|
-
|
62
|
+
<% if Tml.session.inline_mode? %>
|
63
|
+
<%= tr(opts[:toggle_label_close] || 'Disable Translation Mode') %>
|
64
|
+
<% else %>
|
65
|
+
<%= tr(opts[:toggle_label] || 'Help Us Translate') %>
|
66
|
+
<% end %>
|
63
67
|
</a>
|
64
68
|
</li>
|
65
69
|
<% end %>
|
@@ -68,7 +72,7 @@
|
|
68
72
|
|
69
73
|
<div class="trex-dropdown-footer">
|
70
74
|
<a href="http://translationexchange.com" style="color: #888;">
|
71
|
-
<%= tr(
|
75
|
+
<%= tr('Powered By {brand}', brand: 'Translation Exchange') %>
|
72
76
|
</a>
|
73
77
|
</div>
|
74
78
|
</ul>
|
@@ -57,14 +57,18 @@
|
|
57
57
|
<% if opts[:toggle] %>
|
58
58
|
<li class='trex-credit' dir="<%= tml_current_language.dir %>">
|
59
59
|
<a href='javascript:void(0);' onclick='Tml.Utils.toggleInlineTranslations()'>
|
60
|
-
|
60
|
+
<% if Tml.session.inline_mode? %>
|
61
|
+
<%= tr(opts[:toggle_label_close] || 'Disable Translation Mode') %>
|
62
|
+
<% else %>
|
63
|
+
<%= tr(opts[:toggle_label] || 'Help Us Translate') %>
|
64
|
+
<% end %>
|
61
65
|
</a>
|
62
66
|
</li>
|
63
67
|
<% end %>
|
64
68
|
|
65
69
|
<li class="trex-credit" dir="<%= tml_current_language.dir %>">
|
66
70
|
<a href="http://translationexchange.com">
|
67
|
-
Powered
|
71
|
+
<%= tr('Powered By {brand}', brand: 'Translation Exchange') %>
|
68
72
|
</a>
|
69
73
|
</li>
|
70
74
|
</ul>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
Tml.app_key = '<%= tml_application.key %>';
|
23
23
|
Tml.host = '<%= tml_application.tools['host'] %>';
|
24
24
|
Tml.locale = '<%= tml_current_language.locale %>';
|
25
|
-
Tml.
|
25
|
+
Tml.current_source = '<%= tml_current_source %>';
|
26
26
|
<%
|
27
27
|
if tml_application.feature_enabled?(:shortcuts)
|
28
28
|
tml_application.shortcuts.each do |key, script|
|
@@ -34,9 +34,13 @@ module TmlRails
|
|
34
34
|
|
35
35
|
def self.included(base)
|
36
36
|
base.send(:include, TmlRails::ActionCommonMethods)
|
37
|
-
base.send(:include, InstanceMethods)
|
38
|
-
|
39
|
-
|
37
|
+
base.send(:include, InstanceMethods)
|
38
|
+
|
39
|
+
if Tml.config.auto_init
|
40
|
+
base.before_filter :tml_init
|
41
|
+
base.after_filter :tml_reset
|
42
|
+
end
|
43
|
+
|
40
44
|
if defined? base.rescue_from
|
41
45
|
base.rescue_from 'Tml::Exception' do |e|
|
42
46
|
Tml.logger.error(e)
|
@@ -206,5 +206,17 @@ module TmlRails
|
|
206
206
|
"lang='#{lang.locale}'".html_safe
|
207
207
|
end
|
208
208
|
|
209
|
+
def tml_lang_attributes_tag(lang = tml_current_language)
|
210
|
+
"#{tml_lang_attribute_tag(lang)} #{tml_dir_attribute_tag(lang)}".html_safe
|
211
|
+
end
|
212
|
+
|
213
|
+
def tml_stylesheet_link_tag(ltr, rtl, attrs = {})
|
214
|
+
if tml_current_language.right_to_left?
|
215
|
+
stylesheet_link_tag(rtl, attrs)
|
216
|
+
else
|
217
|
+
stylesheet_link_tag(ltr, attrs)
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
209
221
|
end
|
210
222
|
end
|
data/lib/tml_rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tml-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.4.
|
4
|
+
version: 4.4.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: 2015-
|
11
|
+
date: 2015-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|