-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix missing translations for collection labels (#473)
- Loading branch information
Showing
1 changed file
with
16 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
# Run this if you are seeing Collections with a type of "translation missing..." | ||
# Check YOUR_SERVER//dashboard/collections?locale=en for a place where this might appear | ||
namespace :curate do | ||
desc "Fix missing collection type labels" | ||
task fix_collection_type_labels: :environment do | ||
collection_types = Hyrax::CollectionType.all | ||
collection_types.each do |c| | ||
next unless c.title.match?(/^translation missing/) | ||
oldtitle = c.title | ||
c.title = I18n.t(c.title.gsub("translation missing: en.", '')) | ||
c.save | ||
puts "#{oldtitle} changed to #{c.title}" | ||
end | ||
end | ||
end |