<commit_before><%
  @page_title = "Translate"
  show_filters = ["all", "untranslated", "translated"]
  show_filters << "changed" if @from_locale != @to_locale
%>
<%= form_tag(params, :method => :get, :name => 'filter_form') do %>
<%= hidden_field_tag(:filter, params[:filter]) %>
<%= hidden_field_tag(:sort_by, params[:sort_by]) %>
<div id="top">
  <% if @page_title %>
    <h1>
      <div class="right">
       <%= select_tag(:from_locale, options_for_select(I18n.available_locales, @from_locale.to_sym)) %> <span>to</span>
       <%= select_tag(:to_locale, options_for_select(I18n.available_locales, @to_locale.to_sym)) %>
       <%= submit_tag "Display" %>
      </div>
      <%= link_to '.. /', '../' %>
      <%= link_to @page_title, root_path %></a>
      <div class="center">
       <label>Show:</label> <%=  simple_filter(show_filters).html_safe %>
        Found <strong><%= @total_entries %></strong> messages
        <%= link_to "Reload messages", translate_reload_path %>
      </div>

    </h1>
  <% end %>
  <% flash.each do |key, msg| %>
    <div id="<%= key %>"><%= msg %></div>
  <% end %>
</div>
<div id="searchbox">

   <%= 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' %>
</div>
<% end %>

<div id="namespaces">
  <%= build_namespace(@deep_keys).html_safe %>
</div>

<div id="inside">
  <div class="paging">
    <%= render :partial => 'pagination', :locals => {:total_entries => @total_entries, :per_page => per_page} %>
  </div>

  <% if @total_entries > 0 %>
  <%= form_tag(translate_path, method: :put) do %>
    <div>
        <%= 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") %>
    </div>
    <div class="translations">
      <p class="translate">
        Translations from <%= @from_locale %> to <%= @to_locale %>
        <label>Sort by:</label> <%= simple_filter(["key", "text"], 'sort_by').html_safe %>
  	    <%= submit_tag "Save Translations", style: 'float:right;' %>
  	  </p>
  	  <% @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("_")

      %>
  	  <div class="translation">
      	<p class="edit-form">
  			<%= hidden_field_tag("version[#{key}]", @versions[key] || '0') %>
  		<% if n_lines > 1 %>
          <span class="right">
  			    <span class="key"><%=h key %></span>
  			      <% if @files[key] %>
  				      <span class="file"><%= @files[key].join("</span><span>") %></span>
  			      <% end %>
  			    </span>
  			  </span>
          <div class="long-translation">
  		      <div class="translation-text">
        			<pre id="<%= tid %>_original"><%= from_text %></pre>
              <div class="clear"></div>
  		      </div>
            <div class="translation-textarea">
  			      <%= text_area_tag(field_name, to_text, :rows => n_lines+1, :id => tid) %>
              <div class="clear"></div>
  		      </div>
            <div class="clear"></div>
  		    </div>
      <% else %>
  		  <span class="translation-text">
  			  <code class="keytext" id="<%= tid %>_original"><%= from_text %></code>
  		  </span>
        <span class="right">
  			  <span class="key" ><%=h key %></span>
  			    <% if @files[key] %>
  				    <span class="file"><%= @files[key].join("</span><span>") %></span>
  			    <% end %>
  			  </span>
  			</span>

  			<%= text_field_tag(field_name, to_text, :size => line_size, :id => tid) %>
  		<% end %>
  		</p>
  		<p>
  	</p>
  	</div>
  <% end %>
    <p class="translate">
      Translations from <%= @from_locale %> to <%= @to_locale %>
      <%= submit_tag "Save Translations", style: 'float:right' %>
  	</p>
  </div>
  <% end %>
  <% end %>

  <div class="paging clear">
    <%= render :partial => 'pagination', :locals => {:total_entries => @total_entries, :per_page => per_page} %><commit_msg>fix bug in display of multiple files<commit_after><%
  @page_title = "Translate"
  show_filters = ["all", "untranslated", "translated"]
  show_filters << "changed" if @from_locale != @to_locale
