tr8n 3.1.5 → 3.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/.gitignore +5 -1
  2. data/.rvmrc +1 -1
  3. data/Gemfile.lock +5 -5
  4. data/README.rdoc +36 -17
  5. data/app/assets/javascripts/tr8n/tr8n.js +31 -19
  6. data/app/controllers/tr8n/help_controller.rb +12 -2
  7. data/app/models/tr8n/language.rb +7 -3
  8. data/app/models/tr8n/translation.rb +11 -8
  9. data/app/models/tr8n/translation_domain.rb +1 -1
  10. data/app/models/tr8n/translation_key.rb +29 -13
  11. data/app/models/tr8n/translation_key_source.rb +0 -1
  12. data/app/models/tr8n/translation_source.rb +5 -5
  13. data/app/models/tr8n/translation_source_language.rb +39 -0
  14. data/app/models/tr8n/translator.rb +2 -11
  15. data/app/views/tr8n/common/_language_strip.html.erb +1 -1
  16. data/app/views/tr8n/common/_scripts.html.erb +3 -4
  17. data/app/views/tr8n/help/lb_shortcuts.html.erb +23 -22
  18. data/app/views/tr8n/help/lb_stats.html.erb +63 -0
  19. data/bin/tr8n.rb +24 -0
  20. data/db/migrate/20100405201417_create_tr8n_tables.rb +1 -1
  21. data/db/migrate/20111003194443_create_tr8n_sync_tables.rb +23 -0
  22. data/db/migrate/20111011013640_add_remote_id_to_tr8n_translators.rb +23 -0
  23. data/db/migrate/20111026230545_create_tr8n_translation_source_languages.rb +34 -0
  24. data/{config → lib/generators/tr8n/templates/config}/tr8n/config.yml +18 -14
  25. data/{config → lib/generators/tr8n/templates/config}/tr8n/data/ip_locations.csv +0 -0
  26. data/{config → lib/generators/tr8n/templates/config}/tr8n/rules/default_date_rules.yml +0 -0
  27. data/{config → lib/generators/tr8n/templates/config}/tr8n/rules/default_gender_list_rules.yml +0 -0
  28. data/{config → lib/generators/tr8n/templates/config}/tr8n/rules/default_gender_rules.yml +0 -0
  29. data/{config → lib/generators/tr8n/templates/config}/tr8n/rules/default_language_cases.yml +0 -0
  30. data/{config → lib/generators/tr8n/templates/config}/tr8n/rules/default_list_rules.yml +0 -0
  31. data/{config → lib/generators/tr8n/templates/config}/tr8n/rules/default_numeric_rules.yml +0 -0
  32. data/{config → lib/generators/tr8n/templates/config}/tr8n/rules/default_value_rules.yml +0 -0
  33. data/{config → lib/generators/tr8n/templates/config}/tr8n/site/default_glossary.yml +0 -0
  34. data/{config → lib/generators/tr8n/templates/config}/tr8n/site/default_languages.yml +0 -0
  35. data/{config → lib/generators/tr8n/templates/config}/tr8n/site/features.yml +1 -6
  36. data/{config → lib/generators/tr8n/templates/config}/tr8n/site/shortcuts.yml +4 -0
  37. data/{config → lib/generators/tr8n/templates/config}/tr8n/site/sitemap.json +0 -0
  38. data/{config → lib/generators/tr8n/templates/config}/tr8n/tokens/data.yml +0 -0
  39. data/{config → lib/generators/tr8n/templates/config}/tr8n/tokens/decorations.yml +0 -0
  40. data/lib/generators/tr8n/templates/db/create_tr8n_tables.rb +77 -55
  41. data/lib/generators/tr8n/tr8n_generator.rb +1 -1
  42. data/lib/tr8n/cache.rb +109 -8
  43. data/lib/tr8n/config.rb +14 -4
  44. data/lib/tr8n/extensions/action_controller_extension.rb +36 -38
  45. data/lib/tr8n/extensions/action_view_extension.rb +3 -17
  46. data/lib/tr8n/extensions/date_extension.rb +0 -1
  47. data/lib/tr8n/extensions/hash_extension.rb +66 -0
  48. data/lib/tr8n/extensions/string_extension.rb +1 -1
  49. data/lib/tr8n/extensions/time_extension.rb +0 -1
  50. data/lib/tr8n/version.rb +1 -1
  51. data/local/tr8n_server/app/views/layouts/_footer.html.erb +1 -1
  52. data/local/tr8n_server/config/tr8n/config.yml +18 -14
  53. data/local/tr8n_server/config/tr8n/site/features.yml +1 -6
  54. data/local/tr8n_server/config/tr8n/site/shortcuts.yml +4 -0
  55. data/local/tr8n_server/db/migrate/20110930041150_create_tr8n_tables.rb +78 -56
  56. data/local/tr8n_server/db/schema.rb +10 -1
  57. metadata +56 -61
  58. data/app/views/tr8n/help/lb_credits.html.erb +0 -9
  59. data/local/tr8n_server/app/views/layouts/tr8n.html.erb +0 -51
  60. data/local/tr8n_server/app/views/layouts/tr8n_admin.html.erb +0 -61
  61. data/local/tr8n_server/db/migrate/20111003194443_create_tr8n_sync_tables.rb +0 -22
  62. data/local/tr8n_server/db/migrate/20111011013640_add_remote_id_to_tr8n_translators.rb +0 -5
