tr8n 3.1.8 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. data/.gitignore +2 -1
  2. data/.rspec +1 -0
  3. data/.rvmrc +1 -1
  4. data/.watchr +18 -0
  5. data/Gemfile.lock +16 -10
  6. data/app/assets/images/tr8n/minus_node.png +0 -0
  7. data/app/assets/images/tr8n/pixel.gif +0 -0
  8. data/app/assets/images/tr8n/plus_node.png +0 -0
  9. data/app/assets/javascripts/tr8n/tr8n.js +1 -0
  10. data/app/assets/javascripts/tr8n/tr8n_client_sdk.js +581 -425
  11. data/app/assets/stylesheets/tr8n/layout.css.scss +1 -1
  12. data/app/assets/stylesheets/tr8n/tr8n.css.scss +20 -0
  13. data/app/controllers/tr8n/admin/base_controller.rb +4 -1
  14. data/app/controllers/tr8n/admin/clientsdk_controller.rb +1 -1
  15. data/app/controllers/tr8n/admin/metrics_controller.rb +30 -0
  16. data/app/controllers/tr8n/api/v1/base_controller.rb +12 -0
  17. data/app/controllers/tr8n/api/v1/language_controller.rb +7 -5
  18. data/app/controllers/tr8n/awards_controller.rb +1 -1
  19. data/app/controllers/tr8n/base_controller.rb +12 -6
  20. data/app/controllers/tr8n/dashboard_controller.rb +1 -1
  21. data/app/controllers/tr8n/forum_controller.rb +1 -1
  22. data/app/controllers/tr8n/glossary_controller.rb +1 -1
  23. data/app/controllers/tr8n/help_controller.rb +1 -1
  24. data/app/controllers/tr8n/phrases_controller.rb +1 -1
  25. data/app/controllers/tr8n/translator_controller.rb +8 -0
  26. data/app/helpers/tr8n/admin/base_helper.rb +1 -1
  27. data/app/helpers/tr8n/base_helper.rb +1 -1
  28. data/app/helpers/tr8n/dashboard_helper.rb +1 -1
  29. data/app/models/tr8n/base_filter.rb +1 -1
  30. data/app/models/tr8n/daily_language_metric.rb +1 -1
  31. data/app/models/tr8n/date_rule.rb +1 -1
  32. data/app/models/tr8n/gender_list_rule.rb +1 -1
  33. data/app/models/tr8n/gender_rule.rb +1 -1
  34. data/app/models/tr8n/glossary.rb +1 -1
  35. data/app/models/tr8n/glossary_filter.rb +1 -1
  36. data/app/models/tr8n/integration/ru/russian_gender_list_rule.rb +1 -1
  37. data/app/models/tr8n/integration/ru/russian_numeric_rule.rb +1 -1
  38. data/app/models/tr8n/ip_location.rb +1 -1
  39. data/app/models/tr8n/ip_location_filter.rb +1 -1
  40. data/app/models/tr8n/language.rb +19 -7
  41. data/app/models/tr8n/language_case.rb +1 -1
  42. data/app/models/tr8n/language_case_filter.rb +1 -1
  43. data/app/models/tr8n/language_case_rule.rb +1 -1
  44. data/app/models/tr8n/language_case_rule_filter.rb +1 -1
  45. data/app/models/tr8n/language_case_value_map.rb +1 -1
  46. data/app/models/tr8n/language_case_value_map_filter.rb +1 -1
  47. data/app/models/tr8n/language_filter.rb +1 -1
  48. data/app/models/tr8n/language_forum_abuse_report.rb +1 -1
  49. data/app/models/tr8n/language_forum_abuse_report_filter.rb +1 -1
  50. data/app/models/tr8n/language_forum_message.rb +1 -1
  51. data/app/models/tr8n/language_forum_message_filter.rb +1 -1
  52. data/app/models/tr8n/language_forum_topic.rb +1 -1
  53. data/app/models/tr8n/language_forum_topic_filter.rb +1 -1
  54. data/app/models/tr8n/language_metric.rb +1 -1
  55. data/app/models/tr8n/language_metric_filter.rb +1 -1
  56. data/app/models/tr8n/language_rule.rb +1 -1
  57. data/app/models/tr8n/language_rule_filter.rb +1 -1
  58. data/app/models/tr8n/language_user.rb +1 -1
  59. data/app/models/tr8n/language_user_filter.rb +1 -1
  60. data/app/models/tr8n/list_rule.rb +1 -1
  61. data/app/models/tr8n/monthly_language_metric.rb +1 -1
  62. data/app/models/tr8n/numeric_rule.rb +35 -28
  63. data/app/models/tr8n/sync_log.rb +1 -1
  64. data/app/models/tr8n/sync_log_filter.rb +1 -1
  65. data/app/models/tr8n/total_language_metric.rb +1 -1
  66. data/app/models/tr8n/translation.rb +4 -3
  67. data/app/models/tr8n/translation_domain.rb +11 -3
  68. data/app/models/tr8n/translation_domain_filter.rb +1 -1
  69. data/app/models/tr8n/translation_filter.rb +1 -1
  70. data/app/models/tr8n/translation_key.rb +73 -36
  71. data/app/models/tr8n/translation_key_comment.rb +1 -1
  72. data/app/models/tr8n/translation_key_comment_filter.rb +1 -1
  73. data/app/models/tr8n/translation_key_filter.rb +1 -1
  74. data/app/models/tr8n/translation_key_lock.rb +1 -1
  75. data/app/models/tr8n/translation_key_lock_filter.rb +1 -1
  76. data/app/models/tr8n/translation_key_source.rb +16 -5
  77. data/app/models/tr8n/translation_key_source_filter.rb +1 -1
  78. data/app/models/tr8n/translation_source.rb +12 -4
  79. data/app/models/tr8n/translation_source_filter.rb +1 -1
  80. data/app/models/tr8n/translation_source_language.rb +1 -1
  81. data/app/models/tr8n/translation_vote.rb +1 -1
  82. data/app/models/tr8n/translation_vote_filter.rb +1 -1
  83. data/app/models/tr8n/translator.rb +21 -5
  84. data/app/models/tr8n/translator_filter.rb +1 -1
  85. data/app/models/tr8n/translator_following.rb +1 -1
  86. data/app/models/tr8n/translator_following_filter.rb +1 -1
  87. data/app/models/tr8n/translator_log.rb +3 -3
  88. data/app/models/tr8n/translator_log_filter.rb +1 -1
  89. data/app/models/tr8n/translator_metric.rb +1 -1
  90. data/app/models/tr8n/translator_metric_filter.rb +1 -1
  91. data/app/models/tr8n/translator_report.rb +1 -1
  92. data/app/models/tr8n/translator_report_filter.rb +1 -1
  93. data/app/models/tr8n/value_rule.rb +1 -1
  94. data/app/views/tr8n/admin/clientsdk/index.html.erb +29 -29
  95. data/app/views/tr8n/admin/clientsdk/lb_samples.html.erb +1 -1
  96. data/app/views/tr8n/admin/metrics/_tabs.html.erb +22 -0
  97. data/app/views/tr8n/admin/metrics/index.html.erb +60 -0
  98. data/app/views/tr8n/common/_header.html.erb +3 -1
  99. data/app/views/tr8n/common/_language_selector.html.erb +4 -2
  100. data/app/views/tr8n/common/_scripts.html.erb +5 -0
  101. data/app/views/tr8n/common/_terms_of_service.html.erb +53 -0
  102. data/app/views/tr8n/help/credits.html.erb +4 -0
  103. data/app/views/tr8n/language/_select.html.erb +5 -1
  104. data/app/views/tr8n/translator/registration.html.erb +21 -0
  105. data/config/routes.rb +3 -1
  106. data/doc/classes.graffle +356 -7194
  107. data/lib/generators/tr8n/templates/config/tr8n/config.yml +9 -1
  108. data/lib/generators/tr8n/templates/config/tr8n/site/shortcuts.yml +1 -1
  109. data/lib/generators/tr8n/templates/config/tr8n/tokens/decorations.yml +4 -1
  110. data/lib/generators/tr8n/tr8n_generator.rb +1 -1
  111. data/lib/tasks/tr8n.rake +1 -1
  112. data/lib/tr8n.rb +23 -0
  113. data/lib/tr8n/active_dumper.rb +1 -1
  114. data/lib/tr8n/cache.rb +1 -8
  115. data/lib/tr8n/cache_adapters/memcached.rb +1 -1
  116. data/lib/tr8n/config.rb +37 -1
  117. data/lib/tr8n/dictionary.rb +1 -1
  118. data/lib/tr8n/engine.rb +4 -1
  119. data/lib/tr8n/exception.rb +1 -1
  120. data/lib/tr8n/extender.rb +1 -1
  121. data/lib/tr8n/extensions/action_controller_extension.rb +5 -4
  122. data/lib/tr8n/extensions/action_view_extension.rb +71 -20
  123. data/lib/tr8n/extensions/array_extension.rb +14 -1
  124. data/lib/tr8n/extensions/date_extension.rb +1 -1
  125. data/lib/tr8n/extensions/fixnum_extension.rb +1 -1
  126. data/lib/tr8n/extensions/hash_extension.rb +1 -1
  127. data/lib/tr8n/extensions/string_extension.rb +1 -1
  128. data/lib/tr8n/extensions/time_extension.rb +1 -1
  129. data/lib/tr8n/ip_address.rb +1 -1
  130. data/lib/tr8n/key_registration_exception.rb +1 -1
  131. data/lib/tr8n/keyboard_mapping.rb +1 -1
  132. data/lib/tr8n/logger.rb +1 -1
  133. data/lib/tr8n/railtie.rb +1 -1
  134. data/lib/tr8n/site_map.rb +1 -1
  135. data/lib/tr8n/site_map_section.rb +1 -1
  136. data/lib/tr8n/token.rb +1 -1
  137. data/lib/tr8n/token_exception.rb +1 -1
  138. data/lib/tr8n/tokenized_label.rb +2 -12
  139. data/lib/tr8n/tokens/data_token.rb +1 -1
  140. data/lib/tr8n/tokens/decoration_token.rb +1 -1
  141. data/lib/tr8n/tokens/hidden_token.rb +1 -1
  142. data/lib/tr8n/tokens/method_token.rb +1 -1
  143. data/lib/tr8n/tokens/transform_token.rb +1 -1
  144. data/lib/tr8n/version.rb +25 -1
  145. data/local/tr8n_server/app/models/user.rb +1 -0
  146. data/local/tr8n_server/config/environments/test.rb +1 -1
  147. data/local/tr8n_server/config/tr8n/config.yml +45 -39
  148. data/local/tr8n_server/config/tr8n/site/shortcuts.yml +1 -1
  149. data/local/tr8n_server/db/schema.rb +2 -0
  150. data/spec/controllers/awards_controller_spec.rb +22 -0
  151. data/spec/controllers/base_controller_spec.rb +6 -0
  152. data/spec/controllers/dashboard_controller_spec.rb +23 -0
  153. data/spec/controllers/forum_controller_spec.rb +23 -0
  154. data/spec/controllers/glossary_controller_spec.rb +22 -0
  155. data/spec/controllers/help_controller_spec.rb +22 -0
  156. data/spec/controllers/language_cases_controller_spec.rb +13 -0
  157. data/spec/controllers/language_controller_spec.rb +10 -0
  158. data/spec/controllers/phrases_controller_spec.rb +22 -0
  159. data/spec/controllers/translations_controller_spec.rb +23 -0
  160. data/spec/controllers/translator_controller_spec.rb +22 -0
  161. data/spec/lib/tokenized_label_spec.rb +42 -0
  162. data/spec/lib/tokens/data_token_spec.rb +49 -0
  163. data/spec/lib/tokens/decoration_token_spec.rb +49 -0
  164. data/spec/lib/tokens/hidden_token_spec.rb +53 -0
  165. data/spec/lib/tokens/method_token_spec.rb +61 -0
  166. data/spec/lib/tokens/transform_token_spec.rb +51 -0
  167. data/spec/models/tr8n/daily_language_metric_spec.rb +5 -0
  168. data/spec/models/tr8n/date_rule_spec.rb +5 -0
  169. data/spec/models/tr8n/gender_list_rule_spec.rb +5 -0
  170. data/spec/models/tr8n/gender_rule_spec.rb +141 -0
  171. data/spec/models/tr8n/glossary_spec.rb +5 -0
  172. data/spec/models/tr8n/ip_location_spec.rb +5 -0
  173. data/spec/models/tr8n/language_case_rule_spec.rb +5 -0
  174. data/spec/models/tr8n/language_case_spec.rb +5 -0
  175. data/spec/models/tr8n/language_case_value_map_spec.rb +5 -0
  176. data/spec/models/tr8n/language_forum_abuse_report_spec.rb +5 -0
  177. data/spec/models/tr8n/language_forum_message_spec.rb +5 -0
  178. data/spec/models/tr8n/language_forum_topic_spec.rb +5 -0
  179. data/spec/models/tr8n/language_metric_spec.rb +5 -0
  180. data/spec/models/tr8n/language_rule_spec.rb +5 -0
  181. data/spec/models/tr8n/language_spec.rb +79 -0
  182. data/spec/models/tr8n/language_user_spec.rb +5 -0
  183. data/spec/models/tr8n/list_rule_spec.rb +5 -0
  184. data/spec/models/tr8n/monthly_language_metric_spec.rb +5 -0
  185. data/spec/models/tr8n/numeric_rule_spec.rb +162 -0
  186. data/spec/models/tr8n/sync_log_spec.rb +5 -0
  187. data/spec/models/tr8n/total_language_metric_spec.rb +5 -0
  188. data/spec/models/tr8n/translation_domain_spec.rb +5 -0
  189. data/spec/models/tr8n/translation_key_comment_spec.rb +5 -0
  190. data/spec/models/tr8n/translation_key_lock_spec.rb +5 -0
  191. data/spec/models/tr8n/translation_key_source_spec.rb +5 -0
  192. data/spec/models/tr8n/translation_key_spec.rb +118 -0
  193. data/spec/models/tr8n/translation_source_language_spec.rb +5 -0
  194. data/spec/models/tr8n/translation_source_spec.rb +5 -0
  195. data/spec/models/tr8n/translation_spec.rb +5 -0
  196. data/spec/models/tr8n/translation_vote_spec.rb +5 -0
  197. data/spec/models/tr8n/translator_following_spec.rb +5 -0
  198. data/spec/models/tr8n/translator_log_spec.rb +5 -0
  199. data/spec/models/tr8n/translator_metric_spec.rb +5 -0
  200. data/spec/models/tr8n/translator_report_spec.rb +5 -0
  201. data/spec/models/tr8n/translator_spec.rb +140 -0
  202. data/spec/spec_helper.rb +26 -27
  203. data/tr8n.gemspec +3 -1
  204. metadata +173 -50
  205. data/local/tr8n_server/db/migrate/20110930041150_create_tr8n_tables.rb +0 -372
  206. data/spec/fake_app.rb +0 -50
  207. data/spec/lib/data_token_spec.rb +0 -26
  208. data/spec/lib/transform_token_spec.rb +0 -22
  209. data/spec/models/translation_key_spec.rb +0 -63
