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
@@ -0,0 +1,63 @@
1
+ <div class="inner">
2
+ <div class="hd">
3
+ <span style="float:right;">
4
+ <%=link_to_function(image_tag("tr8n/close.gif"), "tr8nLightbox.hide();")%>
5
+ </span>
6
+ <%=trl("Tr8n Translation Memory Statistics")%>
7
+ </div>
8
+
9
+ <style>
10
+ .stats td {
11
+ font-size:12px;
12
+ font-weight:bold;
13
+ padding:5px;
14
+ text-align:left;
15
+ border-bottom:1px solid #ccc;
16
+ }
17
+ </style>
18
+
19
+ <div class="bd">
20
+ <table class="stats" style="width:100%" celppading="0px" cellspacing="0px">
21
+ <tr>
22
+ <td style="">Total Languages</td>
23
+ <td style="text-align:right;"><%=Tr8n::Language.count%></td>
24
+ </tr>
25
+ <tr>
26
+ <td style="">Enabled Languages</td>
27
+ <td style="text-align:right;"><%=Tr8n::Language.enabled_languages.count%></td>
28
+ </tr>
29
+ <tr>
30
+ <td style="">Translators</td>
31
+ <td style="text-align:right;"><%=Tr8n::Translator.count%></td>
32
+ </tr>
33
+ <tr>
34
+ <td style="">Translation Keys</td>
35
+ <td style="text-align:right;"><%=Tr8n::TranslationKey.count%></td>
36
+ </tr>
37
+ <tr>
38
+ <td style="">Translations</td>
39
+ <td style="text-align:right;"><%=Tr8n::Translation.count%></td>
40
+ </tr>
41
+ <tr>
42
+ <td style="">Translation Votes</td>
43
+ <td style="text-align:right;"><%=Tr8n::TranslationVote.count%></td>
44
+ </tr>
45
+ <tr>
46
+ <td style="">Sources</td>
47
+ <td style="text-align:right;"><%=Tr8n::TranslationSource.count%></td>
48
+ </tr>
49
+
50
+ <tr>
51
+ <td style="">Cache Enabled</td>
52
+ <td style="text-align:right;"><%=Tr8n::Cache.enabled?%></td>
53
+ </tr>
54
+
55
+ <% if Tr8n::Cache.enabled? %>
56
+ <tr>
57
+ <td style="">Cache Version</td>
58
+ <td style="text-align:right;"><%=Tr8n::Cache.version%></td>
59
+ </tr>
60
+ <% end %>
61
+ </table>
62
+ </div>
63
+ </div>
data/bin/tr8n.rb ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # puts File.expand_path(__FILE__)
4
+
5
+ if ARGV.empty?
6
+ puts "usage: tr8n <command> [<args>]"
7
+ puts ""
8
+ puts "The most commonly used commands are:"
9
+ puts " lookup\tLooks up a context for a given label"
10
+ puts " sync\tSynchronizes the current tr8n instance with tr8n.net"
11
+ puts ""
12
+ end
13
+
14
+ if ARGV.first == 'lookup'
15
+ if ARGV.size < 2
16
+ puts "Please provide a label you would like to lookup"
17
+ else
18
+ puts "lookup #{ARGV.last}"
19
+ end
20
+ end
21
+
22
+
23
+
24
+
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2010 Michael Berkovich, Geni Inc
2
+ # Copyright (c) 2010-2012 Michael Berkovich
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,3 +1,26 @@
1
+ #--
2
+ # Copyright (c) 2010-2012 Michael Berkovich
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
+
1
24
  class CreateTr8nSyncTables < ActiveRecord::Migration
2
25
  def up
3
26
  create_table :tr8n_sync_logs do |t|
@@ -1,3 +1,26 @@
1
+ #--
2
+ # Copyright (c) 2010-2012 Michael Berkovich
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
+
1
24
  class AddRemoteIdToTr8nTranslators < ActiveRecord::Migration
2
25
  def change