data/lib/tr8n/cache.rb CHANGED
@@ -23,10 +23,17 @@
23
23
 
24
24
  module Tr8n
25
25
  class Cache
26
+
27
+ def self.cache_store_params
28
+ [Tr8n::Config.cache_store].flatten
29
+ end
30
+
26
31
  def self.cache
32
+ return nil unless enabled?
33
+
27
34
  @cache ||= begin
28
35
  if Tr8n::Config.cache_adapter == 'ActiveSupport::Cache'
29
- store_params = [Tr8n::Config.cache_store].flatten
36
+ store_params = cache_store_params
30
37
  store_params[0] = store_params[0].to_sym
31
38
  ActiveSupport::Cache.lookup_store(*store_params)
32
39
  else
@@ -38,22 +45,116 @@ module Tr8n
38
45
  def self.enabled?
39
46
  Tr8n::Config.enable_caching?
40
47
  end
41
-
48
+
49
+ def self.disabled?
50
+ not enabled?
51
+ end
52
+
53
+ def self.version
54
+ Tr8n::Config.cache_version
55
+ end
56
+
42
57
  def self.versioned_key(key)
43
- "#{Tr8n::Config.cache_version}_#{key}"
58
+ "#{version}_#{key}"
44
59
  end
45
-
46
- def self.fetch(key, options = {})
60
+
61
+ def self.memory_store?
62
+ cache_store_params.first == 'memory_store'
63
+ end
64
+
65
+ #################################################################
66
+ # Cache Adapter Methods
67
+ #################################################################
68
+ def self.fetch(key, opts = {})
47
69
  return yield unless enabled?
48
- cache.fetch(versioned_key(key), options) do
70
+
71
+ # pp "fetch #{key}"
72
+
73
+ cache.fetch(versioned_key(key), opts) do
49
74
  yield
50
75
  end
51
76
  end
52
77
 
53
- def self.delete(key, options = nil)
78
+ def self.delete(key, opts = nil)
54
79
  return unless enabled?
55
- cache.delete(versioned_key(key), options)
80
+
81
+ # pp "delete #{key}"
82
+
83
+ cache.delete(versioned_key(key), opts)
84
+ end
85
+
86
+ def self.exist?(name, opts = nil)
87
+ return unless enabled?
88
+ cache.exists?(name, opts)
89
+ end
90
+
91
+ def self.clear(opts = nil)
92
+ return unless enabled?
93
+ cache.clear(opts)
94
+ end
95
+
96
+ def self.cleanup(opts = nil)
97
+ return unless enabled?
98
+ cache.cleanup(opts)
99
+ end
100
+
101
+ def self.increment(name, amount = 1, opts = nil)
102
+ return unless enabled?
103
+ cache.increment(name, amount, opts)
104
+ end
105
+
106
+ def self.decrement(name, amount = 1, opts = nil)
107
+ return unless enabled?
108
+ cache.decrement(name, amount, opts)
56
109
  end
57
110
 
