Found even more untranslated strings!
This commit is contained in:
parent
c6a7af0639
commit
b2ff35a6d9
include
111
include/Ajax.php
111
include/Ajax.php
@ -75,7 +75,7 @@ class Ajax extends Responder {
|
||||
if(isset($this->fragments[$fragment])) {
|
||||
return new Success($this->fragments[$fragment]);
|
||||
}
|
||||
return new Failure("Ogiltigt fragment '$fragment'");
|
||||
return new Failure(i18n('Invalid fragment {fragment}', $fragment));
|
||||
}
|
||||
|
||||
private function checkout_product() {
|
||||
@ -83,19 +83,19 @@ class Ajax extends Responder {
|
||||
try {
|
||||
$user = new User($_POST['user'], 'name');
|
||||
} catch(Exception $e) {
|
||||
return new Failure('Ogiltigt användar-id.');
|
||||
return new Failure(i18n('Invalid user ID.'));
|
||||
}
|
||||
$product = null;
|
||||
try {
|
||||
$product = new Product(trim($_POST['product']), 'serial');
|
||||
} catch(Exception $e) {
|
||||
return new Failure('Ogiltigt serienummer.');
|
||||
return new Failure(i18n('Invalid serial number.'));
|
||||
}
|
||||
try {
|
||||
Loan::create_loan($user, $product, $_POST['end']);
|
||||
return new Success($product->get_name() . 'utlånad.');
|
||||
return new Success(i18n('{product} checked out.', $product));
|
||||
} catch(Exception $e) {
|
||||
return new Failure('Artikeln är redan utlånad.');
|
||||
return new Failure(i18n('The product is already on loan.'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ class Ajax extends Responder {
|
||||
try {
|
||||
$product = new Product(trim($_POST['serial']), 'serial');
|
||||
} catch(Exception $e) {
|
||||
return new Failure('Ogiltigt serienummer.');
|
||||
return new Failure(i18n('Invalid serial number.'));
|
||||
}
|
||||
$loan = $product->get_active_loan();
|
||||
if($loan) {
|
||||
@ -119,9 +119,11 @@ class Ajax extends Responder {
|
||||
'name' => $product->get_name()),
|
||||
$this->fragments['item_link']);
|
||||
$user = $loan->get_user();
|
||||
return new Success($productlink . ' åter från ' . $userlink);
|
||||
return new Success(i18n('{product} returned from {user}',
|
||||
$productlink,
|
||||
$userlink));
|
||||
}
|
||||
return new Failure('Artikeln är inte utlånad.');
|
||||
return new Failure(i18n('The product is not on loan.'));
|
||||
}
|
||||
|
||||
private function extend_loan() {
|
||||
@ -129,50 +131,50 @@ class Ajax extends Responder {
|
||||
try {
|
||||
$product = new Product($_POST['product']);
|
||||
} catch(Exception $e) {
|
||||
return new Failure('Ogiltigt ID.');
|
||||
return new Failure(i18n('Invalid serial number.'));
|
||||
}
|
||||
$loan = $product->get_active_loan();
|
||||
if($loan) {
|
||||
$loan->extend($_POST['end']);
|
||||
return new Success('Lånet förlängt');
|
||||
return new Success(i18n('Loan extended.'));
|
||||
}
|
||||
return new Failure('Lån saknas.');
|
||||
return new Failure(i18n('The product is not on loan.'));
|
||||
}
|
||||
|
||||
private function start_inventory() {
|
||||
try {
|
||||
Inventory::begin();
|
||||
return new Success('Inventering startad.');
|
||||
return new Success(i18n('Inventory started.'));
|
||||
} catch(Exception $e) {
|
||||
return new Failure('Inventering redan igång.');
|
||||
return new Failure(i18n('Inventory already in progress.'));
|
||||
}
|
||||
}
|
||||
|
||||
private function end_inventory() {
|
||||
$inventory = Inventory::get_active();
|
||||
if($inventory === null) {
|
||||
return new Failure('Ingen inventering pågår.');
|
||||
return new Failure(i18n('No inventory in progress.'));
|
||||
}
|
||||
$inventory->end();
|
||||
return new Success('Inventering avslutad.');
|
||||
return new Success(i18n('Inventory ended.'));
|
||||
}
|
||||
|
||||
private function inventory_product() {
|
||||
$inventory = Inventory::get_active();
|
||||
if($inventory === null) {
|
||||
return new Failure('Ingen inventering pågår.');
|
||||
return new Failure(i18n('No inventory in progress.'));
|
||||
}
|
||||
$product = null;
|
||||
try {
|
||||
$product = new Product(trim($_POST['serial']), 'serial');
|
||||
} catch(Exception $e) {
|
||||
return new Failure('Ogiltigt serienummer.');
|
||||
return new Failure(i18n('Invalid serial number.'));
|
||||
}
|
||||
$result = $inventory->add_product($product);
|
||||
if(!$result) {
|
||||
return new Failure('Artikeln är redan registrerad.');
|
||||
return new Failure(i18n('Product already registered.'));
|
||||
}
|
||||
return new Success('Artikeln registrerad.');
|
||||
return new Success(i18n('Product registered.'));
|
||||
}
|
||||
|
||||
private function update_product() {
|
||||
@ -195,20 +197,21 @@ class Ajax extends Responder {
|
||||
unset($info[$key]);
|
||||
}
|
||||
if(!$name) {
|
||||
return new Failure('Artikeln måste ha ett namn.');
|
||||
return new Failure(i18n('The product must have a name.'));
|
||||
}
|
||||
if(!$serial) {
|
||||
return new Failure('Artikeln måste ha ett serienummer.');
|
||||
return new Failure(
|
||||
i18n('The product must have a serial number.'));
|
||||
}
|
||||
if(!$invoice) {
|
||||
return new Failure('Artikeln måste ha ett fakturanummer.');
|
||||
return new Failure(
|
||||
i18n('The product must have an invoice number.'));
|
||||
}
|
||||
$product = null;
|
||||
if(!$id) {
|
||||
try {
|
||||
$temp = new Product($serial, 'serial');
|
||||
return new Failure(
|
||||
'Det angivna serienumret finns redan på en annan artikel.');
|
||||
return new Failure(i18n('The given serial number is taken.'));
|
||||
} catch(Exception $e) {}
|
||||
try {
|
||||
$product = Product::create_product($brand,
|
||||
@ -221,14 +224,22 @@ class Ajax extends Responder {
|
||||
'id' => $product->get_id(),
|
||||
'name' => $product->get_name()),
|
||||
$this->fragments['item_link']);
|
||||
return new Success("Artikeln '$prodlink' sparad.");
|
||||
return new Success(i18n("Product {link} saved.", $prodlink));
|
||||
} catch(Exception $e) {
|
||||
return new Failure($e->getMessage());
|
||||
}
|
||||
}
|
||||
$product = new Product($id);
|
||||
if($product->get_discardtime()) {
|
||||
return new Failure('Skrotade artiklar får inte modifieras.');
|
||||
return new Failure(
|
||||
i18n('Discarded products may not be modified.'));
|
||||
}
|
||||
if($serial != $product->get_serial()) {
|
||||
try {
|
||||
$product->set_serial($serial);
|
||||
} catch(Exception $e) {
|
||||
return new Failure(i18n('The given serial number is taken.'));
|
||||
}
|
||||
}
|
||||
if($brand != $product->get_brand()) {
|
||||
$product->set_brand($brand);
|
||||
@ -236,13 +247,6 @@ class Ajax extends Responder {
|
||||
if($name != $product->get_name()) {
|
||||
$product->set_name($name);
|
||||
}
|
||||
if($serial != $product->get_serial()) {
|
||||
try {
|
||||
$product->set_serial($serial);
|
||||
} catch(Exception $e) {
|
||||
return new Failure('Det angivna serienumret finns redan på en annan artikel.');
|
||||
}
|
||||
}
|
||||
if($invoice != $product->get_invoice()) {
|
||||
$product->set_invoice($invoice);
|
||||
}
|
||||
@ -271,7 +275,7 @@ class Ajax extends Responder {
|
||||
foreach($tags as $tag) {
|
||||
$product->add_tag($tag);
|
||||
}
|
||||
return new Success('Ändringarna sparade.');
|
||||
return new Success(i18n('Changes saved.'));
|
||||
}
|
||||
|
||||
private function update_user() {
|
||||
@ -279,7 +283,7 @@ class Ajax extends Responder {
|
||||
$name = $_POST['name'];
|
||||
$notes = $_POST['notes'];
|
||||
if(!$name) {
|
||||
return new Failure('Användarnamnet får inte vara tomt.');
|
||||
return new Failure(i18n('Username may not be empty.'));
|
||||
}
|
||||
$user = new User($id);
|
||||
if($user->get_name() != $name) {
|
||||
@ -288,7 +292,7 @@ class Ajax extends Responder {
|
||||
if($user->get_notes() != $notes) {
|
||||
$user->set_notes($notes);
|
||||
}
|
||||
return new Success('Ändringarna sparade.');
|
||||
return new Success(i18n('Changes saved.'));
|
||||
}
|
||||
|
||||
private function save_template() {
|
||||
@ -308,16 +312,15 @@ class Ajax extends Responder {
|
||||
unset($info[$key]);
|
||||
}
|
||||
if(!$name) {
|
||||
return new Failure('Mallen måste ha ett namn.');
|
||||
return new Failure(i18n('The template must have a name.'));
|
||||
}
|
||||
$template = null;
|
||||
try {
|
||||
$template = new Template($name, 'name');
|
||||
} catch(Exception $e) {
|
||||
$template = Template::create_template($name, $info, $tags);
|
||||
$name = $template->get_name();
|
||||
return new Success(
|
||||
"Aktuella fält och taggar har sparats till mallen '$name'.");
|
||||
return new Success(i18n("Template {name} saved.",
|
||||
$template->get_name()));
|
||||
}
|
||||
foreach($template->get_fields() as $field) {
|
||||
if(!isset($info[$field])) {
|
||||
@ -341,18 +344,20 @@ class Ajax extends Responder {
|
||||
$template->add_tag($tag);
|
||||
}
|
||||
}
|
||||
$name = $template->get_name();
|
||||
return new Success("Mallen '$name' uppdaterad.");
|
||||
return new Success(i18n("Template {name} updated.",
|
||||
$template->get_name()));
|
||||
}
|
||||
|
||||
private function delete_template() {
|
||||
try {
|
||||
$template = $_POST['template'];
|
||||
Template::delete_template($template);
|
||||
$name = ucfirst(strtolower($template));
|
||||
return new Success("Mallen '$name' har raderats.");
|
||||
$request_name = $_POST['template'];
|
||||
$template = new Template($request_name, 'name');
|
||||
$template_name = $template->get_name();
|
||||
Template::delete_template($template_name);
|
||||
return new Success(i18n("Template {name} deleted.",
|
||||
$template_name));
|
||||
} catch(Exception $e) {
|
||||
return new Failure('Det finns ingen mall med det namnet.');
|
||||
return new Failure(i18n('There is no template by that name.'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,13 +373,12 @@ class Ajax extends Responder {
|
||||
$product = new Product($_POST['id']);
|
||||
if(!$product->get_discardtime()) {
|
||||
if($product->get_active_loan()) {
|
||||
return new Failure('Artikeln har ett aktivt lån.<br/>'
|
||||
.'Lånet måste avslutas innan artikeln skrotas.');
|
||||
return new Failure(i18n('Product on loan.'));
|
||||
}
|
||||
$product->discard();
|
||||
return new Success('Artikeln skrotad.');
|
||||
return new Success(i18n('Product scrapped.'));
|
||||
} else {
|
||||
return new Failure('Artikeln är redan skrotad.');
|
||||
return new Failure(i18n('Product has been scrapped already.'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -382,10 +386,9 @@ class Ajax extends Responder {
|
||||
$product = new Product($_POST['id']);
|
||||
try {
|
||||
$product->toggle_service();
|
||||
return new Success('Service-status uppdaterad.');
|
||||
return new Success(i18n('Product service status updated.'));
|
||||
} catch(Exception $e) {
|
||||
return new Failure('Service kan inte registreras '
|
||||
.'på den här artikeln nu.');
|
||||
return new Failure(i18n('Cannot register service.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,6 +273,182 @@ $i18n = array(
|
||||
"en" => function() { return "Borrowed products"; },
|
||||
"sv" => function() { return "Lånade artiklar"; },
|
||||
),
|
||||
"Invalid fragment {fragment}" => array(
|
||||
"en" => function($fragment) {
|
||||
return "Invalid fragment '$fragment'";
|
||||
},
|
||||
"sv" => function($fragment) {
|
||||
return "Ogiltigt fragment '$fragment'";
|
||||
},
|
||||
),
|
||||
"Invalid user ID." => array(
|
||||
"en" => function() { return "Invalid user ID."; },
|
||||
"sv" => function() { return "Ogiltigt användar-ID."; },
|
||||
),
|
||||
"Invalid serial number." => array(
|
||||
"en" => function() { return "Invalid serial number."; },
|
||||
"sv" => function() { return "Ogiltigt serienummer."; },
|
||||
),
|
||||
"The product is already on loan." => array(
|
||||
"en" => function() { return "The product is already on loan."; },
|
||||
"sv" => function() { return "Artikeln är redan utlånad."; },
|
||||
),
|
||||
"{product} checked out." => array(
|
||||
"en" => function($product) {
|
||||
$name = $produt->get_name();
|
||||
return "$name checked out.";
|
||||
},
|
||||
"sv" => function($product) {
|
||||
$name = $produt->get_name();
|
||||
return "$name utlånad.";
|
||||
},
|
||||
),
|
||||
"{product} returned from {user}" => array(
|
||||
"en" => function($product, $user) {
|
||||
return "$product returned from $user";
|
||||
},
|
||||
"sv" => function($product, $user) {
|
||||
return "$product åter från $user";
|
||||
},
|
||||
),
|
||||
"The product is not on loan." => array(
|
||||
"en" => function() { return "The product is not on loan."; },
|
||||
"sv" => function() { return "Artikeln är inte utlånad."; },
|
||||
),
|
||||
"Loan extended." => array(
|
||||
"en" => function() { return "Loan extended."; },
|
||||
"sv" => function() { return "Lånet förlängt."; },
|
||||
),
|
||||
"Inventory started." => array(
|
||||
"en" => function() { return "Inventory started."; },
|
||||
"sv" => function() { return "Inventering startad."; },
|
||||
),
|
||||
"Inventory already in progress." => array(
|
||||
"en" => function() { return "Inventory already in progress."; },
|
||||
"sv" => function() { return "Inventering redan igång."; },
|
||||
),
|
||||
"No inventory in progress." => array(
|
||||
"en" => function() { return "No inventory in progress."; },
|
||||
"sv" => function() { return "Ingen inventering pågår."; },
|
||||
),
|
||||
"Inventory ended." => array(
|
||||
"en" => function() { return "Inventory ended."; },
|
||||
"sv" => function() { return "Inventering avslutad."; },
|
||||
),
|
||||
"Product already registered." => array(
|
||||
"en" => function() { return "Product already registered."; },
|
||||
"sv" => function() { return "Artikeln är redan registrerad."; },
|
||||
),
|
||||
"Product registered." => array(
|
||||
"en" => function() { return "Product registered."; },
|
||||
"sv" => function() { return "Artikeln registrerad."; },
|
||||
),
|
||||
"The product must have a name." => array(
|
||||
"en" => function() { return "The product must have a name."; },
|
||||
"sv" => function() { return "Artikeln måste ha ett namn."; },
|
||||
),
|
||||
"The product must have a serial number." => array(
|
||||
"en" => function() {
|
||||
return "The product must have a serial number.";
|
||||
},
|
||||
"sv" => function() {
|
||||
return "Artikeln måste ha ett serienummer.";
|
||||
},
|
||||
),
|
||||
"The product must have an invoice number." => array(
|
||||
"en" => function() {
|
||||
return "The product must have an invoice number.";
|
||||
},
|
||||
"sv" => function() {
|
||||
return "Artikeln måste ha ett fakturanummer.";
|
||||
},
|
||||
),
|
||||
"The given serial number is taken." => array(
|
||||
"en" => function() { return "The given serial number is taken."; },
|
||||
"sv" => function() { return "Det angivna serienumret är upptaget."; },
|
||||
),
|
||||
"Product {link} saved." => array(
|
||||
"en" => function($prodlink) {
|
||||
return "Product '$prodlink' saved.";
|
||||
},
|
||||
"sv" => function($prodlink) {
|
||||
return "Artikeln '$prodlink' sparad.";
|
||||
},
|
||||
),
|
||||
"Discarded products may not be modified." => array(
|
||||
"en" => function() {
|
||||
return "Discarded products may not be modified.";
|
||||
},
|
||||
"sv" => function() {
|
||||
return "Skrotade artiklar får inte modifieras.";
|
||||
},
|
||||
),
|
||||
"Changes saved." => array(
|
||||
"en" => function() { return "Changes saved."; },
|
||||
"sv" => function() { return "Ändringarna sparade."; },
|
||||
),
|
||||
"Username may not be empty." => array(
|
||||
"en" => function() { return "Username may not be empty."; },
|
||||
"sv" => function() { return "Användarnamnet får inte vara tomt."; },
|
||||
),
|
||||
"The template must have a name." => array(
|
||||
"en" => function() { return "The template must have a name."; },
|
||||
"sv" => function() { return "Mallen måste ha ett namn."; },
|
||||
),
|
||||
"Template {name} saved." => array(
|
||||
"en" => function($name) {
|
||||
return "Current fields and tags have "
|
||||
."been saved to template '$name'.";
|
||||
},
|
||||
"sv" => function($name) {
|
||||
return "Aktuella fält och taggar har "
|
||||
."sparats till mallen '$name'.";
|
||||
},
|
||||
),
|
||||
"Template {name} updated." => array(
|
||||
"en" => function($name) { return "Template '$name' updated."; },
|
||||
"sv" => function($name) { return "Mallen '$name' uppdaterad."; },
|
||||
),
|
||||
"Template {name} deleted." => array(
|
||||
"en" => function($name) { return "Template '$name' deleted."; },
|
||||
"sv" => function($name) { return "Mallen '$name' har raderats."; },
|
||||
),
|
||||
"There is no template by that name." => array(
|
||||
"en" => function() { return "There is no template by that name."; },
|
||||
"sv" => function() { return "Det finns ingen mall med det namnet."; },
|
||||
),
|
||||
"Product on loan." => array(
|
||||
"en" => function() {
|
||||
return "The product is on loan.<br/>"
|
||||
."The loan must be ended before the product "
|
||||
."may be scrapped.";
|
||||
},
|
||||
"sv" => function() {
|
||||
return "Artikeln har ett aktivt lån.<br/>"
|
||||
."Lånet måste avslutas innan artikeln skrotas.";
|
||||
},
|
||||
),
|
||||
"Product scrapped." => array(
|
||||
"en" => function() { return "Product scrapped."; },
|
||||
"sv" => function() { return "Artikeln skrotad."; },
|
||||
),
|
||||
"Product has been scrapped already." => array(
|
||||
"en" => function() { return "Product has been scrapped already."; },
|
||||
"sv" => function() { return "Artikeln är redan skrotad."; },
|
||||
),
|
||||
"Product service status updated." => array(
|
||||
"en" => function() { return "Product service status updated."; },
|
||||
"sv" => function() { return "Artikelns service-status uppdaterad."; },
|
||||
),
|
||||
"Cannot register service." => array(
|
||||
"en" => function() {
|
||||
return "Service cannot be registered on the product "
|
||||
."in its current state.";
|
||||
},
|
||||
"sv" => function() {
|
||||
return "Service kan inte registreras på den här artikeln nu.";
|
||||
},
|
||||
),
|
||||
/*
|
||||
"" => array(
|
||||
"en" => function() { return ""; },
|
||||
|
Loading…
x
Reference in New Issue
Block a user