# Loop throgh the list of providers.
foreach my $provider (@ruleset_providers) {
- my $option_string;
-
- # Get the translation required string for the current provider.
- my $tr_string = $IDS::Ruleset::Providers{$provider}{'tr_string'};
-
- # Check if a translation string is available in the language files.
- if ($Lang::tr{$tr_string}) {
- # Use the translated string from the language file.
- $option_string = $Lang::tr{$tr_string};
- } else {
- # Fallback and use the provider summary from the providers file.
- $option_string = $IDS::Ruleset::Providers{$provider}{'summary'};
- }
+ # Call get_provider_name function to obtain the provider name.
+ my $option_string = &get_provider_name($provider);
+ # Print option.
print "<option value='$provider' $selected{'RULES'}{$provider}>$option_string</option>\n";
}
print <<END;
return %temphash;
}
+#
+## Function to get the provider name from the language file or providers file for a given handle.
+#
+sub get_provider_name($) {
+ my ($handle) = @_;
+ my $provider_name;
+
+ # Get the required translation string for the given provider handle.
+ my $tr_string = $IDS::Ruleset::Providers{$handle}{'tr_string'};
+
+ # Check if the translation string is available in the language files.
+ if ($Lang::tr{$tr_string}) {
+ # Use the translated string from the language file.
+ $provider_name = $Lang::tr{$tr_string};
+ } else {
+ # Fallback and use the provider summary from the providers file.
+ $provider_name = $IDS::Ruleset::Providers{$handle}{'summary'};
+ }
+
+ # Return the obtained provider name.
+ return $provider_name;
+}
+
#
## Private function to convert a given rulefile to a category name.
## ( No file extension anymore and if the name contained a dot, it