111
+ #################################################################
112
+ # Cache Source Methods
113
+ #################################################################
114
+
115
+ # For local cache, the source+language = updated_at must always be present
116
+ # These keys cannot expire, or refreshing of the resources will never take place
117
+ def self.sources_timestamps
118
+ @sources_timestamps ||= {}
119
+ end
120
+
121
+ def self.last_updated_at(translation_source_language)
122
+ sources_timestamps[translation_source_language.id] ||= 365.days.ago
123
+ end
124
+
125
+ def self.invalidate_source(source_name, language = Tr8n::Config.current_language)
126
+ return if disabled? or language.default?
127
+
128
+ # only memory store needs this kind of reloading
129
+ # memcached and other stores will expire shared keys
130
+ return unless memory_store?
131
+
132
+ # pp [:memory_times, sources_timestamps]
133
+
134
+ translation_source = Tr8n::TranslationSource.find_or_create(source_name)
135
+
136
+ # this is the only record that will never be cached and will always be loaded from the database
137
+ translation_source_language = Tr8n::TranslationSourceLanguage.find_or_create(translation_source, language)
138
+
139
+ if last_updated_at(translation_source_language) < translation_source_language.updated_at
140
+ keys = Tr8n::TranslationKey.where(["id in (select translation_key_id from #{Tr8n::TranslationKeySource.table_name} where translation_source_id = ?) and updated_at > ?",
141
+ translation_source.id, last_updated_at(translation_source_language)])
142
+
143
+ # pp "****************************** Found #{keys.count} outdated keys for this language"
144
+ keys.each do |key|
145
+ key.clear_translations_cache_for_language(language)
146
+ end
147
+
148
+ sources_timestamps[translation_source_language.id] = translation_source_language.updated_at
149
+ end
150
+ end
151
+
152
+ def self.cache_key_source(translation_key, source_name)
153
+ source_name ||= Tr8n::Config.current_source || 'Undefined'
154
+ translation_source = Tr8n::TranslationSource.find_or_create(source_name)
155
+ key_source = Tr8n::TranslationKeySource.find_or_create(translation_key, translation_source)
156
+ key_source
157
+ end
158
+
58
159
  end
59
160
  end
data/lib/tr8n/config.rb CHANGED
@@ -31,16 +31,21 @@ module Tr8n
31
31
 
32
32
  # initializes language, user and translator
33
33
  # the variables are kept in a thread safe form throughout the request
34
- def self.init(locale, site_current_user)
35
- Thread.current[:tr8n_current_language] = Tr8n::Language.for(locale) || default_language
34
+ def self.init(site_current_locale, site_current_user = nil, site_current_source = nil)
35
+ Thread.current[:tr8n_current_language] = Tr8n::Language.for(site_current_locale) || default_language
36
36
  Thread.current[:tr8n_current_user] = site_current_user
37
37
  Thread.current[:tr8n_current_translator] = Tr8n::Translator.for(site_current_user)
38
+ Thread.current[:tr8n_current_source] = site_current_source
38
39
  Thread.current[:tr8n_block_options] = {}
39
40
  end
40
41
 
41
42
  def self.current_user
42
43
  Thread.current[:tr8n_current_user]
43
44
  end
45
+
46
+ def self.current_source
47
+ Thread.current[:tr8n_current_source]
48
+ end
44
49
 
45
50
  def self.current_language
46
51
  Thread.current[:tr8n_current_language] ||= default_language
@@ -82,6 +87,7 @@ module Tr8n
82
87
  Thread.current[:tr8n_current_user] = nil
83
88
  Thread.current[:tr8n_current_translator] = nil
84
89
  Thread.current[:tr8n_block_options] = nil
90
+ Thread.current[:tr8n_current_source] = nil
85
91
  end
86
92
 
87
93
  def self.models
@@ -89,7 +95,7 @@ module Tr8n
89
95
  Tr8n::LanguageRule, Tr8n::LanguageUser, Tr8n::Language, Tr8n::LanguageMetric,
90
96
  Tr8n::LanguageCase, Tr8n::LanguageCaseValueMap, Tr8n::LanguageCaseRule,
91
97
  Tr8n::TranslationKey, Tr8n::TranslationKeySource, Tr8n::TranslationKeyComment, Tr8n::TranslationKeyLock,