@@ -49,7 +49,7 @@
49
49
  .page_body .main_col {overflow:hidden;_overflow:visible;_zoom:1;}
50
50
  .page_body .left_col {float:left; width:250px;_margin-right:-3px;}
51
51
  .page_body .right_col {float:right; width: 300px;_margin-left:-3px;}
52
-
52
+ .content_inner {padding:10px}
53
53
 
54
54
  /* Header */
55
55
 
@@ -442,3 +442,23 @@ body.tr8n_grey_disabled_button {background-position: left -300p
442
442
  body.tr8n_grey_disabled_button span {background-position: right -626px; }
443
443
 
444
444
  .tr8n_cancel_link {font-size:12px;font-family:arial;}
445
+
446
+ /****************************************/
447
+ /*** Logger Objects
448
+ /****************************************/
449
+ .tr8n_logger_obj_key {
450
+ padding-right: 10px;
451
+ color: #444;
452
+ }
453
+ .tr8n_logger_obj_value_string {
454
+ color: green;
455
+ }
456
+ .tr8n_logger_obj_value_string {
457
+ color: green;
458
+ }
459
+ .tr8n_logger_obj_value_boolean {
460
+ color: blue;
461
+ }
462
+ .tr8n_logger_obj_value_number {
463
+ color: red;
464
+ }
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -50,12 +50,15 @@ private
50
50
  {"title" => "Translators", "description" => "Admin tab", "controller" => "translator"},
51
51
  {"title" => "Glossary", "description" => "Admin tab", "controller" => "glossary"},
52
52
  {"title" => "Forum", "description" => "Admin tab", "controller" => "forum"},
53
+ {"title" => "Metrics", "description" => "Metrics tab", "controller" => "metrics"},
53
54
  {"title" => "Client SDK", "description" => "Admin tab", "controller" => "clientsdk"}
54
55
  ]