3
26
  add_column :tr8n_translators, :remote_id, :integer
@@ -0,0 +1,34 @@
1
+ #--
2
+ # Copyright (c) 2010-2012 Michael Berkovich
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 CreateTr8nTranslationSourceLanguages < ActiveRecord::Migration
25
+ def change
26
+ create_table :tr8n_translation_source_languages do |t|
27
+ t.integer :language_id
28
+ t.integer :translation_source_id
29
+ t.timestamps
30
+ end
31
+
32
+ add_index :tr8n_translation_source_languages, [:language_id, :translation_source_id], :name => :tsllt
33
+ end
34
+ end
@@ -15,14 +15,13 @@
15
15
  #
16
16
  #############################################################################
17
17
 
18
- defaults: &defaults
18
+ defaults:
19
19
  enable_tr8n: true # enables the engine
20
20
  enable_key_source_tracking: false # builds the site map sources - must be enabled for the API
21
21
  enable_key_caller_tracking: false # tracks all calls to labels with their traces - for debugging only
22
22
 
23
23
  enable_glossary_hints: true # shows glossary in the translator
24
24
  enable_software_keyboard: true # shows the soft keyboard icon
25
- enable_google_suggestions: true # uses google for suggestions
26
25
  enable_keyboard_shortcuts: true # adds some keyboard shortcuts like ctrl+shift+s
27
26
  enable_dictionary_lookup: true # shows dictionary words definitions
28
27
 
@@ -40,6 +39,19 @@ defaults: &defaults
40
39
 
41
40
  enable_country_tracking: true # tracks and reports translator countries
42
41
 
42
+ #############################################################################
43
+ # Google translation suggestions is now a paid feature by Google.
44
+ #
45
+ # In order to enable this useful feauture, visit:
46
+ # http://code.google.com/apis/language/translate/overview.html
47
+ #
48
+ # Provide your billing information and register for an API key.
49
+ #
50
+ # Put your API key in the box below.
51
+ #############################################################################
52
+ enable_google_suggestions: false # uses google for suggestions
53
+ google_api_key: "YOUR GOOGLE API KEY" # get this API key from Google.
54
+
43
55
  #############################################################################
44
56
  # Featured languages can be added as a bottom strip bar on all pages using
45
57
  #
@@ -73,7 +85,7 @@ defaults: &defaults
73
85
  # store: memory_store # only for dev or test - single instance
74
86
  # store: file_store # only for dev or test - single instance
75
87
  # store: drb_store
76
- # store: [mem_cache_store, 'localhost:11211'] # recommended
88
+ # store: ['mem_cache_store', 'localhost:11211'] # recommended
77
89
  #
78
90
  # If you choose to use memcached, don't forget to add the gem to your Gemfile:
79
91
  #
@@ -82,12 +94,14 @@ defaults: &defaults
82
94
  # You can also provide your own implementation of the adapter:
83
95
  #
84
96
  # cache_adapter: YOUR_CACHE_ADAPTER_CLASS
97
+ #
98
+ # Note: Make sure you enable config.class_caching in your environment file
85
99
  #
86
100
  #############################################################################
87
101
  caching:
88
102
  enabled: false
89
103
  adapter: ActiveSupport::Cache
90
- store: ['mem_cache_store', 'localhost:11211']
104
+ store: 'memory_store'
91
105
  version: 1 # you can change the version to invalidate the cache
92
106
 
93
107
  #############################################################################
@@ -262,21 +276,11 @@ defaults: &defaults
262
276
  # You can overload any feature defined in the defaults for any environment
263
277
  #############################################################################
264
278
  development:
265
- <<: *defaults
266
- # enable_key_source_tracking: false
267
279
 
268
280
  test:
269
- <<: *defaults
270
- # enable_key_source_tracking: false
271
281
 
272
282
  qa:
273
- <<: *defaults
274
- # enable_key_source_tracking: false
275
283
 
276
284
  stage:
277
- <<: *defaults
278
- # enable_key_source_tracking: false
279
285
 
280
286
  production:
281
- <<: *defaults
282
- # 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';"
@@ -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
@@ -37,7 +37,7 @@ class CreateTr8nTables < ActiveRecord::Migration
37
37
  t.string :facebook_key
38
38
  t.timestamps
39
39
  end
40
- add_index :tr8n_languages, [:locale]
40
+ add_index :tr8n_languages, [:locale], :name => :tr8n_ll
41
41
 
42
42
  create_table :tr8n_language_rules do |t|
43
43
  t.integer :language_id, :null => false
@@ -46,8 +46,8 @@ class CreateTr8nTables < ActiveRecord::Migration
46
46
  t.text :definition
47
47
  t.timestamps
48
48
  end
49
- add_index :tr8n_language_rules, [:language_id]
50
- add_index :tr8n_language_rules, [:language_id, :translator_id]
49
+ add_index :tr8n_language_rules, [:language_id], :name => :tr8n_lr_l
50
+ add_index :tr8n_language_rules, [:language_id, :translator_id], :name => :tr8n_lr_lt
51
51
 
52
52
  create_table :tr8n_language_cases do |t|
53
53
  t.integer :language_id, :null => false
@@ -59,9 +59,9 @@ class CreateTr8nTables < ActiveRecord::Migration
59
59
  t.string :application
60
60
  t.timestamps
61
61
  end
62
- add_index :tr8n_language_cases, [:language_id]
63
- add_index :tr8n_language_cases, [:language_id, :translator_id]
64
- add_index :tr8n_language_cases, [:language_id, :keyword]
62
+ add_index :tr8n_language_cases, [:language_id], :name => :tr8n_lc_l
63
+ add_index :tr8n_language_cases, [:language_id, :translator_id], :name => :tr8n_lc_lt
64
+ add_index :tr8n_language_cases, [:language_id, :keyword], :name => :tr8n_lc_lk
65
65
 
66
66
  create_table :tr8n_language_case_value_maps do |t|
67
67
  t.string :keyword, :null => false
@@ -71,8 +71,8 @@ class CreateTr8nTables < ActiveRecord::Migration
71
71
  t.boolean :reported
72
72
  t.timestamps
73
73
  end
74
- add_index :tr8n_language_case_value_maps, [:keyword, :language_id]
75
- add_index :tr8n_language_case_value_maps, [:translator_id]
74
+ add_index :tr8n_language_case_value_maps, [:keyword, :language_id], :name => :tr8n_lcvm_kl
75
+ add_index :tr8n_language_case_value_maps, [:translator_id], :name => :tr8n_lcvm_t
76
76
 
77
77
  create_table :tr8n_language_users do |t|
78
78
  t.integer :language_id, :null => false
@@ -81,11 +81,11 @@ class CreateTr8nTables < ActiveRecord::Migration
81
81
  t.boolean :manager, :default => false
82
82
  t.timestamps
83
83
  end
84
- add_index :tr8n_language_users, [:user_id]
85
- add_index :tr8n_language_users, [:language_id, :user_id]
86
- add_index :tr8n_language_users, [:language_id, :translator_id]
87
- add_index :tr8n_language_users, [:created_at]
88
- add_index :tr8n_language_users, [:updated_at]
84
+ add_index :tr8n_language_users, [:user_id], :name => :tr8n_lu_u
85
+ add_index :tr8n_language_users, [:language_id, :user_id], :name => :tr8n_lu_lu
86
+ add_index :tr8n_language_users, [:language_id, :translator_id], :name => :tr8n_lu_lt
87
+ add_index :tr8n_language_users, [:created_at], :name => :tr8n_lu_ca
88
+ add_index :tr8n_language_users, [:updated_at], :name => :tr8n_lu_ua
89
89
 
90
90
  create_table :tr8n_language_metrics do |t|
91
91
  t.string :type
@@ -100,8 +100,8 @@ class CreateTr8nTables < ActiveRecord::Migration
100
100
 
