translate-rails3 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.2
@@ -1,7 +1,14 @@
1
1
  class TranslateController < ActionController::Base
2
2
  # It seems users with active_record_store may get a "no :secret given" error if we don't disable csrf protection,
3
3
  skip_before_filter :verify_authenticity_token
4
+
5
+ # password = `hostname`.chomp
6
+ # Rails.logger.info("The translation password is #{password}")
7
+ # http_basic_authenticate_with :name => "translate", :password => password
8
+
9
+ protected
4
10
 
11
+
5
12
  prepend_view_path(File.join(File.dirname(__FILE__), "..", "views"))
6
13
  layout 'translate'
7
14
 
@@ -1,20 +1,5 @@
1
1
  module TranslateHelper
2
2
 
3
- def render_translate_form(from_locale, to_locale, key)
4
- from_text = lookup(from_locale, key)
5
- if from_text.is_a?(String)
6
- render :partial => 'string_form', :locals =>
7
- {:from_locale => from_locale,
8
- :to_locale => to_locale,
9
- :key => key}
10
- elsif from_text.is_a?(Array)
11
- render :partial => 'array_form', :locals =>
12
- {:from_locale => from_locale,
13
- :to_locale => to_locale,
14
- :key => key}
15
- end
16
- end
17
-
18
3
  def from_locales
19
4
  # Attempt to get the list of locale from configuration
20
5
  from_loc = Rails.application.config.from_locales if Rails.application.config.respond_to?(:from_locales)
@@ -301,6 +301,7 @@
301
301
  div.translation{
302
302
  padding:1em;
303
303
  border-bottom:solid 0.2em #d46021;
304
+ border-left: solid 0.1em #D46021;
304
305
  margin:0 1em 1em 1.6em;
305
306
  }