55
56
  end
56
57
  helper_method :tr8n_admin_tabs
57
58
 
58
59
  def validate_admin
60
+ return if Tr8n::Config.env == 'development'
61
+
59
62
  unless tr8n_current_user_is_admin?
60
63
  trfe("You must be an admin in order to view this section of the site")
61
64
  redirect_to_site_default_url
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -0,0 +1,30 @@
1
+ #--
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+ class Tr8n::Admin::MetricsController < Tr8n::Admin::BaseController
25
+
26
+ def index
27
+ @languages = Tr8n::Language.enabled_languages
28
+ end
29
+
30
+ end
@@ -23,6 +23,18 @@
23
23
 
24
24
  class Tr8n::Api::V1::BaseController < ApplicationController
25
25
 
26
+ if Tr8n::Config.api_skip_before_filters.any?
27
+ skip_before_filter *Tr8n::Config.api_skip_before_filters
28
+ end
29
+
30
+ if Tr8n::Config.api_before_filters.any?
31
+ before_filter *Tr8n::Config.api_before_filters
32
+ end
33
+
34
+ if Tr8n::Config.api_after_filters.any?
35
+ after_filter *Tr8n::Config.api_after_filters
36
+ end
37
+
26
38
  private
27
39
 
28
40
  def tr8n_current_user