101
101
  t.timestamps
102
102
  end
103
- add_index :tr8n_language_metrics, [:language_id]
104
- add_index :tr8n_language_metrics, [:created_at]
103
+ add_index :tr8n_language_metrics, [:language_id], :name => :tr8n_lm_l
104
+ add_index :tr8n_language_metrics, [:created_at], :name => :tr8n_lm_c
105
105
 
106
106
  create_table :tr8n_translators do |t|
107
107
  t.integer :user_id, :null => false
@@ -121,12 +121,13 @@ class CreateTr8nTables < ActiveRecord::Migration
121
121
  t.integer :manager
122
122
  t.string :last_ip
123
123
  t.string :country_code
124
+ t.integer :remote_id
124
125
  t.timestamps
125
126
  end
126
- add_index :tr8n_translators, [:user_id]
127
- add_index :tr8n_translators, [:created_at]
128
- add_index :tr8n_translators, [:email]
129
- add_index :tr8n_translators, [:email, :password]
127
+ add_index :tr8n_translators, [:user_id], :name => :tr8n_t_u
128
+ add_index :tr8n_translators, [:created_at], :name => :tr8n_t_c
129
+ add_index :tr8n_translators, [:email], :name => :tr8n_t_e
130
+ add_index :tr8n_translators, [:email, :password], :name => :tr8n_t_ep
130
131
 
131
132
  create_table :tr8n_translator_logs do |t|
132
133
  t.integer :translator_id
@@ -137,9 +138,9 @@ class CreateTr8nTables < ActiveRecord::Migration
137
138
  t.string :reference
138
139
  t.timestamps
139
140
  end
140
- add_index :tr8n_translator_logs, [:translator_id]
141
- add_index :tr8n_translator_logs, [:user_id]
142
- add_index :tr8n_translator_logs, [:created_at]
141
+ add_index :tr8n_translator_logs, [:translator_id], :name => :tr8n_tl_t
142
+ add_index :tr8n_translator_logs, [:user_id], :name => :tr8n_tl_u
143
+ add_index :tr8n_translator_logs, [:created_at], :name => :tr8n_tl_c
143
144
 
144
145
  create_table :tr8n_translator_metrics do |t|
145
146
  t.integer :translator_id, :null => false
@@ -152,9 +153,9 @@ class CreateTr8nTables < ActiveRecord::Migration
152
153
  t.integer :rejected_translations, :default => 0
153
154
  t.timestamps
154
155
  end
155
- add_index :tr8n_translator_metrics, [:translator_id]
156
- add_index :tr8n_translator_metrics, [:translator_id, :language_id]
157
- add_index :tr8n_translator_metrics, [:created_at]
156
+ add_index :tr8n_translator_metrics, [:translator_id], :name => :tr8n_tm_t
157
+ add_index :tr8n_translator_metrics, [:translator_id, :language_id], :name => :tr8n_tm_tl
158
+ add_index :tr8n_translator_metrics, [:created_at], :name => :tr8n_tm_c
158
159
 
159
160
  create_table :tr8n_translation_keys do |t|
160
161
  t.string :type
@@ -166,16 +167,17 @@ class CreateTr8nTables < ActiveRecord::Migration
166
167
  t.boolean :admin
167
168
  t.string :locale
168
169
  t.integer :level, :default => 0
170
+ t.timestamp :synced_at
169
171
  t.timestamps
170
172
  end
171
- add_index :tr8n_translation_keys, [:key], :unique => true
173
+ add_index :tr8n_translation_keys, [:key], :unique => true, :name => :tr8n_tk_k
172
174
 
173
175
  create_table :tr8n_translation_sources do |t|
174
176
  t.string :source
175
177
  t.integer :translation_domain_id
176
178
  t.timestamps
177
179
  end
178
- add_index :tr8n_translation_sources, [:source], :name => "tr8n_sources_source"
180
+ add_index :tr8n_translation_sources, [:source], :name => :tr8n_ts_s
179
181
 
