6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/decidim/api/input_sorts/has_localized_input_sort.rb', line 6
def self.included(child_class)
child_class.argument :locale,
type: GraphQL::Types::String,
description: "Specify the locale to use when ordering translated fields, otherwise default organization language will be used",
required: false,
prepare: lambda { |locale, ctx|
unless ctx[:current_organization].available_locales.include?(locale)
raise GraphQL::ExecutionError, "#{locale} locale is not used in the organization"
end
locale
}
end
|