@@ -40,10 +40,8 @@ class Tr8n::Api::V1::LanguageController < Tr8n::Api::V1::BaseController
40
40
  def translate
41
41
  return sanitize_api_response({"error" => "Api is disabled"}) unless Tr8n::Config.enable_api?
42
42
 
43
- # return sanitize_api_response({"error" => "You must be logged in to use the api"}) if tr8n_current_user_is_guest?
44
-
45
43
  language = Tr8n::Language.for(params[:language]) || tr8n_current_language
46
- source = CGI.unescape(params[:source]) || "API"
44
+ source = CGI.unescape(params[:source] || "API")
47
45
 
48
46
  return sanitize_api_response(translate_phrase(language, params, {:source => source})) if params[:label]
49
47
 
@@ -51,7 +49,7 @@ class Tr8n::Api::V1::LanguageController < Tr8n::Api::V1::BaseController
51
49
  # {:source => "", :language => "", :phrases => [{:label => ""}]}
52
50
 
53
51
  # get all phrases for the specified source
54
- if params[:batch] == "true"
52
+ if params[:batch] == "true" or params[:cache] == "true"
55
53
  if params[:sources].blank? and params[:source].blank?
56
54
  return sanitize_api_response({"error" => "No source/sources have been provided for the batch request."})
57
55
  end
