MT#3961 Prepare for localization

gjungwirth/test_sleeps
Gerhard Jungwirth 12 years ago
parent e86a5d88f8
commit 1bf73a7bb6

@ -29,6 +29,7 @@ my $builder = Local::Module::Build->new(
'Catalyst::Plugin::Authorization::Roles' => 0,
'Catalyst::Plugin::ConfigLoader' => 0,
'Catalyst::Plugin::EnableMiddleware' => 0,
'Catalyst::Plugin::I18N' => 0,
'Catalyst::Plugin::Session' => 0,
'Catalyst::Plugin::Session::Store::FastMmap' => 0,
'Catalyst::Plugin::Session::State::Cookie' => 0,

@ -23,6 +23,7 @@ use Catalyst qw/
Session
Session::Store::FastMmap
Session::State::Cookie
I18N
/;
# EnableMiddleware
use Log::Log4perl::Catalyst qw();

@ -29,18 +29,18 @@ sub list_admin :PathPart('administrator') :Chained('/') :CaptureArgs(0) {
{ name => "id", search => 1, title => "#" },
];
if($c->user->is_superuser) {
@{ $cols } = (@{ $cols }, { name => "reseller.name", search => 1, title => "Reseller" });
@{ $cols } = (@{ $cols }, { name => "reseller.name", search => 1, title => $c->loc("Reseller") });
}
@{ $cols } = (@{ $cols },
{ name => "login", search => 1, title => "Login" },
{ name => "is_master", title => "Master" },
{ name => "is_active", title => "Active" },
{ name => "read_only", title => "Read Only" },
{ name => "show_passwords", title => "Show Passwords" },
{ name => "call_data", title => "Show CDRs" },
{ name => "login", search => 1, title => $c->loc("Login") },
{ name => "is_master", title => $c->loc("Master") },
{ name => "is_active", title => $c->loc("Active") },
{ name => "read_only", title => $c->loc("Read Only") },
{ name => "show_passwords", title => $c->loc("Show Passwords") },
{ name => "call_data", title => $c->loc("Show CDRs") },
);
if($c->user->is_superuser) {
@{ $cols } = (@{ $cols }, { name => "lawful_intercept", title => "Lawful Intercept" });
@{ $cols } = (@{ $cols }, { name => "lawful_intercept", title => $c->loc("Lawful Intercept") });
}
$c->stash->{admin_dt_columns} = NGCP::Panel::Utils::Datatables::set_columns($c, $cols);
return;
@ -108,12 +108,12 @@ sub create :Chained('list_admin') :PathPart('create') :Args(0) {
}
$c->stash->{admins}->create($form->values);
delete $c->session->{created_objects}->{reseller};
$c->flash(messages => [{type => 'success', text => 'Administrator successfully created'}]);
$c->flash(messages => [{type => 'success', text => $c->loc('Administrator successfully created')}]);
} catch($e) {
NGCP::Panel::Utils::Message->error(
c => $c,
error => $e,
desc => "Failed to create administrator.",
desc => $c->loc("Failed to create administrator."),
);
}
NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/administrator'));
@ -132,12 +132,12 @@ sub base :Chained('list_admin') :PathPart('') :CaptureArgs(1) {
unless($c->user->is_master);
unless ($administrator_id && $administrator_id->is_integer) {
$c->flash(messages => [{type => 'error', text => 'Invalid administrator id detected'}]);
$c->flash(messages => [{type => 'error', text => $c->loc('Invalid administrator id detected')}]);
NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/administrator'));
}
$c->stash(administrator => $c->stash->{admins}->find($administrator_id));
unless($c->stash->{administrator}) {
$c->flash(messages => [{type => 'error', text => 'Administrator not found'}]);
$c->flash(messages => [{type => 'error', text => $c->loc('Administrator not found')}]);
NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/administrator'));
}
}
@ -184,12 +184,12 @@ sub edit :Chained('base') :PathPart('edit') :Args(0) {
delete $form->values->{md5pass} unless length $form->values->{md5pass};
$c->stash->{administrator}->update($form->values);
delete $c->session->{created_objects}->{reseller};
$c->flash(messages => [{type => 'success', text => 'Administrator successfully updated'}]);
$c->flash(messages => [{type => 'success', text => $c->loc('Administrator successfully updated')}]);
} catch($e) {
NGCP::Panel::Utils::Message->error(
c => $c,
error => $e,
desc => "Failed to update administrator.",
desc => $c->loc("Failed to update administrator."),
);
};
NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/administrator'));
@ -205,17 +205,17 @@ sub delete :Chained('base') :PathPart('delete') :Args(0) {
my ($self, $c) = @_;
if($c->stash->{administrator}->id == $c->user->id) {
$c->flash(messages => [{type => 'error', text => 'Cannot delete myself'}]);
$c->flash(messages => [{type => 'error', text => $c->loc('Cannot delete myself')}]);
NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/administrator'));
}
try {
$c->stash->{administrator}->delete;
$c->flash(messages => [{type => 'success', text => 'Administrator successfully deleted'}]);
$c->flash(messages => [{type => 'success', text => $c->loc('Administrator successfully deleted')}]);
} catch($e) {
NGCP::Panel::Utils::Message->error(
c => $c,
error => $e,
desc => "Failed to delete administrator.",
desc => $c->loc("Failed to delete administrator."),
);
};
NGCP::Panel::Utils::Navigation::back_or($c, $c->uri_for('/administrator'));

@ -80,7 +80,7 @@ sub auto :Private {
# don't redirect to login page for ajax uris
if($c->request->path =~ /\/ajax$/) {
$c->response->body("403 - Permission denied");
$c->response->body($c->loc("403 - Permission denied"));
$c->response->status(403);
return;
}

@ -17,7 +17,7 @@
[% c.user.webusername %]@[% c.user.domain.domain %]
[% END -%]
</li>
<li><a href="[% c.uri_for('/logout') %]">Logout</a></li>
<li><a href="[% c.uri_for('/logout') %]">[% c.loc('Logout') %]</a></li>
</ul>
</div> <!-- /#top-nav -->
</div> <!-- /.container -->
@ -25,7 +25,7 @@
<div id="header">
<div class="container">
<a href="[% c.uri_for('/dashboard') %]" class="brand">Dashboard</a>
<a href="[% c.uri_for('/dashboard') %]" class="brand">[% c.loc("Dashboard") %]</a>
<a href="javascript:;" class="btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<i class="icon-reorder"></i>
</a>
@ -35,7 +35,7 @@
<li class="nav-icon">
<a href="[% c.uri_for('/') %]">
<i class="icon-home"></i>
<span>Home</span>
<span>[% c.loc("Home") %]</span>
</a>
</li>
[% FOREACH t IN topmenu -%]
@ -65,7 +65,7 @@
<div class="container">
<div class="row">
<div class="span6">
© 2013 <a href="http://www.sipwise.com">Sipwise GmbH</a>, all rights reserved.
© 2013 <a href="http://www.sipwise.com">Sipwise GmbH</a>, [% c.loc('all rights reserved') %].
</div>
</div>
</div>

@ -0,0 +1,23 @@
{
"sEmptyTable": "No data available in table",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
"sInfoEmpty": "Showing 0 to 0 of 0 entries",
"sInfoFiltered": "(filtered from _MAX_ total entries)",
"sInfoPostFix": "",
"sInfoThousands": ",",
"sLengthMenu": "Show _MENU_ entries",
"sLoadingRecords": "Loading...",
"sProcessing": "Processing...",
"sSearch": "Search:",
"sZeroRecords": "No matching records found",
"oPaginate": {
"sFirst": "First",
"sLast": "Last",
"sNext": "Next",
"sPrevious": "Previous"
},
"oAria": {
"sSortAscending": ": activate to sort column ascending",
"sSortDescending": ": activate to sort column descending"
}
}

@ -1,6 +1,6 @@
[% META title = 'Administrators' -%]
[%
helper.name = 'Administrator';
helper.name = c.loc('Administrator');
helper.show_create_button = 1;
helper.data = admins;
helper.messages = messages;
@ -15,17 +15,17 @@
IF c.user.is_master;
helper.dt_buttons = [
{ name = 'Edit', uri = "/administrator/'+full[\"id\"]+'/edit", class = 'btn-small btn-primary', icon = 'icon-edit' },
{ name = 'Delete', uri = "/administrator/'+full[\"id\"]+'/delete", class = 'btn-small btn-secondary', icon = 'icon-trash' },
{ name = 'API key', uri = "/administrator/'+full[\"id\"]+'/api_key", class = 'btn-small btn-info', icon = 'icon-lock' },
{ name = c.loc('Edit'), uri = "/administrator/'+full[\"id\"]+'/edit", class = 'btn-small btn-primary', icon = 'icon-edit' },
{ name = c.loc('Delete'), uri = "/administrator/'+full[\"id\"]+'/delete", class = 'btn-small btn-secondary', icon = 'icon-trash' },
{ name = c.loc('API key'), uri = "/administrator/'+full[\"id\"]+'/api_key", class = 'btn-small btn-info', icon = 'icon-lock' },
];
helper.top_buttons = [
{ name = 'Create Administrator', uri = c.uri_for('/administrator/create'), icon = 'icon-star' },
{ name = c.loc('Create Administrator'), uri = c.uri_for('/administrator/create'), icon = 'icon-star' },
];
ELSE;
helper.dt_buttons = [
{ name = 'API key', uri = "/administrator/'+full[\"id\"]+'/api_key", class = 'btn-small btn-info', icon = 'icon-lock' },
{ name = c.loc('API key'), uri = "/administrator/'+full[\"id\"]+'/api_key", class = 'btn-small btn-info', icon = 'icon-lock' },
];
END;

@ -68,6 +68,9 @@ $(document).ready(function() {
-%]
],
[% END -%]
"oLanguage": {
"sUrl": "js/i18n/[% c.loc('dataTables.default.js') %]"
},
"aoColumns": [
[% FOREACH f IN helper.column_fields -%]
{
@ -157,7 +160,7 @@ $(document).ready(function() {
<div class="row">
[% UNLESS back_created -%]
<span class="pull-left" style="margin:0 5px 0 5px;">
<a class="btn btn-primary btn-large" href="[% c.uri_for('/back') %]"><i class="icon-arrow-left"></i> Back</a>
<a class="btn btn-primary btn-large" href="[% c.uri_for('/back') %]"><i class="icon-arrow-left"></i> [% c.loc("Back") %]</a>
</span>
[% back_created = 1 -%]
[% END -%]
@ -201,7 +204,7 @@ $(document).ready(function() {
</thead>
<tbody>
<tr class="sw_action_row">
<td colspan="[% helper.column_titles.size + 1 %]">Loading...</td>
<td colspan="[% helper.column_titles.size + 1 %]">[% c.loc('Loading...') %]</td>
</tr>
</tbody>
</table>

Loading…
Cancel
Save