interpret 0.2.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -4
- data/Gemfile +2 -3
- data/README.md +1 -10
- data/{public/stylesheets → app/assets/images}/folder.png +0 -0
- data/{public → app/assets}/javascripts/interpret.js +0 -0
- data/{public/stylesheets/interpret_style.css → app/assets/stylesheets/interpret_style.css.erb} +1 -1
- data/app/controllers/interpret/base_controller.rb +1 -1
- data/app/controllers/interpret/search_controller.rb +8 -2
- data/app/controllers/interpret/tools_controller.rb +5 -5
- data/app/controllers/interpret/translations_controller.rb +59 -69
- data/app/models/interpret/translation.rb +1 -0
- data/app/views/interpret/missing_translations/blank.html.erb +1 -1
- data/app/views/interpret/missing_translations/index.html.erb +1 -1
- data/app/views/interpret/missing_translations/stale.html.erb +2 -2
- data/app/views/interpret/search/_blank_search.html.erb +1 -1
- data/app/views/interpret/search/_filled_search.html.erb +1 -1
- data/app/views/interpret/tools/index.html.erb +2 -2
- data/app/views/interpret/translations/_listing.html.erb +3 -3
- data/app/views/interpret/translations/new.html.erb +2 -2
- data/app/views/layouts/interpret/interpret.html.erb +55 -0
- data/app/views/layouts/{interpret_base.html.erb → interpret/interpret_base.html.erb} +0 -0
- data/config/routes.rb +19 -21
- data/{lib/generators/interpret/templates/migration.rb → db/migrate/20111108094329_create_translations.rb} +3 -4
- data/interpret.gemspec +3 -3
- data/lib/interpret/engine.rb +6 -4
- data/lib/interpret/helpers.rb +4 -53
- data/lib/interpret/version.rb +1 -1
- data/lib/interpret.rb +0 -4
- data/script/rails +5 -0
- data/spec/integration/missing_translations_spec.rb +8 -8
- data/spec/integration/search_spec.rb +8 -8
- data/spec/integration/stale_translations_spec.rb +5 -5
- data/spec/integration/tools_spec.rb +9 -9
- data/spec/integration/translations_spec.rb +2 -2
- data/spec/spec_helper.rb +2 -9
- data/spec/support/load_routes.rb +6 -0
- data/test_app/Gemfile +11 -6
- data/test_app/{public → app/assets}/images/a1.gif +0 -0
- data/test_app/{public → app/assets}/images/a10.jpg +0 -0
- data/test_app/{public → app/assets}/images/a16.gif +0 -0
- data/test_app/{public → app/assets}/images/a18.gif +0 -0
- data/test_app/{public → app/assets}/images/a22.gif +0 -0
- data/test_app/{public → app/assets}/images/a26.gif +0 -0
- data/test_app/{public → app/assets}/images/a33.gif +0 -0
- data/test_app/{public → app/assets}/images/a36.gif +0 -0
- data/test_app/{public → app/assets}/images/a38.gif +0 -0
- data/test_app/{public → app/assets}/images/a41.gif +0 -0
- data/test_app/{public → app/assets}/images/a47.gif +0 -0
- data/test_app/{public → app/assets}/images/a50.gif +0 -0
- data/test_app/{public → app/assets}/images/a8.gif +0 -0
- data/test_app/{public → app/assets}/images/abg.gif +0 -0
- data/test_app/{public → app/assets}/images/pic1.jpg +0 -0
- data/test_app/{public → app/assets}/images/pic2.jpg +0 -0
- data/test_app/{public → app/assets}/images/spacer.gif +0 -0
- data/test_app/{public → app/assets}/images/upbg.gif +0 -0
- data/test_app/app/assets/javascripts/application.js +4 -0
- data/test_app/{public → app/assets}/stylesheets/.gitkeep +0 -0
- data/test_app/{public/stylesheets/default.css → app/assets/stylesheets/default.css.erb} +16 -16
- data/test_app/{public → app/assets}/stylesheets/private.css +0 -0
- data/test_app/app/controllers/admin/dashboard_controller.rb +6 -0
- data/test_app/app/views/admin/dashboard/index.html.erb +1 -0
- data/test_app/app/views/layouts/application.html.erb +3 -13
- data/test_app/app/views/layouts/backoffice.html.erb +3 -4
- data/test_app/app/views/pages/index.html.erb +2 -2
- data/test_app/config/application.rb +12 -3
- data/test_app/config/environments/development.rb +0 -1
- data/test_app/config/initializers/interpret.rb +0 -1
- data/test_app/config/routes.rb +10 -1
- data/test_app/db/migrate/{20111021100344_interpret_create_translations.rb → 20111108094455_create_translations.rb} +3 -4
- data/test_app/db/schema.rb +3 -0
- metadata +60 -78
- data/app/views/interpret/translations/live_edit.html.erb +0 -11
- data/app/views/layouts/interpret.html.erb +0 -56
- data/lib/generators/interpret/migration_generator.rb +0 -25
- data/lib/generators/interpret/setup_generator.rb +0 -21
- data/lib/interpret/capistrano.rb +0 -18
- data/lib/interpret/controller_filter.rb +0 -12
- data/public/javascripts/facebox-1.3/closelabel.png +0 -0
- data/public/javascripts/facebox-1.3/facebox.css +0 -80
- data/public/javascripts/facebox-1.3/facebox.js +0 -309
- data/public/javascripts/facebox-1.3/loading.gif +0 -0
- data/public/stylesheets/interpret_live_edit_style.css +0 -38
- data/test_app/config/deploy.rb +0 -24
- data/test_app/config/initializers/rack_patch.rb +0 -13
- data/test_app/public/javascripts/application.js +0 -2
- data/test_app/public/javascripts/best_in_place.js +0 -456
- data/test_app/public/javascripts/facebox-1.3/closelabel.png +0 -0
- data/test_app/public/javascripts/facebox-1.3/facebox.css +0 -80
- data/test_app/public/javascripts/facebox-1.3/facebox.js +0 -309
- data/test_app/public/javascripts/facebox-1.3/loading.gif +0 -0
- data/test_app/public/javascripts/interpret.js +0 -4
- data/test_app/public/javascripts/rails.js +0 -134
- data/test_app/public/stylesheets/folder.png +0 -0
- data/test_app/public/stylesheets/interpret_live_edit_style.css +0 -38
- data/test_app/public/stylesheets/interpret_style.css +0 -535
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -422,18 +422,9 @@ backoffice.
|
|
422
422
|
rake interpret:update
|
423
423
|
rake interpret:dump
|
424
424
|
|
425
|
-
The `update` task is what you may want to run after a deployment
|
426
|
-
Interpret already has a capistrano recipe...
|
425
|
+
The `update` task is what you may want to run after a deployment.
|
427
426
|
|
428
427
|
|
429
|
-
Capistrano recipe
|
430
|
-
-----------------
|
431
|
-
|
432
|
-
Interpret also have a capistrano recipe to run the `update` rake task after
|
433
|
-
updating code. You only need to require this file in your `deploy.rb`:
|
434
|
-
|
435
|
-
require 'interpret/capistrano'
|
436
|
-
|
437
428
|
|
438
429
|
Soft behavior
|
439
430
|
--------------
|
File without changes
|
File without changes
|
data/{public/stylesheets/interpret_style.css → app/assets/stylesheets/interpret_style.css.erb}
RENAMED
@@ -502,7 +502,7 @@ html body * dd.clear
|
|
502
502
|
padding: .4em;
|
503
503
|
}
|
504
504
|
#interpret_container #tree_sidebar li {
|
505
|
-
list-style-image: url("
|
505
|
+
list-style-image: url(<%= asset_path "folder.png" %>);
|
506
506
|
font-weight: normal;
|
507
507
|
padding-bottom: 5px;
|
508
508
|
letter-spacing: 1px;
|
@@ -2,7 +2,7 @@ class Interpret::BaseController < eval(Interpret.parent_controller.classify)
|
|
2
2
|
before_filter :set_locale
|
3
3
|
before_filter { authorize! :use, :interpret }
|
4
4
|
before_filter :check_authorized_language
|
5
|
-
layout 'interpret'
|
5
|
+
layout 'interpret/interpret'
|
6
6
|
|
7
7
|
protected
|
8
8
|
def current_interpret_user
|
@@ -6,7 +6,7 @@ class Interpret::SearchController < Interpret::BaseController
|
|
6
6
|
opts = {}
|
7
7
|
opts[:key] = params[:key] if params[:key].present?
|
8
8
|
opts[:value] = params[:value] if params[:value].present?
|
9
|
-
redirect_to
|
9
|
+
redirect_to search_url(opts)
|
10
10
|
else
|
11
11
|
if params[:key].present? || params[:value].present?
|
12
12
|
sanitizer = case ActiveRecord::Base.connection.adapter_name
|
@@ -22,7 +22,13 @@ class Interpret::SearchController < Interpret::BaseController
|
|
22
22
|
t = Interpret::Translation.arel_table
|
23
23
|
search_key = params[:key].present? ? params[:key].split(" ").map{|x| sanitizer.call(x)} : []
|
24
24
|
search_value = params[:value].present? ? params[:value].split(" ").map{|x| sanitizer.call(x)} : []
|
25
|
-
|
25
|
+
if search_value.any? && search_key.any?
|
26
|
+
@translations = Interpret::Translation.allowed.locale(I18n.locale).where(t[:key].matches_all(search_key).or(t[:value].matches_all(search_value))).order("translations.key ASC")
|
27
|
+
elsif search_key.any?
|
28
|
+
@translations = Interpret::Translation.allowed.locale(I18n.locale).where(t[:key].matches_all(search_key)).order("translations.key ASC")
|
29
|
+
else
|
30
|
+
@translations = Interpret::Translation.allowed.locale(I18n.locale).where(t[:value].matches_all(search_value)).order("translations.key ASC")
|
31
|
+
end
|
26
32
|
end
|
27
33
|
end
|
28
34
|
end
|
@@ -6,7 +6,7 @@ class Interpret::ToolsController < Interpret::BaseController
|
|
6
6
|
|
7
7
|
session.delete(:tree)
|
8
8
|
Interpret.backend.reload! if Interpret.backend
|
9
|
-
redirect_to
|
9
|
+
redirect_to tools_url, :notice => "Dump done."
|
10
10
|
end
|
11
11
|
|
12
12
|
def export
|
@@ -22,26 +22,26 @@ class Interpret::ToolsController < Interpret::BaseController
|
|
22
22
|
def run_update
|
23
23
|
Interpret::Translation.update
|
24
24
|
Interpret.backend.reload! if Interpret.backend
|
25
|
-
redirect_to
|
25
|
+
redirect_to tools_url, :notice => "Update done"
|
26
26
|
end
|
27
27
|
|
28
28
|
def import
|
29
29
|
unless params.has_key? :file
|
30
|
-
redirect_to
|
30
|
+
redirect_to tools_url, :alert => "You have to select a file to import."
|
31
31
|
return
|
32
32
|
end
|
33
33
|
|
34
34
|
begin
|
35
35
|
Interpret::Translation.import(params[:file])
|
36
36
|
rescue Exception => e
|
37
|
-
redirect_to
|
37
|
+
redirect_to tools_url, :alert => "Error when importing: #{e.message}"
|
38
38
|
return
|
39
39
|
end
|
40
40
|
|
41
41
|
session.delete(:tree)
|
42
42
|
Interpret.backend.reload! if Interpret.backend
|
43
43
|
|
44
|
-
redirect_to
|
44
|
+
redirect_to tools_url, :notice => "Import successfully done."
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
@@ -1,89 +1,79 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
module Interpret
|
2
|
+
class TranslationsController < Interpret::BaseController
|
3
|
+
before_filter :get_tree, :only => :index
|
4
|
+
authorize_resource :class => "Interpret::Translation"
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
def index
|
7
|
+
key = params[:key]
|
8
|
+
t = Interpret::Translation.arel_table
|
9
|
+
if key
|
10
|
+
@translations = Interpret::Translation.allowed.locale(I18n.locale).where(t[:key].matches("#{CGI.escape(key)}.%")).order("translations.key ASC")
|
11
|
+
if I18n.locale != I18n.default_locale
|
12
|
+
@references = Interpret::Translation.allowed.locale(I18n.default_locale).where(t[:key].matches("#{CGI.escape(key)}.%")).order("translations.key ASC")
|
13
|
+
end
|
14
|
+
else
|
15
|
+
@translations = Interpret::Translation.allowed.locale(I18n.locale).where(t[:key].does_not_match("%.%")).order("translations.key ASC")
|
16
|
+
if I18n.locale != I18n.default_locale
|
17
|
+
@references = Interpret::Translation.allowed.locale(I18n.default_locale).where(t[:key].does_not_match("%.%")).order("translations.key ASC")
|
18
|
+
end
|
17
19
|
end
|
20
|
+
|
21
|
+
# not show translations inside nested folders, \w avoids dots
|
22
|
+
@translations = @translations.select{|x| x.key =~ /#{key}\.\w+$/} if key
|
23
|
+
@references = @references.select{|x| x.key =~ /#{key}\.\w+$/} if key && @references
|
24
|
+
|
25
|
+
@total_keys_number = Interpret::Translation.locale(I18n.locale).count
|
18
26
|
end
|
19
27
|
|
20
|
-
|
21
|
-
|
22
|
-
|
28
|
+
def edit
|
29
|
+
@translation = Interpret::Translation.find(params[:id])
|
30
|
+
end
|
23
31
|
|
24
|
-
|
25
|
-
|
32
|
+
def update
|
33
|
+
@translation = Interpret::Translation.find(params[:id])
|
34
|
+
old_value = @translation.value
|
26
35
|
|
27
|
-
|
28
|
-
|
29
|
-
|
36
|
+
respond_to do |format|
|
37
|
+
if @translation.update_attributes(params[:translation].presence || params[:interpret_translation])
|
38
|
+
msg = ""
|
39
|
+
msg << "By [#{@interpret_user}]. " if @interpret_user
|
40
|
+
msg << "Locale: [#{@translation.locale}], key: [#{@translation.key}]. The translation has been changed from [#{old_value}] to [#{@translation.value}]"
|
41
|
+
Interpret.logger.info msg
|
30
42
|
|
31
|
-
|
32
|
-
|
33
|
-
|
43
|
+
format.html { redirect_to(request.env["HTTP_REFERER"]) }
|
44
|
+
format.xml { head :ok }
|
45
|
+
format.json { head :ok }
|
46
|
+
else
|
47
|
+
format.html { redirect_to(request.env["HTTP_REFERER"]) }
|
48
|
+
format.xml { render :xml => @translation.errors, :status => :unprocessable_entity }
|
49
|
+
format.json { render :status => :unprocessable_entity }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
34
53
|
|
35
|
-
|
36
|
-
|
37
|
-
msg = ""
|
38
|
-
msg << "By [#{@interpret_user}]. " if @interpret_user
|
39
|
-
msg << "Locale: [#{@translation.locale}], key: [#{@translation.key}]. The translation has been changed from [#{old_value}] to [#{@translation.value}]"
|
40
|
-
Interpret.logger.info msg
|
54
|
+
def create
|
55
|
+
@translation = Interpret::Translation.new params[:translation]
|
41
56
|
|
42
|
-
|
43
|
-
|
44
|
-
|
57
|
+
if @translation.save
|
58
|
+
flash[:notice] = "New translation created for #{@translation.key}"
|
59
|
+
redirect_to request.env["HTTP_REFERER"]
|
45
60
|
else
|
46
|
-
|
47
|
-
|
48
|
-
format.json { render :status => :unprocessable_entity }
|
61
|
+
flash[:alert] = "Error when creating a new translation"
|
62
|
+
redirect_to request.env["HTTP_REFERER"]
|
49
63
|
end
|
50
64
|
end
|
51
|
-
end
|
52
65
|
|
53
|
-
|
54
|
-
|
66
|
+
def destroy
|
67
|
+
@translation = Interpret::Translation.find(params[:id])
|
55
68
|
|
56
|
-
|
57
|
-
flash[:notice] = "
|
58
|
-
redirect_to request.env["HTTP_REFERER"]
|
59
|
-
else
|
60
|
-
flash[:alert] = "Error when creating a new translation"
|
69
|
+
@translation.destroy
|
70
|
+
flash[:notice] = "Translation #{@translation.key} destroyed."
|
61
71
|
redirect_to request.env["HTTP_REFERER"]
|
62
72
|
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def destroy
|
66
|
-
@translation = Interpret::Translation.find(params[:id])
|
67
|
-
|
68
|
-
@translation.destroy
|
69
|
-
flash[:notice] = "Translation #{@translation.key} destroyed."
|
70
|
-
redirect_to request.env["HTTP_REFERER"]
|
71
|
-
end
|
72
73
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
key = blobs[1..-1].join(".")
|
77
|
-
@translation = Interpret::Translation.locale(locale).find_by_key(key)
|
78
|
-
|
79
|
-
respond_to do |format|
|
80
|
-
format.html { render :layout => false }
|
74
|
+
private
|
75
|
+
def get_tree
|
76
|
+
@tree ||= Interpret::Translation.get_tree
|
81
77
|
end
|
82
78
|
end
|
83
|
-
|
84
|
-
private
|
85
|
-
def get_tree
|
86
|
-
@tree ||= Interpret::Translation.get_tree
|
87
|
-
end
|
88
|
-
|
89
79
|
end
|
@@ -18,7 +18,7 @@
|
|
18
18
|
<td><%= trans.key %></td>
|
19
19
|
<td><%= ref || "It's empty" %></td>
|
20
20
|
<td>
|
21
|
-
<%= form_for Interpret::Translation.new, :url =>
|
21
|
+
<%= form_for Interpret::Translation.new, :url => translations_path do |f| %>
|
22
22
|
<%= f.hidden_field "locale", :value => I18n.locale %>
|
23
23
|
<%= f.hidden_field "key", :value => trans.key %>
|
24
24
|
<%= f.text_area :value, :rows => 4, :cols => 60 %>
|
@@ -24,7 +24,7 @@
|
|
24
24
|
<td><%= trans[:key] %></td>
|
25
25
|
<td><%= trans[:ref_value] %></td>
|
26
26
|
<td>
|
27
|
-
<%= form_for Interpret::Translation.new, :url =>
|
27
|
+
<%= form_for Interpret::Translation.new, :url => translations_path do |f| %>
|
28
28
|
<%= f.hidden_field "locale", :value => I18n.locale %>
|
29
29
|
<%= f.hidden_field "key", :value => trans[:key] %>
|
30
30
|
<%= f.text_area :value, :rows => 4, :cols => 60 %>
|
@@ -27,12 +27,12 @@
|
|
27
27
|
<td class='content' id='translation_<%= trans.id %>'>
|
28
28
|
<%= best_in_place trans, :value,
|
29
29
|
:type => :textarea,
|
30
|
-
:path =>
|
30
|
+
:path => translation_path(trans),
|
31
31
|
:activator => "#translation_#{trans.id}",
|
32
32
|
:sanitize => false %>
|
33
33
|
</td>
|
34
34
|
<td>
|
35
|
-
<%= form_for trans, :url =>
|
35
|
+
<%= form_for trans, :url => translation_path(trans) do |f| %>
|
36
36
|
<%= f.hidden_field :stale, :value => false %>
|
37
37
|
<%= submit_tag "Mark as OK" %>
|
38
38
|
<% end %>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
<p>With the following button you can download a "<%= I18n.locale %>.yml" file with the current translations for this language.</p>
|
8
8
|
|
9
9
|
<p>
|
10
|
-
<%= button_to "Download",
|
10
|
+
<%= button_to "Download", export_tools_path, :method => :get %>
|
11
11
|
</p>
|
12
12
|
|
13
13
|
<div class="header">
|
@@ -23,7 +23,7 @@ and if they already exists they will be overwritten.
|
|
23
23
|
Remember that the first key of the YAML file you're uploading must match the current locale.
|
24
24
|
</p>
|
25
25
|
|
26
|
-
<%= form_tag
|
26
|
+
<%= form_tag import_tools_path, :multipart => true do %>
|
27
27
|
<%= label_tag "File:" %>
|
28
28
|
<%= file_field_tag :file %>
|
29
29
|
<%= submit_tag "Upload" %>
|
@@ -18,7 +18,7 @@
|
|
18
18
|
<td class="content" id="translation_<%= x.id %>">
|
19
19
|
<%= best_in_place x, :value,
|
20
20
|
:type => :textarea,
|
21
|
-
:path =>
|
21
|
+
:path => translation_path(x),
|
22
22
|
:activator => "#translation_#{x.id}",
|
23
23
|
:sanitize => false %>
|
24
24
|
</td>
|
@@ -34,11 +34,11 @@
|
|
34
34
|
<% if trans %>
|
35
35
|
<%= best_in_place trans, :value,
|
36
36
|
:type => :textarea,
|
37
|
-
:path =>
|
37
|
+
:path => translation_path(trans),
|
38
38
|
:activator => "#translation_#{trans.id}",
|
39
39
|
:sanitize => false %>
|
40
40
|
<% else %>
|
41
|
-
<%= link_to "Create this missing translation",
|
41
|
+
<%= link_to "Create this missing translation", missing_translations_path %>
|
42
42
|
<% end %>
|
43
43
|
</td>
|
44
44
|
</tr>
|
@@ -6,10 +6,10 @@
|
|
6
6
|
Previous value:
|
7
7
|
<b>[<%= @reference.locale %>] <%= @reference.value %></b>
|
8
8
|
</p>
|
9
|
-
<%= form_for [@reference, @translation], :url =>
|
9
|
+
<%= form_for [@reference, @translation], :url => translation_translations_path(@reference) do |f| %>
|
10
10
|
<%= f.label :value, "Translation to [#{I18n.locale}]" %>
|
11
11
|
<%= f.text_area :value, :value => @translation.value %>
|
12
12
|
<%= f.submit %>
|
13
13
|
<% end %>
|
14
14
|
|
15
|
-
<%= link_to "Back",
|
15
|
+
<%= link_to "Back", root_path %>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<div id="interpret_container">
|
2
|
+
<% if flash.any? %>
|
3
|
+
<div class="interpret_flash grid_16 <%= flash.keys.first %>">
|
4
|
+
<%= flash[:notice] || flash[:alert] %>
|
5
|
+
</div>
|
6
|
+
<% end %>
|
7
|
+
<div class="menu grid_12">
|
8
|
+
<%= link_to "Overview", root_path, :class => controller_name == "translations" && action_name == "index" ? "current" : "" %>
|
9
|
+
|
10
|
+
<% if can? :use, :tools%>
|
11
|
+
| <%= link_to "Tools", tools_path, :class => controller_name == "tools" ? "current" : "" %>
|
12
|
+
<% end%>
|
13
|
+
|
14
|
+
<% if can? :use, :search%>
|
15
|
+
| <%= link_to "Search", search_path, :class => controller_name == "search" ? "current" : ""%>
|
16
|
+
<% end%>
|
17
|
+
|
18
|
+
<% if can? :read, :missing_translations%>
|
19
|
+
| <%= link_to "Missing translations", missing_translations_path, :class => controller_name == "missing_translations" && action_name == "index" ? "current" : ""%>
|
20
|
+
<% end%>
|
21
|
+
|
22
|
+
<% if can? :read, :stale_translations%>
|
23
|
+
| <%= link_to "Stale translations", stale_translations_path, :class => controller_name == "missing_translations" && action_name == "stale" ? "current" : ""%>
|
24
|
+
<% end%>
|
25
|
+
|
26
|
+
<% if can? :read, :blank_translations%>
|
27
|
+
| <%= link_to "Blank translations", blank_translations_path, :class => controller_name == "missing_translations" && action_name == "blank" ? "current" : ""%>
|
28
|
+
<% end%>
|
29
|
+
|
30
|
+
<% if can? :read, :unused_translations%>
|
31
|
+
| <%= link_to "Unused translations", unused_translations_path, :class => controller_name == "missing_translations" && action_name == "unused" ? "current" : ""%>
|
32
|
+
<% end%>
|
33
|
+
<hr />
|
34
|
+
</div>
|
35
|
+
<div class="menu grid_4" id='languages_nav'>
|
36
|
+
Languages:
|
37
|
+
<% Interpret::Translation.available_locales.each do |locale| %>
|
38
|
+
<% next unless can? :use, :"interpret_in_#{locale}" %>
|
39
|
+
<% opts = {:locale => locale} %>
|
40
|
+
<% opts[:key] = params[:key] if params[:key] %>
|
41
|
+
<% opts[:value] = params[:value] if params[:value] %>
|
42
|
+
<%= link_to locale, opts %>
|
43
|
+
<% end %>
|
44
|
+
<hr />
|
45
|
+
</div>
|
46
|
+
<div class="clearfix"></div>
|
47
|
+
<div id="sidebar" class="grid_3">
|
48
|
+
<%= yield :sidebar %>
|
49
|
+
</div>
|
50
|
+
<div id="main" class="grid_13">
|
51
|
+
<%= yield %>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
|
55
|
+
<%= interpret_parent_layout Interpret.layout%>
|
File without changes
|
data/config/routes.rb
CHANGED
@@ -1,28 +1,26 @@
|
|
1
|
-
|
2
|
-
scope
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
get :live_edit
|
7
|
-
end
|
1
|
+
Interpret::Engine.routes.draw do
|
2
|
+
scope ":locale" do
|
3
|
+
resources :translations, :only => [:destroy, :edit, :update, :create] do
|
4
|
+
collection do
|
5
|
+
get :live_edit
|
8
6
|
end
|
7
|
+
end
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
end
|
9
|
+
resources :tools, :only => :index do
|
10
|
+
collection do
|
11
|
+
get :export
|
12
|
+
post :import
|
13
|
+
post :dump
|
14
|
+
post :run_update
|
17
15
|
end
|
16
|
+
end
|
18
17
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
match "search", :to => "search#index"
|
19
|
+
resources :missing_translations
|
20
|
+
match "blank", :to => "missing_translations#blank", :as => "blank_translations"
|
21
|
+
match "unused", :to => "missing_translations#unused", :as => "unused_translations"
|
22
|
+
match "stale", :to => "missing_translations#stale", :as => "stale_translations"
|
24
23
|
|
25
|
-
|
26
|
-
end
|
24
|
+
root :to => "translations#index"
|
27
25
|
end
|
28
26
|
end
|
@@ -1,5 +1,5 @@
|
|
1
|
-
class
|
2
|
-
def
|
1
|
+
class CreateTranslations < ActiveRecord::Migration
|
2
|
+
def up
|
3
3
|
create_table :translations do |t|
|
4
4
|
t.string :locale
|
5
5
|
t.string :key
|
@@ -10,8 +10,7 @@ class InterpretCreateTranslations < ActiveRecord::Migration
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def down
|
14
14
|
drop_table :translations
|
15
15
|
end
|
16
16
|
end
|
17
|
-
|
data/interpret.gemspec
CHANGED
@@ -19,11 +19,11 @@ Gem::Specification.new do |s|
|
|
19
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
20
|
s.require_paths = ["lib"]
|
21
21
|
|
22
|
-
s.add_dependency "rails", "~> 3.0
|
23
|
-
s.add_dependency "i18n", "~> 0.
|
22
|
+
s.add_dependency "rails", "~> 3.1.0"
|
23
|
+
s.add_dependency "i18n", "~> 0.6.0"
|
24
24
|
s.add_dependency "i18n-active_record"
|
25
25
|
s.add_dependency "ya2yaml", ">= 0.30.0"
|
26
|
-
s.add_dependency "best_in_place", "~> 0.
|
26
|
+
s.add_dependency "best_in_place", "~> 1.0.0"
|
27
27
|
s.add_dependency "lazyhash", ">= 0.1.1"
|
28
28
|
s.add_dependency "cancan", "~> 1.6.0"
|
29
29
|
|
data/lib/interpret/engine.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
require 'i18n/backend/active_record'
|
2
1
|
require 'interpret/logger'
|
3
2
|
require 'interpret/helpers'
|
4
|
-
require 'interpret/controller_filter'
|
5
3
|
|
6
4
|
module Interpret
|
7
5
|
class Engine < Rails::Engine
|
6
|
+
isolate_namespace Interpret
|
7
|
+
|
8
8
|
initializer "interpret.register_i18n_active_record_backend" do |app|
|
9
9
|
app.config.after_initialize do
|
10
10
|
if Interpret.registered_envs.include?(Rails.env.to_sym)
|
@@ -25,10 +25,12 @@ module Interpret
|
|
25
25
|
|
26
26
|
|
27
27
|
initializer "interpret.register_observer" do |app|
|
28
|
-
app.config.before_initialize do |app|
|
28
|
+
#app.config.before_initialize do |app|
|
29
|
+
require 'active_record'
|
30
|
+
require 'i18n/backend/active_record'
|
29
31
|
ActiveRecord::Base.observers << Interpret.sweeper.to_sym if Interpret.sweeper && I18n::Backend::ActiveRecord::Translation.table_exists?
|
30
32
|
ActiveRecord::Base.observers << :"interpret/expiration_observer" if !Interpret.sweeper && I18n::Backend::ActiveRecord::Translation.table_exists?
|
31
|
-
end
|
33
|
+
#end
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|