4 # Turns supported locales into a static HTML option list
6 use OpenSRF::AppSession;
8 use OpenILS::Utils::Fieldmapper;
9 use OpenSRF::Utils::SettingsClient;
10 use OpenILS::Application::AppUtils;
12 die "usage: perl locale_html_options.pl <bootstrap_config> <output_file>" unless $ARGV[1];
13 OpenSRF::System->bootstrap_client(config_file => $ARGV[0]);
15 open FILE, ">$ARGV[1]";
17 Fieldmapper->import(IDL => OpenSRF::Utils::SettingsClient->new->config_value("IDL"));
19 my $ses = OpenSRF::AppSession->create("open-ils.cstore");
20 my $locales = $ses->request("open-ils.cstore.direct.config.i18n_locale.search.atomic", {"code" => {"!=" => undef}}, {"order_by" => {"i18n_l" => "name"}})->gather();
22 print_option($locales);
30 print FILE "<select name='locale'>\n";
31 foreach my $locale (@$locales) {
32 my $code = OpenILS::Application::AppUtils->entityize($locale->code);
33 my $name = OpenILS::Application::AppUtils->entityize($locale->name);
34 print FILE " <option value='$code'>$name</option>\n";
36 print FILE "</select>\n";