92
- Tr8n::TranslationSource, Tr8n::TranslationDomain,
98
+ Tr8n::TranslationSource, Tr8n::TranslationDomain, Tr8n::TranslationSourceLanguage,
93
99
  Tr8n::Translation, Tr8n::TranslationVote,
94
100
  Tr8n::Translator, Tr8n::TranslatorLog, Tr8n::TranslatorMetric,
95
101
  Tr8n::TranslatorFollowing, Tr8n::TranslatorReport,
@@ -152,7 +158,7 @@ module Tr8n
152
158
 
153
159
  def self.load_yml(file_path, for_env = env)
154
160
  yml = YAML.load_file("#{root}#{file_path}")
155
- yml = yml[for_env] unless for_env.nil?
161
+ yml = yml['defaults'].rmerge(yml[for_env] || {}) unless for_env.nil?
156
162
  HashWithIndifferentAccess.new(yml)
157
163
  end
158
164
 
@@ -232,6 +238,10 @@ module Tr8n
232
238
  config[:enable_google_suggestions]
233
239
  end
234
240
 
241
+ def self.google_api_key
242
+ config[:google_api_key]
243
+ end
244
+
235
245
  def self.enable_glossary_hints?
236
246
  config[:enable_glossary_hints]
237
247
  end
@@ -62,35 +62,44 @@ module Tr8n
62
62
  request.remote_ip
63
63
  end
64
64
  end
65
+
66
+ def tr8n_init_current_source
67
+ "#{self.class.name.underscore.gsub("_controller", "")}/#{self.action_name}"
68
+ rescue
69
+ self.class.name
70
+ end
65
71
 
66
- def init_tr8n
67
- tr8n_current_locale = nil
68
- begin
69
- tr8n_current_locale = eval(Tr8n::Config.current_locale_method)
70
- rescue
71
- # fallback to the default session based locale implementation
72
- # choose the first language from the accepted languages header
73
- session[:locale] = tr8n_user_preffered_locale unless session[:locale]
74
- session[:locale] = params[:locale] if params[:locale]
75
- tr8n_current_locale = session[:locale]
76
- end
77
-
78
- tr8n_current_user = nil
79
- if Tr8n::Config.site_user_info_enabled?
80
- begin
81
- tr8n_current_user = eval(Tr8n::Config.current_user_method)
82
- tr8n_current_user = nil if tr8n_current_user.class.name != Tr8n::Config.user_class_name
83
- rescue
84
- tr8n_current_user = Tr8n::Translator.new
85
- Tr8n::Logger.error("Site user integration is enabled, but #{Tr8n::Config.current_user_method} method is not defined")
86
- end
87
- else
88
- tr8n_current_user = Tr8n::Translator.find_by_id(session[:tr8n_translator_id]) if session[:tr8n_translator_id]
89
- tr8n_current_user = Tr8n::Translator.new unless tr8n_current_user
72
+ def tr8n_init_current_locale
73
+ eval(Tr8n::Config.current_locale_method)
74
+ rescue
75
+ # fallback to the default session based locale implementation
76
+ # choose the first language from the accepted languages header
77
+ session[:locale] = tr8n_user_preffered_locale unless session[:locale]
78
+ session[:locale] = params[:locale] if params[:locale]
79
+ session[:locale]
80
+ end
81
+
82
+ def tr8n_init_current_user
83
+ unless Tr8n::Config.site_user_info_enabled? # deprecated - the site should run a standalone translation engine with a bridge
84
+ user = Tr8n::Translator.find_by_id(session[:tr8n_translator_id]) if session[:tr8n_translator_id]
85
+ user ||= Tr8n::Translator.new
86
+ return user
90
87
  end
88
+
89
+ user = eval(Tr8n::Config.current_user_method)
90
+ user = nil if user.class.name != Tr8n::Config.user_class_name
91
+ user
92
+ rescue
93
+ Tr8n::Logger.error("Site user integration is enabled, but #{Tr8n::Config.current_user_method} method is not defined")
94
+ Tr8n::Translator.new
95
+ end
91
96
 
97
+ def init_tr8n
92
98
  # initialize request thread variables
93
- Tr8n::Config.init(tr8n_current_locale, tr8n_current_user)
99
+ Tr8n::Config.init(tr8n_init_current_locale, tr8n_init_current_user, tr8n_init_current_source)
100
+
101
+ # invalidate source for the current page
102
+ Tr8n::Cache.invalidate_source(Tr8n::Config.current_source)
94
103
 