@@ -73,6 +71,10 @@ class Tr8n::Api::V1::LanguageController < Tr8n::Api::V1::BaseController
73
71
  translations << trn
74
72
  end
75
73
 
74
+ if params[:sdk_jsvar]
75
+ return render(:text => "#{params[:sdk_jsvar]}.updateTranslations(#{translations.to_json});", :content_type => "text/javascript")
76
+ end
77
+
76
78
  return sanitize_api_response({:phrases => translations})
77
79
  elsif params[:phrases]
78
80
 
@@ -92,7 +94,7 @@ class Tr8n::Api::V1::LanguageController < Tr8n::Api::V1::BaseController
92
94
  return sanitize_api_response({:phrases => translations})
93
95
  end
94
96
 
95
- sanitize_api_response({"error" => "Invalid API request. Please read the documentation and try again."})
97
+ sanitize_api_response(:phrases => {})
96
98
  rescue Tr8n::KeyRegistrationException => ex
97
99
  sanitize_api_response({"error" => ex.message})
98
100
  end
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -43,8 +43,8 @@ module Tr8n
43
43
  end
44
44
 
45
45
  before_filter :validate_tr8n_enabled, :except => [:translate]
46
- before_filter :validate_guest_user, :except => [:select, :switch, :translate, :table]
47
- before_filter :validate_current_user, :except => [:translate]
46
+ before_filter :validate_guest_user, :except => [:select, :switch, :translate, :table, :registration]
47
+ before_filter :validate_current_user, :except => [:select, :switch, :translate, :table, :registration]
48
48
 
