translate-rails3-plus 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,35 +1,35 @@
1
- <%
2
- from_text = lookup(from_locale, key)
3
- to_text = lookup(to_locale, key)
4
- line_size = 100
5
- n_lines = n_lines(from_text, line_size)
6
- field_name = "key[#{key}]"
7
- %>
8
-
9
- <div class="translation single-translation" >
10
- <% if from_text.present? %>
11
- <% if from_text.starts_with?(" ") || from_text.ends_with?(" ")%>
12
- <%= simple_format("&rarr;" + h(from_text) + "&larr;", :class => "translation-text" ) %>
13
- <% else %>
14
- <%= simple_format(h(from_text), :class => "translation-text") %>
15
- <% end %>
16
- <% end %>
17
- <p class="edit-form">
18
- <% if n_lines > 1 %>
19
- <%= text_area_tag(field_name, to_text, :size => "#{line_size}x#{n_lines}", :id => key, :class=>'edit-field') %>
20
- <% else %>
21
- <%= text_field_tag(field_name, to_text, :size => line_size, :id => key, :class=>'edit-field') %>
22
- <% end %>
23
- </p>
24
- <div class="error-text"></div>
25
- <p>
26
- <em>
27
- <%= translate_link(key, from_text, @from_locale, @to_locale) %>
28
- <br/>
29
- <strong>Key:</strong><%=h key %><br/>
30
- <% if @files[key] %>
31
- <strong>File:</strong><%= @files[key].join("<br/>") %>
32
- <% end %>
33
- </em>
34
- </p>
35
- </div>
1
+ <%
2
+ from_text = lookup(from_locale, key)
3
+ to_text = lookup(to_locale, key)
4
+ line_size = 100
5
+ n_lines = n_lines(from_text, line_size)
6
+ field_name = "key[#{key}]"
7
+ %>
8
+
9
+ <div class="translation single-translation" >
10
+ <% if from_text.present? %>
11
+ <% if from_text.starts_with?(" ") || from_text.ends_with?(" ")%>
12
+ <%= simple_format("&rarr;" + h(from_text) + "&larr;", :class => "translation-text" ) %>
13
+ <% else %>
14
+ <%= simple_format(h(from_text), :class => "translation-text") %>
15
+ <% end %>
16
+ <% end %>
17
+ <p class="edit-form">
18
+ <% if n_lines > 1 %>
19
+ <%= text_area_tag(field_name, to_text, :size => "#{line_size}x#{n_lines}", :id => key, :class=>'edit-field') %>
20
+ <% else %>
21
+ <%= text_field_tag(field_name, to_text, :size => line_size, :id => key, :class=>'edit-field') %>
22
+ <% end %>
23
+ </p>
24
+ <div class="error-text"></div>
25
+ <p>
26
+ <em>
27
+ <%= translate_link(key, from_text, @from_locale, @to_locale) %>
28
+ <br/>
29
+ <strong>Key:</strong><%=h key %><br/>
30
+ <% if @files[key] %>
31
+ <strong>File:</strong><%= @files[key].join("<br/>") %>
32
+ <% end %>
33
+ </em>
34
+ </p>
35
+ </div>
@@ -1,96 +1,96 @@
1
- <%
2
- show_filters = ["all", "untranslated", "translated"]
3
- show_filters << "changed" if @from_locale != @to_locale
4
- %>
5
-
6
- <fieldset>
7
- <legend>Search filter</legend>
8
- <div id="show-sort">
9
- <p>
10
- <label>Show:</label> <%= raw simple_filter(show_filters) %>
11
- </p>
12
- <p>
13
- <label>Sort by:</label> <%= raw simple_filter(["key", "text"], 'sort_by') %>
14
- </p>
15
- </div>
16
- <%= form_tag(params, :method => :get) do %>
17
- <div id="languages">
18
- <p>
19
- <%= hidden_field_tag(:filter, params[:filter]) %>
20
- <%= hidden_field_tag(:sort_by, params[:sort_by]) %>
21
- <label>Translate from</label>
22
- <%= select_tag(:from_locale, options_for_select(from_locales, @from_locale.to_sym)) %> <span>to</span>
23
- <%= select_tag(:to_locale, options_for_select(to_locales, @to_locale.to_sym)) %>
24
- <%= submit_tag "Display" %>
25
- </p>
26
- </div>
27
- <div id="filter-pattern">
28
- <p>
29
- <label for="key_pattern_value">Key</label>
30
- <%= select_tag(:key_type, options_for_select([["contains", 'contains'], ["starts with", 'starts_with']], params[:key_type])) %>
31
- <%= text_field_tag(:key_pattern, params[:key_pattern], :size => 50, :id => "key_pattern_value", :class => "text-default") %>
32
- </p>
33
- <p>
34
- <label for="text_pattern_value">Text</label>
35
- <%= select_tag(:text_type, options_for_select(['contains', 'equals'], params[:text_type])) %>
36
- <%= text_field_tag(:text_pattern, params[:text_pattern], :size => 50, :id => "text_pattern_value", :class => "text-default") %>
37
- </p>
38
- <p>
39
- <label for="translated_text_pattern_value">Translated Text</label>
40
- <%= select_tag(:translated_text_type, options_for_select(['contains', 'equals'], params[:translated_text_type])) %>
41
- <%= text_field_tag(:translated_text_pattern, params[:translated_text_pattern], :size => 50, :id => "translated_text_pattern_value", :class => "text-default") %>
42
- </p>
43
- <p>
44
- <%= submit_tag "Search" %>
45
- <%= link_to "clear", params.merge({:text_pattern => nil, :translated_text_pattern => nil, :key_pattern => nil}) %>
46
- </p>
47
- </div>
48
- <% end %>
49
- <p class="hits">
50
- Found <strong><%= @total_entries %></strong> messages
51
- </p>
52
- <p>
53
- <%= link_to "Reload messages", translate_reload_path %>
54
- </p>
55
- </fieldset>
56
-
57
-
58
- <div class="paging">
59
- <%= render :partial => 'pagination', :locals => {:total_entries => @total_entries, :per_page => per_page} %>
60
- </div>
61
-
62
- <% if @total_entries > 0 %>
63
- <%= form_tag(translate_path, :name => 'translate_form') do %>
64
- <div>
65
- <%= hidden_field_tag(:filter, params[:filter], :id => "hid_filter") %>
66
- <%= hidden_field_tag(:sort_by, params[:sort_by], :id => "hid_sort_by") %>
67
- <%= hidden_field_tag(:key_type, params[:key_type], :id => "hid_key_type") %>
68
- <%= hidden_field_tag(:key_pattern, params[:key_pattern], :id => "hid_key_pattern") %>
69
- <%= hidden_field_tag(:text_type, params[:text_type], :id => "hid_text_type") %>
70
- <%= hidden_field_tag(:text_pattern, params[:text_pattern], :id => "hid_text_pattern") %>
71
- </div>
72
- <div class="translations">
73
- <h2>Translations from <span class='big-locale'><%= @from_locale %></span> to <span class='big-locale'><%= @to_locale %></span></h2>
74
- <p class="translate">
75
- <%= button_to_function 'Save Translations', 'testAndSave()' %>
76
- </p>
77
- <% @paginated_keys.each do |key| %>
78
- <%=
79
- from_text = lookup(@from_locale, key)
80
- render (from_text.is_a?(Array) ? 'array_form' : 'string_form'), {
81
- :from_locale => @from_locale,
82
- :to_locale => @to_locale,
83
- :key => key,
84
- }
85
- %>
86
- <% end %>
87
- <p class="translate">
88
- <%= button_to_function 'Save Translations', 'testAndSave()' %>
89
- </p>
90
- </div>
91
- <% end %>
92
- <% end %>
93
-
94
- <div class="paging">
95
- <%= render :partial => 'pagination', :locals => {:total_entries => @total_entries, :per_page => per_page} %>
96
- </div>
1
+ <%
2
+ show_filters = ["all", "untranslated", "translated"]
3
+ show_filters << "changed" if @from_locale != @to_locale
4
+ %>
5
+
6
+ <fieldset>
7
+ <legend>Search filter</legend>
8
+ <div id="show-sort">
9
+ <p>
10
+ <label>Show:</label> <%= raw simple_filter(show_filters) %>
11
+ </p>
12
+ <p>
13
+ <label>Sort by:</label> <%= raw simple_filter(["key", "text"], 'sort_by') %>
14
+ </p>
15
+ </div>
16
+ <%= form_tag(params, :method => :get) do %>
17
+ <div id="languages">
18
+ <p>
19
+ <%= hidden_field_tag(:filter, params[:filter]) %>
20
+ <%= hidden_field_tag(:sort_by, params[:sort_by]) %>
21
+ <label>Translate from</label>
22
+ <%= select_tag(:from_locale, options_for_select(from_locales, @from_locale.to_sym)) %> <span>to</span>
23
+ <%= select_tag(:to_locale, options_for_select(to_locales, @to_locale.to_sym)) %>
24
+ <%= submit_tag "Display" %>
25
+ </p>
26
+ </div>
27
+ <div id="filter-pattern">
28
+ <p>
29
+ <label for="key_pattern_value">Key</label>
30
+ <%= select_tag(:key_type, options_for_select([["contains", 'contains'], ["starts with", 'starts_with']], params[:key_type])) %>
31
+ <%= text_field_tag(:key_pattern, params[:key_pattern], :size => 50, :id => "key_pattern_value", :class => "text-default") %>
32
+ </p>
33
+ <p>
34
+ <label for="text_pattern_value">Text</label>
35
+ <%= select_tag(:text_type, options_for_select(['contains', 'equals'], params[:text_type])) %>
36
+ <%= text_field_tag(:text_pattern, params[:text_pattern], :size => 50, :id => "text_pattern_value", :class => "text-default") %>
37
+ </p>
38
+ <p>
39
+ <label for="translated_text_pattern_value">Translated Text</label>
40
+ <%= select_tag(:translated_text_type, options_for_select(['contains', 'equals'], params[:translated_text_type])) %>
41
+ <%= text_field_tag(:translated_text_pattern, params[:translated_text_pattern], :size => 50, :id => "translated_text_pattern_value", :class => "text-default") %>
42
+ </p>
43
+ <p>
44
+ <%= submit_tag "Search" %>
45
+ <%= link_to "clear", params.merge({:text_pattern => nil, :translated_text_pattern => nil, :key_pattern => nil}) %>
46
+ </p>
47
+ </div>
48
+ <% end %>
49
+ <p class="hits">
50
+ Found <strong><%= @total_entries %></strong> messages
51
+ </p>
52
+ <p>
53
+ <%= link_to "Reload messages", translate_reload_path %>
54
+ </p>
55
+ </fieldset>
56
+
57
+
58
+ <div class="paging">
59
+ <%= render :partial => 'pagination', :locals => {:total_entries => @total_entries, :per_page => per_page} %>
60
+ </div>
61
+
62
+ <% if @total_entries > 0 %>
63
+ <%= form_tag(translate_path, :name => 'translate_form') do %>
64
+ <div>
65
+ <%= hidden_field_tag(:filter, params[:filter], :id => "hid_filter") %>
66
+ <%= hidden_field_tag(:sort_by, params[:sort_by], :id => "hid_sort_by") %>
67
+ <%= hidden_field_tag(:key_type, params[:key_type], :id => "hid_key_type") %>
68
+ <%= hidden_field_tag(:key_pattern, params[:key_pattern], :id => "hid_key_pattern") %>
69
+ <%= hidden_field_tag(:text_type, params[:text_type], :id => "hid_text_type") %>
70
+ <%= hidden_field_tag(:text_pattern, params[:text_pattern], :id => "hid_text_pattern") %>
71
+ </div>
72
+ <div class="translations">
73
+ <h2>Translations from <span class='big-locale'><%= @from_locale %></span> to <span class='big-locale'><%= @to_locale %></span></h2>
74
+ <p class="translate">
75
+ <input onclick="testAndSave();" type="button" value="Save Translations">
76
+ </p>
77
+ <% @paginated_keys.each do |key| %>
78
+ <%=
79
+ from_text = lookup(@from_locale, key)
80
+ render (from_text.is_a?(Array) ? 'array_form' : 'string_form'), {
81
+ :from_locale => @from_locale,
82
+ :to_locale => @to_locale,
83
+ :key => key,
84
+ }
85
+ %>
86
+ <% end %>
87
+ <p class="translate">
88
+ <input onclick="testAndSave();" type="button" value="Save Translations">
89
+ </p>
90
+ </div>
91
+ <% end %>
92
+ <% end %>
93
+
94
+ <div class="paging">
95
+ <%= render :partial => 'pagination', :locals => {:total_entries => @total_entries, :per_page => per_page} %>
96
+ </div>
data/lib/translate.rb CHANGED
@@ -2,7 +2,7 @@ require 'ya2yaml'
2
2
 