95
104
  # track user's last ip address
96
105
  if Tr8n::Config.enable_country_tracking? and Tr8n::Config.current_user_is_translator?
@@ -112,20 +121,9 @@ module Tr8n
112
121
  desc = options[:desc] || ""
113
122
  end
114
123
 
115
- begin
116
- url = request.url
117
- host = request.env['HTTP_HOST']
118
- source = "#{controller.class.name.underscore.gsub("_controller", "")}/#{controller.action_name}"
119
- rescue
120
- source = self.class.name
121
- url = nil
122
- host = 'localhost'
123
- end
124
-
125
- options.merge!(:source => source) unless options[:source]
126
124
  options.merge!(:caller => caller)
127
- options.merge!(:url => url)
128
- options.merge!(:host => host)
125
+ options.merge!(:url => request.url)
126
+ options.merge!(:host => request.env['HTTP_HOST'])
129
127
 
130
128
  unless Tr8n::Config.enabled?
131
129
  return Tr8n::TranslationKey.substitute_tokens(label, tokens, options)
@@ -64,20 +64,9 @@ module Tr8n
64
64
  desc = options[:context] || ""
65
65
  end
66
66
 
67
- begin
68
- url = request.url
69
- host = request.env['HTTP_HOST']
70
- source = "#{controller.class.name.underscore.gsub("_controller", "")}/#{controller.action_name}"
71
- rescue
72
- source = self.class.name
73
- url = nil
74
- host = 'localhost'
75
- end
76
-
77
- options.merge!(:source => source) unless options[:source]
78
67
  options.merge!(:caller => caller)
79
- options.merge!(:url => url)
80
- options.merge!(:host => host)
68
+ options.merge!(:url => request.url)
69
+ options.merge!(:host => request.env['HTTP_HOST'])
81
70
 
82
71
  unless Tr8n::Config.enabled?
83
72
  return Tr8n::TranslationKey.substitute_tokens(label, tokens, options)
@@ -140,10 +129,7 @@ module Tr8n
140
129
  end
141
130
 
142
131
  if linked
143
- html << link_to(name.html_safe, :controller => "/tr8n/language",
144
- :action => :switch, :language_action => :switch_language,
145
- :locale => lang.locale,
146
- :source_url => opts[:source_url])
132
+ html << link_to(name.html_safe, "/tr8n/language/switch?locale=#{lang.locale}&language_action=switch_language&source_url=#{CGI.escape(opts[:source_url]||'')}")
147
133
  else
148
134
  html << name
149
135
  end
@@ -65,7 +65,6 @@ class Date
65
65
  end
66
66
  end
67
67
 
68
- # options.merge!(:skip_decorations => true) if options[:skip_decorations].blank?
69
68
  language.tr(label, nil, tokens, options)
70
69
  end
71
70
  alias :tr :translate
@@ -57,4 +57,70 @@ class Hash
57
57
  @tr8n_translated
58
58
  end
59
59
 