49
49
  layout Tr8n::Config.site_info[:tr8n_layout]
50
50
 
@@ -149,10 +149,16 @@ module Tr8n
149
149
 
150
150
  # make sure users have the rights to access this section
151
151
  def validate_current_user
152
- unless Tr8n::Config.open_registration_mode? or Tr8n::Config.current_user_is_translator?
152
+ return if Tr8n::Config.current_user_is_translator?
153
+
154
+ unless Tr8n::Config.open_registration_mode?
153
155
  trfe("You don't have rights to access that section.")
154
156
  return redirect_to(Tr8n::Config.default_url)
155
157
  end
158
+
159
+ if Tr8n::Config.enable_registration_disclaimer?
160
+ redirect_to("/tr8n/translator/registration")
161
+ end
156
162
  end
157
163
 
158
164
  # make sure that the current user is a translator
@@ -170,12 +176,12 @@ module Tr8n
170
176
 
171
177
  if tr8n_current_language.default?
172
178
  trfe("Only administrators can modify this language")
173
- return redirect_to(@tabs.first[:link])
179
+ return redirect_to(tr8n_features_tabs.first[:link])
174
180
  end
175
181
 
176
182
  unless tr8n_current_user_is_translator? and tr8n_current_translator.manager?
177
183
  trfe("In order to manage a language you first must request to become a manager of that language. Please send your request to Geni support.")
178
- return redirect_to(@tabs.first[:link])
184
+ return redirect_to(tr8n_features_tabs.first[:link])
179
185
  end
180
186
  end
181
187
 
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -41,7 +41,7 @@ class Tr8n::PhrasesController < Tr8n::BaseController
41
41
  end
