Module: TranslationPanel
- Defined in:
- lib/translation_panel.rb,
lib/translation_panel/engine.rb,
lib/translation_panel/filter.rb,
lib/translation_panel/redis_backend.rb,
lib/generators/translation_panel/install_generator.rb
Defined Under Namespace
Classes: Engine, Filter, InstallGenerator, RedisBackend
Class Method Summary
collapse
Class Method Details
.get_value(key) ⇒ Object
33
34
35
36
37
|
# File 'lib/translation_panel.rb', line 33
def get_value(key)
I18n.translate! key, :fallback => "no"
rescue
""
end
|
.kill! ⇒ Object
12
13
14
15
|
# File 'lib/translation_panel.rb', line 12
def kill!
Thread.current[:translations_list] = nil
Thread.current[:collect_translation_data] = nil
end
|
.push(value) ⇒ Object
21
22
23
|
# File 'lib/translation_panel.rb', line 21
def push value
Thread.current[:translations_list] << value
end
|
.show! ⇒ Object
7
8
9
10
|
# File 'lib/translation_panel.rb', line 7
def show!
Thread.current[:translations_list] = []
Thread.current[:collect_translation_data] = true
end
|
.show? ⇒ Boolean
17
18
19
|
# File 'lib/translation_panel.rb', line 17
def show?
Thread.current[:collect_translation_data]
end
|
.values ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/translation_panel.rb', line 25
def values
Thread.current[:collect_translation_data] = false
Thread.current[:translations_list].uniq.map do |key|
value = get_value(key)
{:key => key, :value => value} if value.is_a?(String)
end.compact
end
|