306
307
  div.translation input, div.translation textarea{
@@ -1,53 +1,53 @@
1
1
  <%
2
- @page_title = "Translate"
3
- show_filters = ["all", "untranslated", "translated"]
4
- show_filters << "changed" if @from_locale != @to_locale
2
+ @page_title = "Translate"
3
+ show_filters = ["all", "untranslated", "translated"]
4
+ show_filters << "changed" if @from_locale != @to_locale
5
5
  %>
6
6
 
7
7
  <fieldset>
8
- <legend>Search filter</legend>
9
- <div id="show-sort">
10
- <p>
11
- <label>Show:</label> <%= raw simple_filter(show_filters) %>
12
- </p>
13
- <p>
14
- <label>Sort by:</label> <%= raw simple_filter(["key", "text"], 'sort_by') %>
15
- </p>
16
- </div>
17
- <%= form_tag(params, :method => :get) do %>
18
- <div id="languages">
19
- <p>
20
- <%= hidden_field_tag(:filter, params[:filter]) %>
21
- <%= hidden_field_tag(:sort_by, params[:sort_by]) %>
22
- <label>Translate from</label>
23
- <%= select_tag(:from_locale, options_for_select(from_locales, @from_locale.to_sym)) %> <span>to</span>
24
- <%= select_tag(:to_locale, options_for_select(to_locales, @to_locale.to_sym)) %>
25
- <%= submit_tag "Display" %>
26
- </p>
27
- </div>
28
- <div id="filter-pattern">
29
- <p>
30
- <label for="key_pattern_value">Key</label>
31
- <%= select_tag(:key_type, options_for_select([["contains", 'contains'], ["starts with", 'starts_with']], params[:key_type])) %>
32
- <%= text_field_tag(:key_pattern, params[:key_pattern], :size => 50, :id => "key_pattern_value", :class => "text-default") %>
33
- </p>
34
- <p>
35
- <label for="text_pattern_value">Text</label>
36
- <%= select_tag(:text_type, options_for_select(['contains', 'equals'], params[:text_type])) %>
37
- <%= text_field_tag(:text_pattern, params[:text_pattern], :size => 50, :id => "text_pattern_value", :class => "text-default") %>
38
- </p>
39
- <p>
40
- <%= submit_tag "Search" %>
41
- <%= link_to "clear", params.merge({:text_pattern => nil, :key_pattern => nil}) %>
8
+ <legend>Search filter</legend>
9
+ <div id="show-sort">
10
+ <p>
11
+ <label>Show:</label> <%= raw simple_filter(show_filters) %>
12
+ </p>
13
+ <p>
14
+ <label>Sort by:</label> <%= raw simple_filter(["key", "text"], 'sort_by') %>
42
15
  </p>
43
16
  </div>
17
+ <%= form_tag(params, :method => :get) do %>
18
+ <div id="languages">
19
+ <p>
20
+ <%= hidden_field_tag(:filter, params[:filter]) %>
21
+ <%= hidden_field_tag(:sort_by, params[:sort_by]) %>
22
+ <label>Translate from</label>
23
+ <%= select_tag(:from_locale, options_for_select(from_locales, @from_locale.to_sym)) %> <span>to</span>
24
+ <%= select_tag(:to_locale, options_for_select(to_locales, @to_locale.to_sym)) %>
25
+ <%= submit_tag "Display" %>
26
+ </p>
27
+ </div>
28
+ <div id="filter-pattern">
29
+ <p>
30
+ <label for="key_pattern_value">Key</label>
31
+ <%= select_tag(:key_type, options_for_select([["contains", 'contains'], ["starts with", 'starts_with']], params[:key_type])) %>
32
+ <%= text_field_tag(:key_pattern, params[:key_pattern], :size => 50, :id => "key_pattern_value", :class => "text-default") %>
33
+ </p>
34
+ <p>
35
+ <label for="text_pattern_value">Text</label>
36
+ <%= select_tag(:text_type, options_for_select(['contains', 'equals'], params[:text_type])) %>
37
+ <%= text_field_tag(:text_pattern, params[:text_pattern], :size => 50, :id => "text_pattern_value", :class => "text-default") %>
38
+ </p>
39
+ <p>
40
+ <%= submit_tag "Search" %>
41
+ <%= link_to "clear", params.merge({:text_pattern => nil, :key_pattern => nil}) %>
42
+ </p>
43
+ </div>
44
44
  <% end %>
45
- <p class="hits">
46
- Found <strong><%= @total_entries %></strong> messages
47
- </p>
48
- <p>
49
- <%= link_to "Reload messages", translate_reload_path %>
50
- </p>
45
+ <p class="hits">
46
+ Found <strong><%= @total_entries %></strong> messages
47
+ </p>
48
+ <p>
49
+ <%= link_to "Reload messages", translate_reload_path %>
50
+ </p>
51
51
  </fieldset>
52
52
 
53
53
 
@@ -56,32 +56,35 @@
56
56
  </div>
57
57
 
58
58
  <% if @total_entries > 0 %>
59
- <%= form_tag(translate_path) do %>
60
- <div>
59
+ <%= form_tag(translate_path) do %>
60
+ <div>
61
61
  <%= hidden_field_tag(:filter, params[:filter], :id => "hid_filter") %>
62
62
  <%= hidden_field_tag(:sort_by, params[:sort_by], :id => "hid_sort_by") %>
63
63
  <%= hidden_field_tag(:key_type, params[:key_type], :id => "hid_key_type") %>
64
64
  <%= hidden_field_tag(:key_pattern, params[:key_pattern], :id => "hid_key_pattern") %>
65
65
  <%= hidden_field_tag(:text_type, params[:text_type], :id => "hid_text_type") %>
66
66
  <%= hidden_field_tag(:text_pattern, params[:text_pattern], :id => "hid_text_pattern") %>
67
- </div>
68
- <div class="translations">
69
- <h2>Translations from <%= @from_locale %> to <%= @to_locale %></h2>
70
- <p class="translate">
71
- <%= submit_tag "Save Translations" %>
72
- </p>
73
- <% @paginated_keys.each do |key| %>
74
- <%=
75
- # this is a helper method, we need to determine if the thing we are trying to translate is
76
- # a string or an array, and it would be very messey if i put everything in this view
77
- render_translate_form(@from_locale, @to_locale, key)
78
- %>
79
- <% end %>
80
- <p class="translate">
81
- <%= submit_tag "Save Translations" %>
82
- </p>
83
- </div>
84
- <% end %>
67
+ </div>
68
+ <div class="translations">
69
+ <h2>Translations from <%= @from_locale %> to <%= @to_locale %></h2>
70
+ <p class="translate">
71
+ <%= submit_tag "Save Translations" %>
72
+ </p>
73
+ <% @paginated_keys.each do |key| %>
74
+ <%=
75
+ from_text = lookup(@from_locale, key)
76
+ render (from_text.is_a?(Array) ? 'array_form' : 'string_form'), {
77
+ :from_locale => @from_locale,
78
+ :to_locale => @to_locale,
79
+ :key => key,
80
+ }
81
+ %>
82
+ <% end %>
83
+ <p class="translate">
84
+ <%= submit_tag "Save Translations" %>
85
+ </p>
86
+ </div>
87
+ <% end %>
85
88
  <% end %>
86
89
 
87
90
  <div class="paging">
data/config/routes.rb CHANGED
@@ -2,4 +2,4 @@ Rails.application.routes.draw do
2
2
  match 'translate' => 'translate#index', :as => :translate_list
3
3
  match 'translate/translate' => 'translate#translate', :as => :translate
4
4
  match 'translate/reload' => 'translate#reload', :as => :translate_reload
5
- end if Rails.env.development?
5
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "translate-rails3"
8
- s.version = "0.2.0"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Peter Marklund", "Milan Novota", "Roman Shterenzon"]
12
- s.date = "2011-12-16"
12
+ s.date = "2012-01-16"
13
13
  s.description = "This plugin provides a web interface for translating Rails I18n texts\n(requires Rails 3.0 or higher) from one locale to another.\nThe plugin has been tested only with the simple I18n backend that ships\nwith Rails.\nI18n texts are read from and written to YAML files under config/locales.\n\nThis gem is a fork of the original https://github.com/mynewsdesk/translate\nand also includes work from this fork: https://github.com/milann/translate\n"
14
14
  s.email = "romanbsd@yahoo.com"
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: translate-rails3
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.0
5
+ version: 0.2.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Peter Marklund
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2011-12-16 00:00:00 Z
15
+ date: 2012-01-16 00:00:00 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: ya2yaml