60
+ #
61
+ # = Hash Recursive Merge
62
+ #
63
+ # Merges a Ruby Hash recursively, Also known as deep merge.
64
+ # Recursive version of Hash#merge and Hash#merge!.
65
+ #
66
+ # Category:: Ruby
67
+ # Package:: Hash
68
+ # Author:: Simone Carletti <weppos@weppos.net>
69
+ # Copyright:: 2007-2008 The Authors
70
+ # License:: MIT License
71
+ # Link:: http://www.simonecarletti.com/
72
+ # Source:: http://gist.github.com/gists/6391/
73
+
74
+ #
75
+ # Recursive version of Hash#merge!
76
+ #
77
+ # Adds the contents of +other_hash+ to +hsh+,
78
+ # merging entries in +hsh+ with duplicate keys with those from +other_hash+.
79
+ #
80
+ # Compared with Hash#merge!, this method supports nested hashes.
81
+ # When both +hsh+ and +other_hash+ contains an entry with the same key,
82
+ # it merges and returns the values from both arrays.
83
+ #
84
+ # h1 = {"a" => 100, "b" => 200, "c" => {"c1" => 12, "c2" => 14}}
85
+ # h2 = {"b" => 254, "c" => 300, "c" => {"c1" => 16, "c3" => 94}}
86
+ # h1.rmerge!(h2) #=> {"a" => 100, "b" => 254, "c" => {"c1" => 16, "c2" => 14, "c3" => 94}}
87
+ #
88
+ # Simply using Hash#merge! would return
89
+ #
90
+ # h1.merge!(h2) #=> {"a" => 100, "b" = >254, "c" => {"c1" => 16, "c3" => 94}}
91
+ #
92
+ def rmerge!(other_hash)
93
+ merge!(other_hash) do |key, oldval, newval|
94
+ oldval.class == self.class ? oldval.rmerge!(newval) : newval
95
+ end
96
+ end
97
+
98
+ #
99
+ # Recursive version of Hash#merge
100
+ #
101
+ # Compared with Hash#merge!, this method supports nested hashes.
102
+ # When both +hsh+ and +other_hash+ contains an entry with the same key,
103
+ # it merges and returns the values from both arrays.
104
+ #
105
+ # Compared with Hash#merge, this method provides a different approch
106
+ # for merging nasted hashes.
107
+ # If the value of a given key is an Hash and both +other_hash+ abd +hsh
108
+ # includes the same key, the value is merged instead replaced with
109
+ # +other_hash+ value.
110
+ #
111
+ # h1 = {"a" => 100, "b" => 200, "c" => {"c1" => 12, "c2" => 14}}
112
+ # h2 = {"b" => 254, "c" => 300, "c" => {"c1" => 16, "c3" => 94}}
113
+ # h1.rmerge(h2) #=> {"a" => 100, "b" => 254, "c" => {"c1" => 16, "c2" => 14, "c3" => 94}}
114
+ #
115
+ # Simply using Hash#merge would return
116
+ #
117
+ # h1.merge(h2) #=> {"a" => 100, "b" = >254, "c" => {"c1" => 16, "c3" => 94}}
118
+ #
119
+ def rmerge(other_hash)
120
+ r = {}
121
+ merge(other_hash) do |key, oldval, newval|
122
+ r[key] = oldval.class == self.class ? oldval.rmerge(newval) : newval
123
+ end
124
+ end
125
+
60
126
  end
@@ -33,7 +33,7 @@ class String
33
33
  end
34
34
 
35
35
  def trl(desc = "", tokens = {}, options = {}, language = Tr8n::Config.current_language)
36
- translate(desc, tokens, options.merge!(:skip_decorations => true), language)
36
+ translate(desc, tokens, options.merge(:skip_decorations => true), language)
37
37
  end
38
38
 
39
39
  def tr8n_translated
@@ -72,7 +72,6 @@ class Time
72
72
  end
73
73
  end
74
74
 
75
- # options.merge!(:skip_decorations => true) if options[:skip_decorations].blank?
76
75
  language.tr(label, nil, tokens, options)
77
76
  end
78
77
  alias :tr :translate
data/lib/tr8n/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tr8n
2
- VERSION = "3.1.5"
2
+ VERSION = "3.1.6"
3
3
  end
@@ -1,6 +1,6 @@
1
1
  <div class="page_ft module quiet">
2
2
  <ul class="flt_r right_horiz_list">
3
- <li><%=link_to(tr("Home"), "/tr8n/home", :class => "quiet")%></li>
3
+ <li><%=link_to(tr("Home"), "/", :class => "quiet")%></li>
4
4
  <li><%=link_to(tr("Languages"), "/tr8n/language/table", :class => "quiet")%></li>
5
5
  <li><%=link_to(tr("Translator Tools"), "/tr8n/dashboard", :class => "quiet")%></li>
6
6
  <li><%=link_to(tr("Administration Tools"), "/tr8n/admin/language", :class => "quiet")%></li>
@@ -9,14 +9,13 @@
9
9
  # Alternatively, you can overload any of the methods of Tr8n::Config
10
10
  #############################################################################
11
11
 
12
- defaults: &defaults
12
+ defaults:
13
13
  enable_tr8n: true # enables the engine
14
14
  enable_key_source_tracking: false # builds the site map sources
15
15
  enable_key_caller_tracking: false # tracks all calls to labels with their traces - for debugging only
16
16
 
17
17
  enable_glossary_hints: true # shows glossary in the translator