%>
<%= form_tag(params, :method => :get, :name => 'filter_form') do %>
<%= hidden_field_tag(:filter, params[:filter]) %>
<%= hidden_field_tag(:sort_by, params[:sort_by]) %>
<div id="top">
  <% if @page_title %>
    <h1>
      <div class="right">
       <%= select_tag(:from_locale, options_for_select(I18n.available_locales, @from_locale.to_sym)) %> <span>to</span>
       <%= select_tag(:to_locale, options_for_select(I18n.available_locales, @to_locale.to_sym)) %>
       <%= submit_tag "Display" %>
      </div>
      <%= link_to '.. /', '../' %>
      <%= link_to @page_title, root_path %></a>
      <div class="center">
       <label>Show:</label> <%=  simple_filter(show_filters).html_safe %>
        Found <strong><%= @total_entries %></strong> messages
        <%= link_to "Reload messages", translate_reload_path %>
      </div>

    </h1>
  <% end %>
  <% flash.each do |key, msg| %>
    <div id="<%= key %>"><%= msg %></div>
  <% end %>
</div>
<div id="searchbox">

   <%= 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' %>
</div>
<% end %>

<div id="namespaces">
  <%= build_namespace(@deep_keys).html_safe %>
</div>

<div id="inside">
  <div class="paging">
    <%= render :partial => 'pagination', :locals => {:total_entries => @total_entries, :per_page => per_page} %>
  </div>

  <% if @total_entries > 0 %>
  <%= form_tag(translate_path, method: :put) do %>
    <div>
        <%= 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") %>
    </div>
    <div class="translations">
      <p class="translate">
        Translations from <%= @from_locale %> to <%= @to_locale %>
        <label>Sort by:</label> <%= simple_filter(["key", "text"], 'sort_by').html_safe %>
  	    <%= submit_tag "Save Translations", style: 'float:right;' %>
  	  </p>
  	  <% @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("_")

      %>
  	  <div class="translation">
      	<p class="edit-form">
  			<%= hidden_field_tag("version[#{key}]", @versions[key] || '0') %>
  		<% if n_lines > 1 %>
          <span class="right">
  			    <span class="key"><%=h key %></span>
  			      <% if @files[key] %>
  				      <span class="file"><%= @files[key].join("</span><span>").html_safe %></span>
  			      <% end %>
  			    </span>
  			  </span>
          <div class="long-translation">
  		      <div class="translation-text">
        			<pre id="<%= tid %>_original"><%= from_text %></pre>
              <div class="clear"></div>
  		      </div>
            <div class="translation-textarea">
  			      <%= text_area_tag(field_name, to_text, :rows => n_lines+1, :id => tid) %>
              <div class="clear"></div>
  		      </div>
            <div class="clear"></div>
  		    </div>
      <% else %>
  		  <span class="translation-text">
  			  <code class="keytext" id="<%= tid %>_original"><%= from_text %></code>
  		  </span>
        <span class="right">
  			  <span class="key" ><%=h key %></span>
  			    <% if @files[key] %>
  				    <span class="file"><%= @files[key].join("</span><span>").html_safe %></span>
  			    <% end %>
  			  </span>
  			</span>

  			<%= text_field_tag(field_name, to_text, :size => line_size, :id => tid) %>
  		<% end %>
  		</p>
  		<p>
  	</p>
  	</div>
  <% end %>
    <p class="translate">
      Translations from <%= @from_locale %> to <%= @to_locale %>
      <%= submit_tag "Save Translations", style: 'float:right' %>
  	</p>
  </div>
  <% end %>
  <% end %>

  <div class="paging clear">
    <%= render :partial => 'pagination', :locals => {:total_entries => @total_entries, :per_page => per_page} %>
{'fraction_non_alphanumeric': 0.2154539222407208, 'fraction_numerical': 0.0033297424346293214, 'mean_word_length': 3.1903980303652033, 'pattern_counts': {'":': 0, '<': 293, '<?xml version=': 0, '>': 351, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2363314', 'n_tokens_mistral': 3968, 'n_tokens_neox': 3604, 'n_words': 668}