diff --git a/include/class.translation.php b/include/class.translation.php
index dacd548722a7ca2752414b2ea40fe6a6d9ecdf4b..7d9deabe75db6310a159104fd2727c0270498c28 100644
--- a/include/class.translation.php
+++ b/include/class.translation.php
@@ -634,7 +634,13 @@ class Translation extends gettext_reader {
 }
 
 if (!defined('LC_MESSAGES')) {
-    define('LC_MESSAGES',	6);
+    define('LC_ALL', 0);
+    define('LC_CTYPE', 1);
+    define('LC_NUMERIC', 2);
+    define('LC_TIME', 3);
+    define('LC_COLLATE', 4);
+    define('LC_MONETARY', 5);
+    define('LC_MESSAGES', 6);
 }
 
 class TextDomain {
@@ -646,8 +652,15 @@ class TextDomain {
     static $registry;
     static $default_domain = 'messages';
     static $current_locale = '';
-    static $LC_CATEGORIES = array('LC_ALL', 'LC_CTYPE', 'LC_NUMERIC', 'LC_TIME',
-        'LC_COLLATE', 'LC_MONETARY', 'LC_MESSAGES');
+    static $LC_CATEGORIES = array(
+        LC_ALL => 'LC_ALL',
+        LC_CTYPE => 'LC_CTYPE',
+        LC_NUMERIC => 'LC_NUMERIC',
+        LC_TIME => 'LC_TIME',
+        LC_COLLATE => 'LC_COLLATE',
+        LC_MONETARY => 'LC_MONETARY',
+        LC_MESSAGES => 'LC_MESSAGES'
+    );
 
     function __construct($domain) {
         $this->domain = $domain;
@@ -670,7 +683,7 @@ class TextDomain {
                     break;
                 }
                 $phar_path = 'phar://' . $bound_path . $locale . ".phar/" . $subpath;
-                if (file_exists($full_path)) {
+                if (file_exists($phar_path)) {
                     $input = new FileReader($phar_path);
                     break;
                 }
diff --git a/include/staff/profile.inc.php b/include/staff/profile.inc.php
index 2f0470935a2d4a036855c0e9900594bca13cc32a..6b72f071cb8ab87798437b4cce55219a18ef2658 100644
--- a/include/staff/profile.inc.php
+++ b/include/staff/profile.inc.php
@@ -153,7 +153,7 @@ $info['id']=$staff->getId();
                      $sel=($info['auto_refresh_rate']==$i)?'selected="selected"':'';
                      echo sprintf('<option value="%1$d" %2$s>'
                         .sprintf(
-                            _N('Every minute', 'Every %d %minutes', $i), $i)
+                            _N('Every minute', 'Every %d minutes', $i), $i)
                          .'</option>',$i,$sel);
                      if($i>9)
                         $y=2;
diff --git a/scp/js/scp.js b/scp/js/scp.js
index 466446bde2bae96dc07fa8b34af4cc90f41eaf0a..2a7a08fcfb924e416018610d37704f2b9162b2b0 100644
--- a/scp/js/scp.js
+++ b/scp/js/scp.js
@@ -23,7 +23,7 @@ function checkbox_checker(formObj, min, max) {
     if (checked< min ){
         alert(__("Please make at least {0} selections. {1} checked so far.")
             .replace('{0}', min)
-            .replace('{1}', checked);
+            .replace('{1}', checked));
         return (false);
     }
 
@@ -415,7 +415,7 @@ var scp_prep = function() {
              })
             .fail( function () {
                 $('#result-count').html('<div class="fail">'
-                    + __('Advanced search failed - try again!'). + '</div>');
+                    + __('Advanced search failed - try again!') + '</div>');
             })
             .always( function () {
                 $('.spinner', elem).hide();
diff --git a/setup/cli/modules/i18n.php b/setup/cli/modules/i18n.php
index 8c477c801d96a1937a2b72c449955c3a515687ba..115e4a7d7371a2d6efee22a0c1d37b2ae32ecd1a 100644
--- a/setup/cli/modules/i18n.php
+++ b/setup/cli/modules/i18n.php
@@ -126,12 +126,15 @@ class i18n_Compiler extends Module {
         $lang = str_replace('-','_',$lang);
         @unlink(I18N_DIR."$lang.phar");
         $phar = new Phar(I18N_DIR."$lang.phar");
+        $phar->startBuffering();
 
         $po_file = false;
 
         for ($i=0; $i<$zip->numFiles; $i++) {
             $info = $zip->statIndex($i);
             $contents = $zip->getFromIndex($i);
+            if (!$contents)
+                continue;
             if (strpos($info['name'], '/messages.po') !== false) {
                 $po_file = $contents;
                 // Don't add the PO file as-is to the PHAR file
@@ -214,6 +217,7 @@ class i18n_Compiler extends Module {
 
         // Use a very small stub
         $phar->setStub('<?php __HALT_COMPILER();');
+        $phar->stopBuffering();
     }
 
     function __read_next_string($tokens) {
diff --git a/setup/setup.inc.php b/setup/setup.inc.php
index aa3ed094811110768235171c7dee9cd2a6613420..942dce953bae422962ddc0955e58babafe1e9d2b 100644
--- a/setup/setup.inc.php
+++ b/setup/setup.inc.php
@@ -59,6 +59,8 @@ require_once(INCLUDE_DIR.'class.passwd.php');
 require_once(INCLUDE_DIR.'class.format.php');
 require_once(INCLUDE_DIR.'class.misc.php');
 require_once INCLUDE_DIR.'mysqli.php';
-require_once(INCLUDE_DIR.'gettext-conf.php');
+require_once INCLUDE_DIR.'class.i18n.php';
+
+Internationalization::bootstrap();
 
 ?>