18
18
  enable_software_keyboard: true # shows the soft keyboard icon
19
- enable_google_suggestions: true # uses google for suggestions
20
19
  enable_keyboard_shortcuts: true # adds some keyboard shortcuts like ctrl+shift+s
21
20
  enable_dictionary_lookup: true # shows dictionary words definitions
22
21
 
@@ -34,6 +33,19 @@ defaults: &defaults
34
33
 
35
34
  enable_country_tracking: true # tracks and reports translator countries
36
35
 
36
+ #############################################################################
37
+ # Google translation suggestions is now a paid feature by Google.
38
+ #
39
+ # In order to enable this useful feauture, visit:
40
+ # http://code.google.com/apis/language/translate/overview.html
41
+ #
42
+ # Provide your billing information and register for an API key.
43
+ #
44
+ # Put your API key in the box below.
45
+ #############################################################################
46
+ enable_google_suggestions: false # uses google for suggestions
47
+ google_api_key: "YOUR GOOGLE API KEY" # get this API key from Google.
48
+
37
49
  #############################################################################
38
50
  # Featured languages can be added as a bottom strip bar on all pages using
39
51
  #
@@ -67,7 +79,7 @@ defaults: &defaults
67
79
  # store: memory_store # only for dev or test - single instance
68
80
  # store: file_store # only for dev or test - single instance
69
81
  # store: drb_store
70
- # store: [mem_cache_store, 'localhost:11211'] # recommended
82
+ # store: ['mem_cache_store', 'localhost:11211'] # recommended
71
83
  #
72
84
  # If you choose to use memcached, don't forget to add the gem to your Gemfile:
73
85
  #
@@ -77,11 +89,13 @@ defaults: &defaults
77
89
  #
78
90
  # cache_adapter: YOUR_CACHE_ADAPTER_CLASS
79
91
  #
92
+ # Note: Make sure you enable config.class_caching in your environment file
93
+ #
80
94
  #############################################################################
81
95
  caching:
82
96
  enabled: false
83
97
  adapter: ActiveSupport::Cache
84
- store: ['mem_cache_store', 'localhost:11211']
98
+ store: 'memory_store'
85
99
  version: 1 # you can change the version to invalidate the cache
86
100
 
87
101
  #############################################################################
@@ -256,21 +270,11 @@ defaults: &defaults
256
270
  # You can overload any feature defined in the defaults for any environment
257
271
  #############################################################################
258
272
  development:
259
- <<: *defaults
260
- # enable_key_source_tracking: false
261
273
 
262
274
  test:
263
- <<: *defaults
264
- # enable_key_source_tracking: false
265
275
 
266
276
  qa:
267
- <<: *defaults
268
- # enable_key_source_tracking: false
269
277
 
270
278
  stage:
271
- <<: *defaults
272
- # enable_key_source_tracking: false
273
279
 
274
280
  production:
275
- <<: *defaults
276
- # enable_key_source_tracking: false
@@ -7,7 +7,7 @@
7
7
  # environment settings at the bottom of the file
8
8
  #############################################################################
9
9
 
10
- defaults: &defaults
10
+ defaults:
11
11
  enabled_features: [dashboard, sitemap, phrases, translations, awards, forum, glossary, help]
12
12
 
13
13
  dashboard:
@@ -96,16 +96,11 @@ defaults: &defaults
96
96
  # You can overload any feature defined in the defaults for any environment
97
97
  #############################################################################
98
98
  development:
99
- <<: *defaults
100
99
 
101
100
  test:
102
- <<: *defaults
103
101
 
104
102
  qa:
105
- <<: *defaults
106
103
 
107
104
  stage:
108
- <<: *defaults
109
105
 
110
106
  production:
111
- <<: *defaults
@@ -22,6 +22,10 @@ Ctrl+Shift+C:
22
22
  description: Displays Tr8n credits
23
23
  script: "window.location = '/tr8n/home/credits';"
24
24
 
25
+ Ctrl+Shift+T:
26
+ description: Displays Tr8n statistics
27
+ script: "Tr8n.Utils.displayStatistics();"
28
+
25
29
  Alt+Shift+D:
26
30
  description: Opens dashboard
27
31
  script: "window.location = '/tr8n/dashboard';"