forked from romanbsd/translate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request romanbsd#2 from ichiro101/master
Added support for arrays, and provided interface for users to explicitly set their from and to locale
- Loading branch information
Showing
8 changed files
with
157 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<% | ||
from_text = lookup(from_locale, key) | ||
to_text = lookup(to_locale, key) | ||
field_name = "key[#{key}]" | ||
%> | ||
|
||
<div class="translation"> | ||
<% if from_text.present? %> | ||
<p class="translation-text"> | ||
<ol> | ||
<% from_text.each_with_index do |from_text_section, index| %> | ||
<% | ||
from_text_section = from_text_section.to_s | ||
line_size = 100 | ||
n_lines = n_lines(from_text_section, line_size) | ||
# this is needed so the controller doesn't freak out when there is no translations found | ||
# for this element yet... | ||
to_text = Array.new if to_text.blank? | ||
%> | ||
<li><%= from_text_section %></li> | ||
<p class="edit-form"> | ||
<% if n_lines > 1 %> | ||
<%= text_area_tag("#{field_name}[#{index}]", to_text[index], :size => "#{line_size}x#{n_lines}", :id => "#{key}[#{index}]") %> | ||
<% else %> | ||
<%= text_field_tag("#{field_name}[#{index}]", to_text[index], :size => line_size, :id => "#{key}[#{index}]") %> | ||
<% end %> | ||
<%= link_to_function 'Auto Translate', "getGoogleTranslation('#{key}[#{index}]', \"#{escape_javascript(from_text_section)}\", '#{@from_locale}', '#{@to_locale}')", :style => 'padding: 0; margin: 0;' %> | ||
</p> | ||
<% end %> | ||
</ol> | ||
</p> | ||
<% end %> | ||
<p> | ||
<em> | ||
<br/> | ||
<strong>Key:</strong><%=h key %><br/> | ||
<% if @files[key] %> | ||
<strong>File:</strong><%= @files[key].join("<br/>") %> | ||
<% end %> | ||
</em> | ||
</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,4 @@ | |
<% end %> | ||
</ul> | ||
</div> | ||
<% end %> | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<% | ||
from_text = lookup(from_locale, key) | ||
to_text = lookup(to_locale, key) | ||
line_size = 100 | ||
n_lines = n_lines(from_text, line_size) | ||
field_name = "key[#{key}]" | ||
%> | ||
|
||
<div class="translation"> | ||
<% if from_text.present? %> | ||
<p class="translation-text"> | ||
<%= simple_format(h(from_text)) %> | ||
</p> | ||
<% end %> | ||
<p class="edit-form"> | ||
<% if n_lines > 1 %> | ||
<%= text_area_tag(field_name, to_text, :size => "#{line_size}x#{n_lines}", :id => key) %> | ||
<% else %> | ||
<%= text_field_tag(field_name, to_text, :size => line_size, :id => key) %> | ||
<% end %> | ||
</p> | ||
<p> | ||
<em> | ||
<%= link_to_function 'Auto Translate', "getGoogleTranslation('#{key}', \"#{escape_javascript(from_text)}\", '#{@from_locale}', '#{@to_locale}')", :style => 'padding: 0; margin: 0;' %> | ||
<br/> | ||
<strong>Key:</strong><%=h key %><br/> | ||
<% if @files[key] %> | ||
<strong>File:</strong><%= @files[key].join("<br/>") %> | ||
<% end %> | ||
</em> | ||
</p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters