diff --git a/apps/contacts/ajax/activation.php b/apps/contacts/ajax/activation.php
index f4a2c94a148da46a21dcccecbfaf806c9203cc39..fda63a528a4c2e974702c87888bc7aede40779fd 100644
--- a/apps/contacts/ajax/activation.php
+++ b/apps/contacts/ajax/activation.php
@@ -10,10 +10,17 @@
 require_once ("../../../lib/base.php");
 OC_JSON::checkLoggedIn();
 OC_JSON::checkAppEnabled('contacts');
+$l=new OC_L10N('contacts');
+
 $bookid = $_POST['bookid'];
-OC_Contacts_Addressbook::setActive($bookid, $_POST['active']);
+if(!OC_Contacts_Addressbook::setActive($bookid, $_POST['active'])) {
+	OC_JSON::error(array('data' => array('message' => $l->t('Error (de)activating addressbook.'))));
+	OC_Log::write('contacts','ajax/activation.php: Error activating addressbook: '.$bookid, OC_Log::ERROR);
+	exit();
+}
 $book = OC_Contacts_App::getAddressbook($bookid);
 
+
 /* is there an OC_JSON::error() ? */
 OC_JSON::success(array(
 	'active' => OC_Contacts_Addressbook::isActive($bookid),
diff --git a/apps/contacts/ajax/addcard.php b/apps/contacts/ajax/addcard.php
index 9d9a99de33c1ffb718b8f1f1f32db0a5c8a8db6d..7e47659d23bb67dfa9cb78e39bfda75edeec2f78 100644
--- a/apps/contacts/ajax/addcard.php
+++ b/apps/contacts/ajax/addcard.php
@@ -26,6 +26,7 @@ require_once('../../../lib/base.php');
 // Check if we are a user
 OC_JSON::checkLoggedIn();
 OC_JSON::checkAppEnabled('contacts');
+$l=new OC_L10N('contacts');
 
 $aid = $_POST['id'];
 $addressbook = OC_Contacts_App::getAddressbook( $aid );
@@ -74,5 +75,11 @@ foreach( $add as $propname){
 	}
 }
 $id = OC_Contacts_VCard::add($aid,$vcard->serialize());
+if(!$id) {
+	OC_JSON::error(array('data' => array('message' => $l->t('There was an error adding the contact.'))));
+	OC_Log::write('contacts','ajax/addcard.php: Recieved non-positive ID on adding card: '.$name, OC_Log::ERROR);
+	exit();
+}
 
+// NOTE: Why is this in OC_Contacts_App?
 OC_Contacts_App::renderDetails($id, $vcard);
diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php
index 74f1c3d0e9eecd121b07eee24c0acceb03a22a9e..6e3ba3566c08de4e0006c516647034835d9f331d 100644
--- a/apps/contacts/ajax/addproperty.php
+++ b/apps/contacts/ajax/addproperty.php
@@ -61,7 +61,11 @@ foreach ($parameters as $key=>$element) {
 	}
 }
 
-OC_Contacts_VCard::edit($id,$vcard->serialize());
+if(!OC_Contacts_VCard::edit($id,$vcard->serialize())) {
+	OC_JSON::error(array('data' => array('message' => $l->t('Error adding contact property.'))));
+	OC_Log::write('contacts','ajax/addproperty.php: Error updating contact property: '.$name, OC_Log::ERROR);
+	exit();
+}
 
 $adr_types = OC_Contacts_App::getTypesOfProperty('ADR');
 $phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
