Skip to content

Commit

Permalink
i18n for many parts of search.
Browse files Browse the repository at this point in the history
  • Loading branch information
cwant committed Nov 22, 2024
1 parent 4944b11 commit 07c784d
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 25 deletions.
33 changes: 18 additions & 15 deletions app/views/search/common/_facet_sidebar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Variable that should be available
- @facet_params - The facet filters the user has applied
%>
<h3 class="nav-heading" id="sidebar-header">
Filters
<%= t('sidebar.filter.heading') %>
<button href="#" class="btn btn-link pull-right" id="sidebar-close"><i class="icon-lg icon cross-icon"></i></button>
</h3>

Expand All @@ -28,10 +28,10 @@ Variable that should be available
<ul class="unstyled nav-simple">
<li>
<h4 class="nav-heading">
Filter
<%= t('sidebar.filter.heading') %>
<% if @facet_params.present? %>
<%= link_to clear_filters_path, class: 'btn btn-xs btn-secondary font-size-sm clear-filters-btn' do %>
Clear filters <i class="glyphicon glyphicon-remove"></i>
<%= t('sidebar.filter.values.clear_filters') %> <i class="glyphicon glyphicon-remove"></i>
<% end %>
<% end %>
</h4>
Expand All @@ -53,20 +53,23 @@ Variable that should be available
<% end %>
<% if resource_type.name == 'Event' %>
<%= render partial: 'search/common/facet_sidebar_boolean_filter', locals: { facet_field: 'include_expired',
count: '-',
enable_text: 'Show past events',
disable_text: 'Hide past events' } %>
<%= render partial: 'search/common/facet_sidebar_boolean_filter', locals: { facet_field: 'include_disabled',
count: '-',
enable_text: 'Show disabled events',
disable_text: 'Hide disabled events' } %>
<%= render partial: 'search/common/facet_sidebar_boolean_filter',
locals: { facet_field: 'include_expired',
count: '-',
enable_text: t('sidebar.filter.values.show_past_events'),
disable_text: t('sidebar.filter.values.hide_past_events') } %>
<%= render partial: 'search/common/facet_sidebar_boolean_filter',
locals: { facet_field: 'include_disabled',
count: '-',
enable_text: t('sidebar.filter.values.show_disabled_events'),
disable_text: t('sidebar.filter.values.hide_disabled_events') } %>
<% elsif resource_type.name == 'Material' || resource_type.name == 'LearningPath' %>
<% resource_name = resource_type.model_name.human.downcase.pluralize %>
<%= render partial: 'search/common/facet_sidebar_boolean_filter', locals: { facet_field: 'include_archived',
count: '-',
enable_text: "Show archived #{resource_name}",
disable_text: "Hide archived #{resource_name}" } %>
<%= render partial: 'search/common/facet_sidebar_boolean_filter',
locals: { facet_field: 'include_archived',
count: '-',
enable_text: t('sidebar.filter.values.show_archived', resource: resource_name),
disable_text: t('sidebar.filter.values.hide_archived', resource: resource_name) } %>
<% end %>
<% if TeSS::Config.facets_max_age_list.include?(resource_type.name) %>
Expand Down
20 changes: 12 additions & 8 deletions app/views/search/common/_facet_sidebar_curation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ul class="unstyled nav-simple">
<li>
<h4 class="nav-heading mt-4">
Curate
<%= t('sidebar.curate.heading') %>
</h4>
</li>

Expand All @@ -15,12 +15,15 @@
<li>
<div class="nav-heading filter-heading">
<span class="icon icon-lg events-icon"></span>
<span>Last Checked</span>
<span><%= t('sidebar.curate.values.last_checked') %></span>
<div class="pull-right filter-expand"><i class="icon icon-md expand-icon"></i></div>
</div>
</li>
<% [[1, '1 day'], [3, '3 days'], [7, '1 week'], [30, '1 month']].each do |days, text| %>
<% text = "More than #{text} ago" %>
<% [[1, t('sidebar.curate.values.one_day')],
[3, t('sidebar.curate.values.three_days')],
[7, t('sidebar.curate.values.one_week')],
[30, t('sidebar.curate.values.one_month')]].each do |days, text| %>
<% text = t('sidebar.curate.values.more_than', value: text) %>
<% if days == params[:days_since_scrape].to_i %>
<li class="nav-item active" style="display: none;">
<%= remove_filter_link(:days_since_scrape, days, title: text, replace: true, class: 'facet-option') %>
Expand All @@ -36,10 +39,11 @@
<% end %>
<% if show_hidden_filter %>
<%= render partial: 'search/common/facet_sidebar_boolean_filter', locals: { facet_field: 'include_hidden',
count: '-',
enable_text: 'Show hidden items',
disable_text: 'Hide hidden items' } %>
<%= render partial: 'search/common/facet_sidebar_boolean_filter',
locals: { facet_field: 'include_hidden',
count: '-',
enable_text: t('sidebar.hidden.values.show_hidden'),
disable_text: t('sidebar.hidden.values.hide_hidden') } %>
<% end %>
</ul>
<% end %>
2 changes: 1 addition & 1 deletion app/views/search/common/_facet_sidebar_max_age.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<li>
<div class="nav-heading filter-heading">
<span class="icon icon-lg events-icon"></span>
<span>Date added</span>
<span><%= t('facets.titles.date_added') %></span>
<div class="pull-right filter-expand"><i class="icon icon-md expand-icon"></i></div>
</div>
</li>
Expand Down
2 changes: 1 addition & 1 deletion app/views/search/common/_search_filters.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Globals
<%# The search term %>
<% unless params[:q].blank? %>
<p>
<b>Search query</b>:
<b><%= t('search_query') %></b>
<span class="active-filters"><%= remove_filter_link('q', params[:q], class: 'label label-default filter-button') %></span>
</p>
<% end %>
25 changes: 25 additions & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,7 @@ en:
organizer: Organiser
titles:
language: 'Language'
date_added: 'Date added'
languages: # Only needed to override default names from I18nData
el: 'Greek'
errors:
Expand Down Expand Up @@ -794,6 +795,7 @@ en:
mailer:
events_require_approval:
subject: "Last week's events on %{site_name}"
search_query: 'Search query:'
sidebar:
sort:
heading: Sort
Expand All @@ -806,6 +808,29 @@ en:
latest: Latest
most_recent: Most recent
last_finished: Last finished
curate:
heading: Curate
values:
last_checked: Last Checked
more_than: 'More than %{value} ago'
one_day: '1 day'
three_day: '3 days'
one_week: '1 week'
one_month: '1 month'
filter:
heading: 'Filter'
values:
clear_filters: 'Clear filters'
show_past_events: 'Show past events'
hide_past_events: 'Hide past events'
show_disabled_events: 'Show disabled events'
hide_disabled_events: 'Hide disabled events'
show_archived: 'Show archived %{resource}'
hide_archived: 'Hide archived %{resource}'
hidden:
values:
show_hidden: 'Show hidden items'
hide_hidden: 'Hide hidden items'
collections:
show:
curate_materials: "Curate materials"
Expand Down

0 comments on commit 07c784d

Please sign in to comment.