3
3
  module Translate
4
4
  class Engine < Rails::Engine
5
- end if defined?(Rails) && Rails::VERSION::MAJOR == 3
5
+ end if defined?(Rails) && Rails::VERSION::MAJOR >= 3
6
6
 
7
7
  class << self
8
8
  # For configuring Google Translate API key
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: translate-rails3-plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
5
- prerelease:
4
+ version: 0.0.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Peter Marklund
@@ -12,12 +11,11 @@ authors:
12
11
  autorequire:
13
12
  bindir: bin
14
13
  cert_chain: []
15
- date: 2012-07-09 00:00:00.000000000 Z
14
+ date: 2014-01-15 00:00:00.000000000 Z
16
15
  dependencies:
17
16
  - !ruby/object:Gem::Dependency
18
17
  name: ya2yaml
19
18
  requirement: !ruby/object:Gem::Requirement
20
- none: false
21
19
  requirements:
22
20
  - - ~>
23
21
  - !ruby/object:Gem::Version
@@ -25,29 +23,20 @@ dependencies:
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
27
  - - ~>
31
28
  - !ruby/object:Gem::Version
32
29
  version: '0.30'
33
- description: ! 'This plugin provides a web interface for translating Rails I18n texts
34
-
30
+ description: |
31
+ This plugin provides a web interface for translating Rails I18n texts
35
32
  (requires Rails 3.0 or higher) from one locale to another.
