Skip to content

Commit

Permalink
Fix broken string interpolation with translations
Browse files Browse the repository at this point in the history
Previously it was interpolating a string and then translating it. That
never works. Instead, you must first translate it and then interpolate.
  • Loading branch information
ekohl committed Jan 26, 2024
1 parent eaa57c4 commit e4a4bab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def self.fetch_repo_id(cv_id, env_id, repo_name)
repos = repo_resource.call(:index, index_options)['results']
if repos.empty?
raise _("No such repository with name %{name}, in lifecycle environment"\
" %{environment_id} and content view %{content_view_id}" % index_options)
" %{environment_id} and content view %{content_view_id}") % index_options
end
repos.first['id']
end
Expand Down
4 changes: 2 additions & 2 deletions lib/hammer_cli_katello/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -571,15 +571,15 @@ def print_results(name, results, async)
upload_results = results.dig('output', 'upload_results') || []

if upload_results.empty?
print_message _("Successfully uploaded file %s" % name)
print_message _("Successfully uploaded file %s") % name
else
upload_results.each do |result|
if result['type'] == 'docker_manifest'
print_message(
_("Successfully uploaded manifest file '%{name}' with digest '%{digest}'") % {
:name => name, :digest => result['digest'] })
else
print_message _("Successfully uploaded file %s" % name)
print_message _("Successfully uploaded file %s") % name
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/hammer_cli_katello/subscription.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ def get_subscription_type(data)
if !data["virt_only"]
_("Physical")
elsif data["host"]
_("Guests of %s" % data['host']['name'])
_("Guests of %s") % data['host']['name']
elsif data["hypervisor"]
_("Guests of %s" % data['hypervisor']['name'])
_("Guests of %s") % data['hypervisor']['name']
elsif data["unmapper_guest"]
_("Temporary")
else
Expand Down

0 comments on commit e4a4bab

Please sign in to comment.