%= form_tag(params, :method => :get, :name => 'filter_form') do %>
<%= hidden_field_tag(:filter, params[:filter]) %>
<%= hidden_field_tag(:sort_by, params[:sort_by]) %>
<%= select_tag(:from_locale, options_for_select(I18n.available_locales, @from_locale.to_sym)) %> to
<%= select_tag(:to_locale, options_for_select(I18n.available_locales, @to_locale.to_sym)) %>
<%= submit_tag "Display" %>
<%= link_to '.. /', '../' %>
<%= link_to @page_title, root_path %>
<%= simple_filter(@show_filters).html_safe %>
Found <%= @keys.all_keys.size %> messages
<%= link_to "Reload messages", translate_reload_path(params) %>
<% flash.each do |key, msg| %>
<%= msg %>
<% end %>
Per page
<%= text_field_tag(:per_page, session[:per_page], size: 2) %>
<%= select_tag(:key_type, options_for_select([["Key contains", 'contains'], ["Key starts with", 'starts_with']], params[:key_type])) %>
<%= text_field_tag(:key_pattern, params[:key_pattern], :size => 50, :id => "key_pattern_value", :class => "text-default") %>
<%= select_tag(:text_type, options_for_select([['Text contains','contains'], ['Text equals','equals']], params[:text_type])) %>
<%= text_field_tag(:text_pattern, params[:text_pattern], :size => 50, :id => "text_pattern_value", :class => "text-default") %>
<%= link_to "clear", params.merge({:text_pattern => nil, :key_pattern => nil}), class: 'btn' %>
<%= submit_tag "Search" %>
<%= link_to "Export language file", translate_export_path(:locale => @to_locale), class: 'btn sep' %>
<% end %>
<%= build_namespace(@keys.namespaces).html_safe %>
<%= render :partial => 'pagination', :locals => {:total_entries => @keys.all_keys.size, :per_page => @per_page} %>
<% if @keys.all_keys.size > 0 %>
<%= form_tag(translate_path, method: :put) do %>
<%= hidden_field_tag(:filter, params[:filter], :id => "hid_filter") %>
<%= hidden_field_tag(:sort_by, params[:sort_by], :id => "hid_sort_by") %>
<%= hidden_field_tag(:key_type, params[:key_type], :id => "hid_key_type") %>
<%= hidden_field_tag(:key_pattern, params[:key_pattern], :id => "hid_key_pattern") %>
<%= hidden_field_tag(:text_type, params[:text_type], :id => "hid_text_type") %>
<%= hidden_field_tag(:text_pattern, params[:text_pattern], :id => "hid_text_pattern") %>
Translations from <%= @from_locale %> to <%= @to_locale %> -
<%= simple_filter(["key", "text"], 'sort_by').html_safe %>
<%= submit_tag "Save Translations", style: 'float:right;' %>
<% @paginated_keys.each do |key|
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}]"
tid = key.split('.').join("_")
%>
<% if n_lines > 1 %>
<% if @keys.files[key] %>
found in <%= @keys.files[key].count %> files
<%= @keys.files[key].join("
").html_safe %>
<% end %>
<%=h key %>
X
<%= text_area_tag(field_name, to_text, :rows => n_lines, :id => tid) %>
<% else %>
<% if @keys.files[key] %>
found in <%= @keys.files[key].count %> files
<%= @keys.files[key].join("
").html_safe %>
<% end %>
<%=h key %>
X
<%= from_text %>
▶
<%= text_field_tag(field_name, to_text, :size => line_size, :id => tid) %>
<% end %>
<% end %>
Translations from <%= @from_locale %> to <%= @to_locale %>
<%= submit_tag "Save Translations", style: 'float:right' %>
<% end %>
<% end %>
<%= render :partial => 'pagination', :locals => {:total_entries => @keys.all_keys.size, :per_page => @per_page} %>