From e4a4bab259ffe2b3ad9d98ca15f7a7a7f815dcce Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Fri, 26 Jan 2024 14:58:44 +0100 Subject: [PATCH] Fix broken string interpolation with translations Previously it was interpolating a string and then translating it. That never works. Instead, you must first translate it and then interpolate. --- .../command_extensions/kickstart_repository.rb | 2 +- lib/hammer_cli_katello/repository.rb | 4 ++-- lib/hammer_cli_katello/subscription.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/hammer_cli_katello/command_extensions/kickstart_repository.rb b/lib/hammer_cli_katello/command_extensions/kickstart_repository.rb index b49832811..b128c592b 100644 --- a/lib/hammer_cli_katello/command_extensions/kickstart_repository.rb +++ b/lib/hammer_cli_katello/command_extensions/kickstart_repository.rb @@ -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 diff --git a/lib/hammer_cli_katello/repository.rb b/lib/hammer_cli_katello/repository.rb index e21adb32a..29ca32e02 100644 --- a/lib/hammer_cli_katello/repository.rb +++ b/lib/hammer_cli_katello/repository.rb @@ -571,7 +571,7 @@ 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' @@ -579,7 +579,7 @@ def print_results(name, results, async) _("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 diff --git a/lib/hammer_cli_katello/subscription.rb b/lib/hammer_cli_katello/subscription.rb index 4640f0dc7..008cb52ab 100644 --- a/lib/hammer_cli_katello/subscription.rb +++ b/lib/hammer_cli_katello/subscription.rb @@ -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