180
182
  create_table :tr8n_translation_key_sources do |t|
181
183
  t.integer :translation_key_id, :null => false
@@ -183,8 +185,8 @@ class CreateTr8nTables < ActiveRecord::Migration
183
185
  t.text :details
184
186
  t.timestamps
185
187
  end
186
- add_index :tr8n_translation_key_sources, [:translation_key_id], :name => "tr8n_trans_keys_key_id"
187
- add_index :tr8n_translation_key_sources, [:translation_source_id], :name => "tr8n_trans_keys_source_id"
188
+ add_index :tr8n_translation_key_sources, [:translation_key_id], :name => :tr8n_tks_tk
189
+ add_index :tr8n_translation_key_sources, [:translation_source_id], :name => :tr8n_tks_ts
188
190
 
189
191
  create_table :tr8n_translation_key_locks do |t|
190
192
  t.integer :translation_key_id, :null => false
@@ -193,7 +195,7 @@ class CreateTr8nTables < ActiveRecord::Migration
193
195
  t.boolean :locked, :default => false
194
196
  t.timestamps
195
197
  end
196
- add_index :tr8n_translation_key_locks, [:translation_key_id, :language_id], :name => "tr8n_locks_key_id_lang_id"
198
+ add_index :tr8n_translation_key_locks, [:translation_key_id, :language_id], :name => :tr8n_tkl_tl
197
199
 
198
200
  create_table :tr8n_translations do |t|
199
201
  t.integer :translation_key_id, :null => false
@@ -203,11 +205,12 @@ class CreateTr8nTables < ActiveRecord::Migration
203
205
  t.integer :rank, :default => 0
204
206
  t.integer :approved_by_id, :limit => 8
205
207
  t.text :rules
208
+ t.timestamp :synced_at
206
209
  t.timestamps
207
210
  end
208
- add_index :tr8n_translations, [:translator_id], :name => "r8n_trans_translator_id"
209
- add_index :tr8n_translations, [:translation_key_id, :translator_id, :language_id], :name => "tr8n_trans_key_id_translator_id_lang_id"
210
- add_index :tr8n_translations, [:created_at], :name => "tr8n_trans_created_at"
211
+ add_index :tr8n_translations, [:translator_id], :name => :tr8n_trn_t
212
+ add_index :tr8n_translations, [:translation_key_id, :translator_id, :language_id], :name => :tr8n_trn_tktl
213
+ add_index :tr8n_translations, [:created_at], :name => :tr8n_trn_c
211
214
 
212
215
  create_table :tr8n_translation_votes do |t|
213
216
  t.integer :translation_id, :null => false
@@ -215,8 +218,8 @@ class CreateTr8nTables < ActiveRecord::Migration
215
218
  t.integer :vote, :null => false
216
219
  t.timestamps
217
220
  end
218
- add_index :tr8n_translation_votes, [:translator_id], :name => "tr8n_trans_votes_translator_id"
219
- add_index :tr8n_translation_votes, [:translation_id, :translator_id], :name => "tr8n_trans_votes_trans_id_translator_id"
221
+ add_index :tr8n_translation_votes, [:translator_id], :name => :tr8n_tv_t
222
+ add_index :tr8n_translation_votes, [:translation_id, :translator_id], :name => :tr8n_tv_tt
220
223
 
221
224
  create_table :tr8n_glossary do |t|
222
225
  t.string :keyword
@@ -231,8 +234,8 @@ class CreateTr8nTables < ActiveRecord::Migration
231
234
  t.text :topic, :null => false
232
235
  t.timestamps
233
236
  end
234
- add_index :tr8n_language_forum_topics, [:language_id], :name => "tr8n_forum_topics_lang_id"
235
- add_index :tr8n_language_forum_topics, [:translator_id], :name => "tr8n_forum_topics_translator_id"
237
+ add_index :tr8n_language_forum_topics, [:language_id], :name => :tr8n_lft_l
238
+ add_index :tr8n_language_forum_topics, [:translator_id], :name => :tr8n_lft_t
236
239
 
