<% @page_title = "Translate" show_filters = ["all", "untranslated", "translated"] show_filters << "changed" if @from_locale != @to_locale %>
Search filter

<%= raw simple_filter(show_filters) %>

<%= raw simple_filter(["key", "text"], 'sort_by') %>

<%= form_tag(params, :method => :get) do %>

<%= hidden_field_tag(:filter, params[:filter]) %> <%= hidden_field_tag(:sort_by, params[:sort_by]) %> <%= select_tag(:from_locale, options_for_select(from_locales, @from_locale.to_sym)) %> to <%= select_tag(:to_locale, options_for_select(to_locales, @to_locale.to_sym)) %> <%= submit_tag "Display" %>

<%= select_tag(:key_type, options_for_select([["contains", 'contains'], ["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(['contains', 'equals'], params[:text_type])) %> <%= text_field_tag(:text_pattern, params[:text_pattern], :size => 50, :id => "text_pattern_value", :class => "text-default") %>

<%= submit_tag "Search" %> <%= link_to "clear", params.merge({:text_pattern => nil, :key_pattern => nil}) %>

<% end %>

Found <%= @total_entries %> messages

<%= link_to "Reload messages", translate_reload_path %>

<%= render :partial => 'pagination', :locals => {:total_entries => @total_entries, :per_page => per_page} %>
<% if @total_entries > 0 %> <%= form_tag(translate_path) 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 %>

<%= submit_tag "Save Translations" %>

<% @paginated_keys.each do |key| %> <%= from_text = lookup(@from_locale, key) render (from_text.is_a?(Array) ? 'array_form' : 'string_form'), { :from_locale => @from_locale, :to_locale => @to_locale, :key => key, } %> <% end %>

<%= submit_tag "Save Translations" %>

<% end %> <% end %>
<%= render :partial => 'pagination', :locals => {:total_entries => @total_entries, :per_page => per_page} %>