summaryrefslogtreecommitdiff
path: root/httemplate/browse/msgcat.html
blob: 7509cf7d412270373d3a13a7a6fe5bea9ae62bf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<& elements/browse.html,
     title         => mt('Translation strings'),
     name_singular => 'string', #mt? no, we need to do it through the quant/PL stuff
     query         => { 'table'     => 'msgcat', 
                        'hashref'   => { 'locale' => $locale, },
                      },
     count_query   => $count_query,
     header        => [ mt('Message code'), mt('Message string') ],
     fields        => [ 'msgcode', 'msg' ],
     links         => $locale eq 'en_US' ? [] : [ $link, $link ],
     html_init     => $html_init,
&>
<%init>

my $curuser = $FS::CurrentUser::CurrentUser;

die "access denied"
  unless $curuser->access_right('Configuration');

my $locale = $cgi->param('locale') || 'en_US';
die "invalid locale" unless $locale =~ /^[A-Za-z_]+$/;

my $count_query = "SELECT COUNT(*) FROM msgcat where locale = '$locale'";

my $link = [ "${p}edit/msgcat.html?", 'msgnum' ];

my $html_init = '';
foreach my $alocale ( FS::Locales->locales ) {
     my %info = FS::Locales->locale_info($alocale);
     my $selectedstart = $alocale eq $locale ? '<B>' : '';
     my $selectedend = $alocale eq $locale ? '</B>' : '';
     $html_init .= qq!<A HREF="msgcat.html?locale=$alocale">$selectedstart$info{name} ($info{country})$selectedend</A> &nbsp; !;
}
$html_init .= '<BR><BR>';

</%init>