diff --git a/apps/contacts/ajax/createaddressbook.php b/apps/contacts/ajax/createaddressbook.php
index f94ad34e8dc4fae7d3dddad511b1ac7ca71497b6..edcf794f497b22b727f84d7f80537dc77a49cbc6 100644
--- a/apps/contacts/ajax/createaddressbook.php
+++ b/apps/contacts/ajax/createaddressbook.php
@@ -1,6 +1,6 @@
 <?php
 /**
- * Copyright (c) 2011 Thomas Tanghus <thomas@tanghus.net>
+ * Copyright (c) 2011-2012 Thomas Tanghus <thomas@tanghus.net>
  * Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
  * This file is licensed under the Affero General Public License version 3 or
  * later.
@@ -16,7 +16,17 @@ OC_JSON::checkAppEnabled('contacts');
 
 $userid = OC_User::getUser();
 $bookid = OC_Contacts_Addressbook::add($userid, $_POST['name'], null);
-OC_Contacts_Addressbook::setActive($bookid, 1);
+if(!$bookid) {
+	OC_JSON::error(array('data' => array('message' => $l->t('Error adding addressbook.'))));
+	OC_Log::write('contacts','ajax/createaddressbook.php: Error adding addressbook: '.$_POST['name'], OC_Log::ERROR);
+	exit();
+}
+
+if(!OC_Contacts_Addressbook::setActive($bookid, 1)) {
+	OC_JSON::error(array('data' => array('message' => $l->t('Error activating addressbook.'))));
+	OC_Log::write('contacts','ajax/createaddressbook.php: Error activating addressbook: '.$bookid, OC_Log::ERROR);
+	//exit();
+}
 $addressbook = OC_Contacts_App::getAddressbook($bookid);
 $tmpl = new OC_Template('contacts', 'part.chooseaddressbook.rowfields');
 $tmpl->assign('addressbook', $addressbook);
diff --git a/apps/contacts/ajax/deleteproperty.php b/apps/contacts/ajax/deleteproperty.php
index f69735e61c69459a17d86058a8e0eb72c66701c0..89cf292f4f8a488c83520329b7e75e7978c12820 100644
--- a/apps/contacts/ajax/deleteproperty.php
+++ b/apps/contacts/ajax/deleteproperty.php
@@ -26,6 +26,7 @@ require_once('../../../lib/base.php');
 // Check if we are a user
 OC_JSON::checkLoggedIn();
 OC_JSON::checkAppEnabled('contacts');
+$l10n = new OC_L10N('contacts');
 
 $id = $_GET['id'];
 $checksum = $_GET['checksum'];
@@ -35,5 +36,10 @@ $line = OC_Contacts_App::getPropertyLineByChecksum($vcard, $checksum);
 
 unset($vcard->children[$line]);
 
-OC_Contacts_VCard::edit($id,$vcard->serialize());
+if(!OC_Contacts_VCard::edit($id,$vcard->serialize())) {
+	OC_JSON::error(array('data' => array('message' => $l->t('Error deleting contact property.'))));
+	OC_Log::write('contacts','ajax/deleteproperty.php: Error deleting contact property', OC_Log::ERROR);
+	exit();
+}
+
 OC_JSON::success(array('data' => array( 'id' => $id )));
diff --git a/apps/contacts/ajax/setproperty.php b/apps/contacts/ajax/setproperty.php
index bcc4c161cc04c0e1af30e67cd5bcf5f1ba9991af..e0cd70236c80df1ab09852cd3f8c96d35e53ce4e 100644
--- a/apps/contacts/ajax/setproperty.php
+++ b/apps/contacts/ajax/setproperty.php
@@ -72,9 +72,14 @@ foreach($missingparameters as $i){
 }
 
 // Do checksum and be happy
+// NOTE: This checksum is not used..?
 $checksum = md5($vcard->children[$line]->serialize());
 
-OC_Contacts_VCard::edit($id,$vcard->serialize());
+if(!OC_Contacts_VCard::edit($id,$vcard->serialize())) {
+	OC_JSON::error(array('data' => array('message' => $l->t('Error updating contact property.'))));
+	OC_Log::write('contacts','ajax/setproperty.php: Error updating contact property: '.$value, OC_Log::ERROR);
+	exit();
+}
 
 $adr_types = OC_Contacts_App::getTypesOfProperty('ADR');
 $phone_types = OC_Contacts_App::getTypesOfProperty('TEL');
diff --git a/apps/contacts/ajax/updateaddressbook.php b/apps/contacts/ajax/updateaddressbook.php
index 516736cc502d13b988c304242ecef2c654078ba4..7d9e2aea917bc98d693fad7c4b33bec64cd2111b 100644
--- a/apps/contacts/ajax/updateaddressbook.php
+++ b/apps/contacts/ajax/updateaddressbook.php
@@ -1,6 +1,6 @@
 <?php
 /**
- * Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
+ * Copyright (c) 2011-2012 Thomas Tanghus <thomas@tanghus.net>
  * This file is licensed under the Affero General Public License version 3 or
  * later.
  * See the COPYING-README file.
@@ -15,8 +15,19 @@ OC_JSON::checkLoggedIn();
 OC_JSON::checkAppEnabled('contacts');
 
 $bookid = $_POST['id'];
-OC_Contacts_Addressbook::edit($bookid, $_POST['name'], null);
-OC_Contacts_Addressbook::setActive($bookid, $_POST['active']);
+
+if(!OC_Contacts_Addressbook::edit($bookid, $_POST['name'], null)) {
+	OC_JSON::error(array('data' => array('message' => $l->t('Error updating addressbook.'))));
+	OC_Log::write('contacts','ajax/updateaddressbook.php: Error adding addressbook: ', OC_Log::ERROR);
+	//exit();
+}
+
+if(!OC_Contacts_Addressbook::setActive($bookid, $_POST['active'])) {
+	OC_JSON::error(array('data' => array('message' => $l->t('Error (de)activating addressbook.'))));
+	OC_Log::write('contacts','ajax/updateaddressbook.php: Error (de)activating addressbook: '.$bookid, OC_Log::ERROR);
+	//exit();
+}
+
 $addressbook = OC_Contacts_App::getAddressbook($bookid);
 $tmpl = new OC_Template('contacts', 'part.chooseaddressbook.rowfields');
 $tmpl->assign('addressbook', $addressbook);
diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js
index 741483633daa1ba8f325500a3d0fd849c52d46ba..8a1de3051a640fd7b1ef354d04e039c53182ef99 100644
--- a/apps/contacts/js/interface.js
+++ b/apps/contacts/js/interface.js
@@ -106,7 +106,7 @@ Contacts={
 							Contacts.UI.Contacts.update();
 							Contacts.UI.Addressbooks.overview();
 						} else {
-							Contacts.UI.messageBox('Error', data.message);
+							Contacts.UI.messageBox(t('contacts', 'Error'), data.message);
 							//alert('Error: ' + data.message);
 						}
 					  });
@@ -145,7 +145,7 @@ Contacts={
 						$('#contacts').html(jsondata.data.page);
 					}
 					else{
-						Contacts.UI.messageBox('Error',jsondata.data.message);
+						Contacts.UI.messageBox(t('contacts', 'Error'),jsondata.data.message);
 						//alert(jsondata.data.message);
 					}
 				});
@@ -186,7 +186,7 @@ $(document).ready(function(){
 				$('#leftcontent li[data-id="'+jsondata.data.id+'"]').addClass('active');
 			}
 			else{
-				Contacts.UI.messageBox('Error', jsondata.data.message);
+				Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
 				//alert(jsondata.data.message);
 			}
 		});
@@ -206,7 +206,7 @@ $(document).ready(function(){
 				$('#rightcontent').empty();
 			}
 			else{
-				Contacts.UI.messageBox('Error', jsondata.data.message);
+				Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
 				//alert(jsondata.data.message);
 			}
 		});
@@ -225,7 +225,7 @@ $(document).ready(function(){
 				$('#contacts_addproperty').hide();
 			}
 			else{
-				Contacts.UI.messageBox('Error', jsondata.data.message);
+				Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
 				alert('From handler: '+jsondata.data.message);
 			}
 		});
@@ -258,7 +258,7 @@ $(document).ready(function(){
 				$('#contacts_addpropertyform').before(jsondata.data.page);
 			}
 			else{
-				Contacts.UI.messageBox('Error', jsondata.data.message);
+				Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
 			}
 		}, 'json');
 		return false;
@@ -283,7 +283,7 @@ $(document).ready(function(){
 					.find('select').chosen();
 			}
 			else{
-				Contacts.UI.messageBox('Error', jsondata.data.message);
+				Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
 				//alert(jsondata.data.message);
 			}
 		});
@@ -313,7 +313,7 @@ $(document).ready(function(){
 				}
 			}
 			else{
-				Contacts.UI.messageBox('Error', jsondata.data.message);
+				Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
 				//alert(jsondata.data.message);
 			}
 		}, 'json');
@@ -332,7 +332,7 @@ $(document).ready(function(){
 					.find('select').chosen();
 			}
 			else{
-				Contacts.UI.messageBox('Error', jsondata.data.message);
+				Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
 				//alert(jsondata.data.message);
 			}
 		});
@@ -348,7 +348,7 @@ $(document).ready(function(){
 				$('.contacts_property[data-checksum="'+jsondata.data.oldchecksum+'"]').replaceWith(jsondata.data.page);
 			}
 			else{
-				Contacts.UI.messageBox('Error', jsondata.data.message);
+				Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
 				//alert(jsondata.data.message);
 			}
 		},'json');
@@ -363,7 +363,7 @@ $(document).ready(function(){
 				$('.contacts_property[data-checksum="'+checksum+'"]').remove();
 			}
 			else{
-				Contacts.UI.messageBox('Error', jsondata.data.message);
+				Contacts.UI.messageBox(t('contacts', 'Error'), jsondata.data.message);
 				//alert(jsondata.data.message);
 			}
 		});
diff --git a/apps/contacts/l10n/xgettextfiles b/apps/contacts/l10n/xgettextfiles
new file mode 100644
index 0000000000000000000000000000000000000000..91d5da46db0401080fb77a70f77ad3d896c1bb1a
--- /dev/null
+++ b/apps/contacts/l10n/xgettextfiles
@@ -0,0 +1,21 @@
+../appinfo/app.php
+../ajax/activation.php
+../ajax/addbook.php
+../ajax/addcard.php
+../ajax/addproperty.php
+../ajax/createaddressbook.php
+../ajax/deletebook.php
+../ajax/deleteproperty.php
+../ajax/getdetails.php
+../ajax/setproperty.php
+../ajax/updateaddressbook.php
+../lib/app.php
+../templates/index.php
+../templates/part.addcardform.php
+../templates/part.chooseaddressbook.php
+../templates/part.chooseaddressbook.rowfields.php
+../templates/part.details.php
+../templates/part.editaddressbook.php
+../templates/part.property.php
+../templates/part.setpropertyform.php
+../templates/settings.php
diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php
index 41d488c09f90c69dea6d6b4a9eb7213242b14cab..052c19e55fe40a8e03b194c34adadc895d71072e 100644
--- a/apps/contacts/lib/addressbook.php
+++ b/apps/contacts/lib/addressbook.php
@@ -256,6 +256,7 @@ class OC_Contacts_Addressbook{
 	 * @return boolean
 	 */
 	public static function delete($id){
+		// FIXME: There's no error checking at all.
 		self::setActive($id, false);
 		$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_addressbooks WHERE id = ?' );
 		$stmt->execute(array($id));
diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php
index 726927013c6c64a27a6c017eb46fc7eea7ff85d0..c61f0dfc1145197d2588a91420b2133ee7f6995a 100644
--- a/apps/contacts/lib/vcard.php
+++ b/apps/contacts/lib/vcard.php
@@ -240,6 +240,7 @@ class OC_Contacts_VCard{
 	 * @return boolean
 	 */
 	public static function delete($id){
+		// FIXME: Add error checking.
 		$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE id = ?' );
 		$stmt->execute(array($id));
 
@@ -261,6 +262,7 @@ class OC_Contacts_VCard{
 	 * @return boolean
 	 */
 	public static function deleteFromDAVData($aid,$uri){
+		// FIXME: Add error checking. Deleting a card gives an Kontact/Akonadi error.
 		$stmt = OC_DB::prepare( 'DELETE FROM *PREFIX*contacts_cards WHERE addressbookid = ? AND uri=?' );
 		$stmt->execute(array($aid,$uri));
 
diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php
index d548f17172d955b701b0ffdbc507ad8c584ab7a1..5d9c312712f7fbf2b3b4197e0712e26ea682c246 100644
--- a/apps/contacts/templates/index.php
+++ b/apps/contacts/templates/index.php
@@ -4,7 +4,7 @@
 <div id="controls">
 	<form>
 		<input type="button" id="contacts_newcontact" value="<?php echo $l->t('Add Contact'); ?>">
-		<input type="button" id="chooseaddressbook" value="<?php echo $l->t('Address Books'); ?>">
+		<input type="button" id="chooseaddressbook" value="<?php echo $l->t('Addressbooks'); ?>">
 	</form>
 </div>
 <div id="leftcontent" class="leftcontent">
diff --git a/apps/contacts/templates/part.addcardform.php b/apps/contacts/templates/part.addcardform.php
index 510096a9e81d36ccc90b8c9d07211261df13e038..53b32188ddf2cb733cffd43ac2ef04df6f79a8c6 100644
--- a/apps/contacts/templates/part.addcardform.php
+++ b/apps/contacts/templates/part.addcardform.php
@@ -5,7 +5,7 @@
 		<fieldset class="inputs">
 			<dl class="form">
 				<dt>
-					<label class="label" for="id"><?php echo $l->t('Group'); ?></label>
+					<label class="label" for="id"><?php echo $l->t('Addressbook'); ?></label>
 				</dt>
 				<dd>
 					<select name="id" size="1">
@@ -106,11 +106,5 @@
 			</dd>
 		</dl>
 	</fieldset>
-	<fieldset class="buttons">
-		<ol>
-			<li class="commit button">
-				<input class="create" type="submit" name="submit" value="<?php echo $l->t('Create Contact'); ?>">
-			</li>
-		</ol>
-	</fieldset>
+	<input class="create" type="submit" name="submit" value="<?php echo $l->t('Create Contact'); ?>">
 </form>
diff --git a/apps/contacts/templates/part.chooseaddressbook.rowfields.php b/apps/contacts/templates/part.chooseaddressbook.rowfields.php
index f612e39ecafdef5a70f77061b2ea248020c5c424..0cbfe2bf803c606b3e0b0337d8c3c41ef8989267 100644
--- a/apps/contacts/templates/part.chooseaddressbook.rowfields.php
+++ b/apps/contacts/templates/part.chooseaddressbook.rowfields.php
@@ -1,5 +1,5 @@
 <?php
-
+	// FIXME: Make this readable.
 	echo "<td width=\"20px\"><input id=\"active_" . $_['addressbook']["id"] . "\" type=\"checkbox\" onClick=\"Contacts.UI.Addressbooks.activation(this, " . $_['addressbook']["id"] . ")\"" . (OC_Contacts_Addressbook::isActive($_['addressbook']["id"]) ? ' checked="checked"' : '') . "></td>";
 	echo "<td><label for=\"active_" . $_['addressbook']["id"] . "\">" . $_['addressbook']["displayname"] . "</label></td>";
 	echo "<td width=\"20px\"><a href=\"#\" onclick=\"Contacts.UI.showCardDAVUrl('" . OC_User::getUser() . "', '" . $_['addressbook']["uri"] . "');\" title=\"" . $l->t("CardDav Link") . "\" class=\"action\"><img  class=\"svg action\" src=\"../../core/img/actions/public.svg\"></a></td><td width=\"20px\"><a href=\"export.php?bookid=" . $_['addressbook']["id"] . "\" title=\"" . $l->t("Download") . "\" class=\"action\"><img  class=\"svg action\" src=\"../../core/img/actions/download.svg\"></a></td><td width=\"20px\"><a  href=\"#\" title=\"" . $l->t("Edit") . "\" class=\"action\" onclick=\"Contacts.UI.Addressbooks.editAddressbook(this, " . $_['addressbook']["id"] . ");\"><img class=\"svg action\" src=\"../../core/img/actions/rename.svg\"></a></td><td width=\"20px\"><a href=\"#\" onclick=\"Contacts.UI.Addressbooks.deleteAddressbook('" . $_['addressbook']["id"] . "');\" title=\"" . $l->t("Delete") . "\" class=\"action\"><img  class=\"svg action\" src=\"../../core/img/actions/delete.svg\"></a></td>";
diff --git a/apps/contacts/templates/part.editaddressbook.php b/apps/contacts/templates/part.editaddressbook.php
index cb1371731b1a50f0db0a3b7deff58e738a6f4b01..48fe5c3b378fbd63425420064b7af7bd2d57fc3e 100644
--- a/apps/contacts/templates/part.editaddressbook.php
+++ b/apps/contacts/templates/part.editaddressbook.php
@@ -6,7 +6,7 @@
  * See the COPYING-README file.
  */
 ?>
-<td id="<?php echo $_['new'] ? 'new' : 'edit' ?>addressbook_dialog" title="<?php echo $_['new'] ? $l->t("New Address Book") : $l->t("Edit Address Book"); ?>" colspan="6">
+<td id="<?php echo $_['new'] ? 'new' : 'edit' ?>addressbook_dialog" title="<?php echo $_['new'] ? $l->t("New Addressbook") : $l->t("Edit Addressbook"); ?>" colspan="6">
 <table width="100%" style="border: 0;">
 <tr>
 	<th><?php echo $l->t('Displayname') ?></th>
diff --git a/apps/contacts/templates/settings.php b/apps/contacts/templates/settings.php
index d913062520076a60334537c0ab1a6b54c9bb3d27..c647e44c25b8f6b3c51853ad15d924597edaa615 100644
--- a/apps/contacts/templates/settings.php
+++ b/apps/contacts/templates/settings.php
@@ -1,7 +1,7 @@
 <form id="mediaform">
 	<fieldset class="personalblock">
-		<strong>Contacts</strong><br />
-		CardDAV syncing address:
+		<strong><?php echo $l->t('Contacts'); ?></strong><br />
+		<?php echo $l->t('CardDAV syncing address:'); ?>
   		<?php echo OC_Helper::linkTo('apps/contacts', 'carddav.php', null, true); ?><br />
 	</fieldset>
 </form>