Skip to content

Commit

Permalink
Refs #36575 - Correct i18n usage in taxonomies apipie
Browse files Browse the repository at this point in the history
String interpolation in translated strings should mostly be avoided.
This rewrites it to have explicit definitions for both locations and
organizations.

Fixes: 9d3eace ("Fixes #10359 - API doc does mention org/loc in create/update")
  • Loading branch information
ekohl committed Oct 9, 2023
1 parent 2711e80 commit 8825f7d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/controllers/concerns/api/v2/taxonomies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ module Api::V2::TaxonomiesController
param :subnet_ids, Array, N_("Subnet IDs"), :required => false
param :parent_id, :number, :desc => N_('Parent ID'), :required => false
param :ignore_types, Array, N_("List of resources types that will be automatically associated"), :required => false
resource_name = (param_name == :location) ? 'organization' : 'location'
resource_ids = "#{resource_name}_ids".to_sym
param resource_ids, Array, N_("Associated %{resource} IDs") % { resource: _(resource_name) }, :required => false
if param_name == :location
param :organization_ids, Array, N_("Associated organization IDs"), :required => false
else
param :location_ids, Array, N_("Associated location IDs"), :required => false
end
end
end

Expand Down

0 comments on commit 8825f7d

Please sign in to comment.