237
240
  create_table :tr8n_language_forum_messages do |t|
238
241
  t.integer :language_id, :null => false
@@ -241,9 +244,9 @@ class CreateTr8nTables < ActiveRecord::Migration
241
244
  t.text :message, :null => false
242
245
  t.timestamps
243
246
  end
244
- add_index :tr8n_language_forum_messages, [:language_id], :name => "tr8n_forum_msgs_lang_id"
245
- add_index :tr8n_language_forum_messages, [:translator_id], :name => "tr8n_forums_msgs_translator_id"
246
- add_index :tr8n_language_forum_messages, [:language_id, :language_forum_topic_id], :name => "tr8n_forum_msgs_lang_id_topic_id"
247
+ add_index :tr8n_language_forum_messages, [:language_id], :name => :tr8n_lfm_l
248
+ add_index :tr8n_language_forum_messages, [:translator_id], :name => :tr8n_lfm_t
249
+ add_index :tr8n_language_forum_messages, [:language_id, :language_forum_topic_id], :name => :tr8n_lfm_ll
247
250
 
248
251
  create_table :tr8n_language_forum_abuse_reports do |t|
249
252
  t.integer :language_id, :null => false
@@ -252,9 +255,9 @@ class CreateTr8nTables < ActiveRecord::Migration
252
255
  t.string :reason
253
256
  t.timestamps
254
257
  end
255
- add_index :tr8n_language_forum_abuse_reports, [:language_id], :name => "tr8n_forum_reports_lang_id"
256
- add_index :tr8n_language_forum_abuse_reports, [:language_id, :translator_id], :name => "tr8n_forum_reports_lang_id_translator_id"
257
- add_index :tr8n_language_forum_abuse_reports, [:language_forum_message_id], :name => "tr8n_forum_reports_message_id"
258
+ add_index :tr8n_language_forum_abuse_reports, [:language_id], :name => :tr8n_lfar_l
259
+ add_index :tr8n_language_forum_abuse_reports, [:language_id, :translator_id], :name => :tr8n_lfar_lt
260
+ add_index :tr8n_language_forum_abuse_reports, [:language_forum_message_id], :name => :tr8n_lfar_lfm
258
261
 
259
262
  create_table :tr8n_translation_key_comments do |t|
260
263
  t.integer :language_id, :null => false
@@ -263,9 +266,9 @@ class CreateTr8nTables < ActiveRecord::Migration
263
266
  t.text :message, :null => false
264
267
  t.timestamps
265
268
  end
266
- add_index :tr8n_translation_key_comments, [:language_id], :name => "tr8n_tkey_msgs_lang_id"
267
- add_index :tr8n_translation_key_comments, [:translator_id], :name => "tr8n_tkey_msgs_translator_id"
268
- add_index :tr8n_translation_key_comments, [:language_id, :translation_key_id], :name => "tr8n_tkey_msgs_lang_id_tkey_id"
269
+ add_index :tr8n_translation_key_comments, [:language_id], :name => :tr8n_tkc_l
270
+ add_index :tr8n_translation_key_comments, [:translator_id], :name => :tr8n_tkc_t
271
+ add_index :tr8n_translation_key_comments, [:language_id, :translation_key_id], :name => :tr8n_tkc_lt
269
272
 
270
273
  create_table :tr8n_language_case_rules do |t|
271
274
  t.integer :language_case_id, :null => false
@@ -275,9 +278,9 @@ class CreateTr8nTables < ActiveRecord::Migration
275
278
  t.integer :position
276
279
  t.timestamps
277
280
  end