36
-
37
33
  The plugin has been tested only with the simple I18n backend that ships
38
-
39
34
  with Rails.
40
-
41
35
  I18n texts are read from and written to YAML files under config/locales.
42
36
 
43
-
44
37
  This gem is a fork of https://github.com/romanbsd/translate.
45
-
46
38
  From the original https://github.com/mynewsdesk/translate
47
-
48
39
  which also includes work from this fork: https://github.com/milann/translate
49
-
50
- '
51
40
  email: gsmedley@kanayo.com
52
41
  executables: []
53
42
  extensions: []
@@ -88,27 +77,26 @@ files:
88
77
  - spec/storage_spec.rb
89
78
  homepage: https://github.com/gsmedley/translate
90
79
  licenses: []
80
+ metadata: {}
91
81
  post_install_message:
92
82
  rdoc_options: []
93
83
  require_paths:
94
84
  - lib
95
85
  required_ruby_version: !ruby/object:Gem::Requirement
96
- none: false
97
86
  requirements:
98
- - - ! '>='
87
+ - - '>='
99
88
  - !ruby/object:Gem::Version
100
89
  version: '0'
101
90
  required_rubygems_version: !ruby/object:Gem::Requirement
102
- none: false
103
91
  requirements:
104
- - - ! '>='
92
+ - - '>='
105
93
  - !ruby/object:Gem::Version
106
94
  version: '0'
107
95
  requirements: []
108
96
  rubyforge_project:
109
- rubygems_version: 1.8.24
97
+ rubygems_version: 2.0.14
110
98
  signing_key:
111
99
  specification_version: 3
112
- summary: Newsdesk translate plugin for Rails 3
100
+ summary: Newsdesk translate plugin for Rails 3 and above
113
101
  test_files: []
114
102
  has_rdoc: