Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #37688 - Do not build action names without actions #756

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions lib/tasks/gettext.rake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ if gettext_find_task
namespace :gettext do
task :store_action_names => :environment do
storage_file = "#{locale_path}/action_names.rb"
puts "writing action translations to: #{storage_file}"

klasses = Actions::EntryAction
.subclasses
.uniq
Expand All @@ -18,12 +16,19 @@ if gettext_find_task
src.start_with? @engine.root.to_s
end

File.write storage_file,
"# Autogenerated!\n" +
klasses
.map { |klass| %[_("#{klass.allocate.humanized_name}")] }
.sort
.join("\n") + "\n"
if klasses.any?
puts "writing action translations to: #{storage_file}"

File.write storage_file,
"# Autogenerated!\n" +
klasses
.map { |klass| %[_("#{klass.allocate.humanized_name}")] }
.sort
.join("\n") + "\n"
elsif File.exist? storage_file
puts "Removing empty action translations file: #{storage_file}"
File.delete storage_file
end
end
end

Expand Down
Loading