278
- add_index :tr8n_language_case_rules, [:language_case_id], :name => "tr8n_lcr_case_id"
279
- add_index :tr8n_language_case_rules, [:language_id], :name => "tr8n_lcr_lang_id"
280
- add_index :tr8n_language_case_rules, [:translator_id], :name => "tr8n_lcr_translator_id"
281
+ add_index :tr8n_language_case_rules, [:language_case_id], :name => :tr8n_lcr_lc
282
+ add_index :tr8n_language_case_rules, [:language_id], :name => :tr8n_lcr_l
283
+ add_index :tr8n_language_case_rules, [:translator_id], :name => :tr8n_lcr_t
281
284
 
282
285
  create_table :tr8n_translation_domains do |t|
283
286
  t.string :name
@@ -285,7 +288,7 @@ class CreateTr8nTables < ActiveRecord::Migration
285
288
  t.integer :source_count, :default => 0
286
289
  t.timestamps
287
290
  end
288
- add_index :tr8n_translation_domains, [:name], :unique => true
291
+ add_index :tr8n_translation_domains, [:name], :unique => true, :name => :tr8n_td_n
289
292
 
290
293
  create_table :tr8n_translator_following do |t|
291
294
  t.integer :translator_id
@@ -293,7 +296,7 @@ class CreateTr8nTables < ActiveRecord::Migration
293
296
  t.string :object_type
294
297
  t.timestamps
295
298
  end
296
- add_index :tr8n_translator_following, [:translator_id]
299
+ add_index :tr8n_translator_following, [:translator_id], :name => :tr8n_tf_t
297
300
 
298
301
  create_table :tr8n_translator_reports do |t|
299
302
  t.integer :translator_id
@@ -304,7 +307,7 @@ class CreateTr8nTables < ActiveRecord::Migration
304
307
  t.text :comment
305
308
  t.timestamps
306
309
  end
307
- add_index :tr8n_translator_reports, [:translator_id]
310
+ add_index :tr8n_translator_reports, [:translator_id], :name => :tr8n_tr_t
308
311
 
309
312
  create_table :tr8n_ip_locations do |t|
310
313
  t.integer :low, :limit => 8
@@ -316,8 +319,25 @@ class CreateTr8nTables < ActiveRecord::Migration
316
319
  t.string :country, :limit => 80
317
320
  t.timestamps
318
321
  end
319
- add_index :tr8n_ip_locations, [:low]
320
- add_index :tr8n_ip_locations, [:high]
322
+ add_index :tr8n_ip_locations, [:low], :name => :tr8n_il_l
323
+ add_index :tr8n_ip_locations, [:high], :name => :tr8n_il_h
324
+
325
+ create_table :tr8n_translation_source_languages do |t|
326
+ t.integer :language_id
327
+ t.integer :translation_source_id
328
+ t.timestamps
329
+ end
330
+ add_index :tr8n_translation_source_languages, [:language_id, :translation_source_id], :name => :tr8n_tsl_lt
331
+
332
+ create_table :tr8n_sync_logs do |t|
333
+ t.timestamp :started_at
334
+ t.timestamp :finished_at
335
+ t.integer :keys_sent
336
+ t.integer :translations_sent
337
+ t.integer :keys_received
338
+ t.integer :translations_received
339
+ t.timestamps
340
+ end
321
341
  end
322
342
 
323
343
  def self.down
@@ -346,5 +366,7 @@ class CreateTr8nTables < ActiveRecord::Migration
346
366
  drop_table :tr8n_translator_following
347
367
  drop_table :tr8n_translator_reports
348
368
  drop_table :tr8n_ip_locations
369
+ drop_table :tr8n_translation_source_languages
370
+ drop_table :tr8n_sync_logs
349
371
  end
350
372
  end
@@ -45,7 +45,7 @@ class Tr8nGenerator < Rails::Generators::Base
45
45
  end
46
46
 
47
47
  def copy_configuration
48
- config_source = File.expand_path('../../../../config/tr8n', __FILE__)
48
+ config_source = File.expand_path("#{self.class.source_root}/config', __FILE__)
49
49
  system "rsync -ruv #{config_source} #{Rails.root}/config"
50
50
  end
51
51