42
42
  end
43
43
 
44
- @translation_keys = @translation_keys.order("label asc").page(page).per(per_page)
44
+ @translation_keys = @translation_keys.order("created_at desc").page(page).per(per_page)
45
45
  end
46
46
 
47
47
  def view
@@ -23,6 +23,14 @@
23
23
 
24
24
  class Tr8n::TranslatorController < Tr8n::BaseController
25
25
 
26
+ def registration
27
+ if params[:agree] == "yes"
28
+ Tr8n::Config.current_translator # this will register a translator
29
+ trfn("Thank you! You have been register as a translator")
30
+ return redirect_to("/tr8n/phrases")
31
+ end
32
+ end
33
+
26
34
  def index
27
35
  @fallback_language = (tr8n_current_translator.fallback_language || tr8n_default_language)
28
36
  end
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich, tr8n.net
2
+ # Copyright (c) 2010-2012 Michael Berkovich, tr8n.net
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -36,25 +36,33 @@ class Tr8n::Language < ActiveRecord::Base
36
36
  has_many :translation_key_locks, :class_name => 'Tr8n::TranslationKeyLock', :dependent => :destroy
37
37
  has_many :language_metrics, :class_name => 'Tr8n::LanguageMetric'
38
38
 
39
- def self.find_or_create(lcl, english_name)
40
- find_by_locale(lcl) || create(:locale => lcl, :english_name => english_name)
39
+ def self.cache_key(locale)
40
+ "language_#{locale}"
41
+ end
42
+
43
+ def cache_key
44
+ self.class.cache_key(locale)
41
45
  end
42
46
 
43
47
  def self.for(locale)
44
48
  return nil if locale.nil?
45
- Tr8n::Cache.fetch("language_#{locale}") do
49
+ Tr8n::Cache.fetch(cache_key(locale)) do
46
50
  find_by_locale(locale)
47
51
  end
48
52
  end
49
53
 
54
+ def self.find_or_create(lcl, english_name)
55
+ find_by_locale(lcl) || create(:locale => lcl, :english_name => english_name)
56
+ end
57
+
50
58
  def rules
51
- Tr8n::Cache.fetch("language_rules_#{id}") do
59
+ Tr8n::Cache.fetch("language_rules_#{locale}") do
52
60
  language_rules
53
61
  end
54
62
  end
55
63
 
56
64
  def cases
57
- Tr8n::Cache.fetch("language_cases_#{id}") do
65
+ Tr8n::Cache.fetch("language_cases_#{locale}") do
58
66
  language_cases
59
67
  end
60
68
  end
@@ -64,6 +72,7 @@ class Tr8n::Language < ActiveRecord::Base
64
72
  reset_language_cases!
65
73
  end
66
74
 
75
+ # reloads rules for the language from the yml file
67
76
  def reset_language_rules!
68
77
  rules.delete_all
69
78
  Tr8n::Config.language_rule_classes.each do |rule_class|
@@ -73,6 +82,7 @@ class Tr8n::Language < ActiveRecord::Base
73
82
  end
74
83
  end
75
84
 
85
+ # reloads language cases for the language from the yml file
76
86
  def reset_language_cases!
77
87
  cases.delete_all
78
88
  Tr8n::Config.default_language_cases_for(locale).each do |lcase|
@@ -308,7 +318,9 @@ class Tr8n::Language < ActiveRecord::Base
308
318
  end
309
319
 
310
320
  def update_cache
311
- Tr8n::Cache.delete("language_#{locale}")
321
+ Tr8n::Cache.delete(cache_key)
322
+ Tr8n::Cache.delete("language_rules_#{locale}")
323
+ Tr8n::Cache.delete("language_cases_#{locale}")
312
324
  Tr8n::Cache.delete("featured_languages")
313
325
  Tr8n::Cache.delete("enabled_languages")
314
326
  end