Make sure user visible strings are translated
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index 858840c..23f07b4 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -381,7 +381,7 @@
 
 void CConn::setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs)
 {
-  vlog.error("Invalid SetColourMapEntries from server!");
+  vlog.error(_("Invalid SetColourMapEntries from server!"));
 }
 
 void CConn::bell()
@@ -426,15 +426,15 @@
     lastServerEncoding = encoding;
 
   if (!Decoder::supported(encoding)) {
-    fprintf(stderr, "Unknown rect encoding %d\n", encoding);
-    throw Exception("Unknown rect encoding");
+    vlog.error(_("Unknown rect encoding %d"), encoding);
+    throw Exception(_("Unknown rect encoding"));
   }
 
   if (!decoders[encoding]) {
     decoders[encoding] = Decoder::createDecoder(encoding, this);
     if (!decoders[encoding]) {
-      fprintf(stderr, "Unknown rect encoding %d\n", encoding);
-      throw Exception("Unknown rect encoding");
+      vlog.error(_("Unknown rect encoding %d"), encoding);
+      throw Exception(_("Unknown rect encoding"));
     }
   }
   decoders[encoding]->readRect(r, desktop->getFramebuffer());
diff --git a/vncviewer/DesktopWindow.cxx b/vncviewer/DesktopWindow.cxx
index d57d57a..3579618 100644
--- a/vncviewer/DesktopWindow.cxx
+++ b/vncviewer/DesktopWindow.cxx
@@ -103,7 +103,7 @@
         break;
       default:
         geom_x = geom_y = 0;
-        vlog.error("Invalid geometry specified!");
+        vlog.error(_("Invalid geometry specified!"));
       }
     }
   }
@@ -324,7 +324,7 @@
         Fl::screen_xywh(sx, sy, sw, sh, i);
 
         if ((sx == x) && (sy == y) && (sw == w) && (sh == h)) {
-          vlog.info("Adjusting window size to avoid accidental full screen request");
+          vlog.info(_("Adjusting window size to avoid accidental full screen request"));
           // Assume a panel of some form and adjust the height
           y += 20;
           h -= 40;
@@ -794,7 +794,7 @@
              cc->cp.width, cc->cp.height, width, height, layout.num_screens());
 
   if (!layout.validate(width, height)) {
-    vlog.error("Invalid screen layout computed for resize request!");
+    vlog.error(_("Invalid screen layout computed for resize request!"));
     return;
   }
 
diff --git a/vncviewer/FLTKPixelBuffer.cxx b/vncviewer/FLTKPixelBuffer.cxx
index 588e2f8..1eafe10 100644
--- a/vncviewer/FLTKPixelBuffer.cxx
+++ b/vncviewer/FLTKPixelBuffer.cxx
@@ -20,6 +20,7 @@
 
 #include <rfb/Exception.h>
 
+#include "i18n.h"
 #include "FLTKPixelBuffer.h"
 
 FLTKPixelBuffer::FLTKPixelBuffer(int width, int height) :
@@ -29,7 +30,7 @@
 {
   data = new rdr::U8[width * height * format.bpp/8];
   if (data == NULL)
-    throw rfb::Exception("Error: Not enough memory for framebuffer");
+    throw rfb::Exception(_("Error: Not enough memory for framebuffer"));
 }
 
 FLTKPixelBuffer::~FLTKPixelBuffer()
diff --git a/vncviewer/OSXPixelBuffer.cxx b/vncviewer/OSXPixelBuffer.cxx
index d196497..df82c86 100644
--- a/vncviewer/OSXPixelBuffer.cxx
+++ b/vncviewer/OSXPixelBuffer.cxx
@@ -30,6 +30,7 @@
 #include <rfb/LogWriter.h>
 #include <rfb/Exception.h>
 
+#include "i18n.h"
 #include "OSXPixelBuffer.h"
 
 using namespace rfb;
@@ -46,7 +47,7 @@
 
   data = new rdr::U8[width * height * format.bpp/8];
   if (data == NULL)
-    throw rfb::Exception("Error: Not enough memory for framebuffer");
+    throw rfb::Exception(_("Error: Not enough memory for framebuffer"));
 
   lut = CGColorSpaceCreateDeviceRGB();
   assert(lut);
diff --git a/vncviewer/Win32PixelBuffer.cxx b/vncviewer/Win32PixelBuffer.cxx
index 9fb0414..4871816 100644
--- a/vncviewer/Win32PixelBuffer.cxx
+++ b/vncviewer/Win32PixelBuffer.cxx
@@ -31,6 +31,7 @@
 #include <rfb/LogWriter.h>
 #include <rfb/Exception.h>
 
+#include "i18n.h"
 #include "Win32PixelBuffer.h"
 
 using namespace rfb;
@@ -59,7 +60,7 @@
                             DIB_RGB_COLORS, (void**)&data, NULL, 0);
   if (!bitmap) {
     int err = GetLastError();
-    throw rdr::SystemException("unable to create DIB section", err);
+    throw rdr::SystemException(_("unable to create DIB section"), err);
   }
 }
 
@@ -76,10 +77,10 @@
 
   dc = CreateCompatibleDC(fl_gc);
   if (!dc)
-    throw rdr::SystemException("CreateCompatibleDC failed", GetLastError());
+    throw rdr::SystemException(_("CreateCompatibleDC failed"), GetLastError());
 
   if (!SelectObject(dc, bitmap))
-    throw rdr::SystemException("SelectObject failed", GetLastError());
+    throw rdr::SystemException(_("SelectObject failed"), GetLastError());
 
   if (!BitBlt(fl_gc, x, y, w, h, dc, src_x, src_y, SRCCOPY)) {
     // If the desktop we're rendering to is inactive (like when the screen
@@ -88,7 +89,7 @@
     // with it. For now, we've only seen this error and for this function
     // so only ignore this combination.
     if (GetLastError() != ERROR_INVALID_HANDLE)
-      throw rdr::SystemException("BitBlt failed", GetLastError());
+      throw rdr::SystemException(_("BitBlt failed"), GetLastError());
   }
 
   DeleteDC(dc);
diff --git a/vncviewer/X11PixelBuffer.cxx b/vncviewer/X11PixelBuffer.cxx
index c709984..b729e80 100644
--- a/vncviewer/X11PixelBuffer.cxx
+++ b/vncviewer/X11PixelBuffer.cxx
@@ -29,6 +29,7 @@
 #include <rfb/LogWriter.h>
 #include <rfb/Exception.h>
 
+#include "i18n.h"
 #include "X11PixelBuffer.h"
 
 using namespace rfb;
@@ -56,7 +57,7 @@
     if (format[i].depth == fl_visual->depth) break;
 
   if (i == nformats)
-    throw rfb::Exception("Error: display lacks pixmap format for default depth");
+    throw rfb::Exception(_("Error: display lacks pixmap format for default depth"));
 
   switch (format[i].bits_per_pixel) {
   case 8:
@@ -65,7 +66,7 @@
     bpp = format[i].bits_per_pixel;
     break;
   default:
-    throw rfb::Exception("Error: couldn't find suitable pixmap format");
+    throw rfb::Exception(_("Error: couldn't find suitable pixmap format"));
   }
 
   XFree(format);
@@ -74,9 +75,9 @@
   trueColour = (fl_visual->c_class == TrueColor);
 
   if (!trueColour)
-    throw rfb::Exception("Error: only true colour displays supported");
+    throw rfb::Exception(_("Error: only true colour displays supported"));
 
-  vlog.info("Using default colormap and visual, %sdepth %d.",
+  vlog.info(_("Using default colormap and visual, %sdepth %d."),
             (fl_visual->c_class == TrueColor) ? "TrueColor, " :
             ((fl_visual->c_class == PseudoColor) ? "PseudoColor, " : ""),
             fl_visual->depth);
diff --git a/vncviewer/parameters.cxx b/vncviewer/parameters.cxx
index b7b33b5..9297a16 100644
--- a/vncviewer/parameters.cxx
+++ b/vncviewer/parameters.cxx
@@ -44,6 +44,8 @@
 #include <string.h>
 #include <limits.h>
 
+#include "i18n.h"
+
 using namespace rfb;
 
 static LogWriter vlog("Parameters");
@@ -195,8 +197,9 @@
       strncpy(dest+pos, "\\\\", 2);
       pos++;
       if (pos >= destSize) {
-	vlog.error("Encoding backslash: The size of the buffer dest is to small, "
-		   "it needs to be more than %d bytes bigger.", (destSize - 1 - i));
+	vlog.error(_("Encoding backslash: The size of the buffer dest "
+	             "is to small, it needs to be more than %d bytes bigger."),
+	             (destSize - 1 - i));
 	return false;
       }
 
@@ -208,8 +211,9 @@
 	  dest[pos] = '\\';
 	  pos++;
 	  if (pos >= destSize) {
-	    vlog.error("Encoding escape sequence: The size of the buffer dest is to small, "
-		       "it needs to be more than %d bytes bigger.", (destSize - 1 - i));
+	    vlog.error(_("Encoding escape sequence: The size of the buffer "
+	                 "dest is to small, it needs to be more than %d bytes "
+	                 "bigger."), (destSize - 1 - i));
 	    return false;
 	  }
 
@@ -226,8 +230,9 @@
 
     pos++;
     if (pos >= destSize) {
-      vlog.error("Encoding normal character: The size of the buffer dest is to small, "
-		 "it needs to be more than %d bytes bigger.", (destSize - 1 - i));
+      vlog.error(_("Encoding normal character: The size of the buffer dest "
+                   "is to small, it needs to be more than %d bytes bigger."),
+                   (destSize - 1 - i));
       return false;
     }
 
@@ -262,7 +267,7 @@
 	  dest[pos] = val[i];
 	  i++;
 	} else {
-	  vlog.error("Unknown escape sequence at character %d", i);
+	  vlog.error(_("Unknown escape sequence at character %d"), i);
 	  return false;
 	}
       }
@@ -274,8 +279,8 @@
     escapedCharacter = false; // Reset for next loop
     pos++;
     if (pos >= destSize) {
-      vlog.error("Decoding: The size of the buffer dest is to small, "
-		 "it needs to be 1 byte bigger.");
+      vlog.error(_("Decoding: The size of the buffer dest is to small, "
+                   "it needs to be 1 byte bigger."));
       return false;
     }
   }
@@ -293,29 +298,31 @@
   wchar_t name[buffersize];
   unsigned size = fl_utf8towc(_name, strlen(_name)+1, name, buffersize);
   if (size >= buffersize) {
-    vlog.error("Could not convert the parameter-name %s to wchar_t* when "
-	       "writing to the Registry, the buffersize is to small.", _name);
+    vlog.error(_("Could not convert the parameter-name %s to wchar_t* when "
+                 "writing to the Registry, the buffersize is to small."),
+                 _name);
     return;
   }
 
   char encodingBuffer[buffersize];
   if (!encodeValue(_value, encodingBuffer, buffersize)) {
-    vlog.error("Could not encode the parameter-value %s when "
-	       "writing to the Registry.", _value);
+    vlog.error(_("Could not encode the parameter-value %s when "
+                 "writing to the Registry."), _value);
     return;
   }
 
   wchar_t value[buffersize];
   size = fl_utf8towc(encodingBuffer, strlen(encodingBuffer)+1, value, buffersize);
   if (size >= buffersize) {
-    vlog.error("Could not convert the parameter-value %s to wchar_t* when "
-	       "writing to the Registry, the buffersize is to small.", _value);
+    vlog.error(_("Could not convert the parameter-value %s to wchar_t* when "
+                 "writing to the Registry, the buffersize is to small."),
+                 _value);
     return;
   }
 
   LONG res = RegSetValueExW(*hKey, name, 0, REG_SZ, (BYTE*)&value, (wcslen(value)+1)*2);
   if (res != ERROR_SUCCESS) {
-    vlog.error("Error(%d) writing %s(REG_SZ) to Registry.", res, _value);
+    vlog.error(_("Error(%d) writing %s(REG_SZ) to Registry."), res, _value);
     return;
   }
 }
@@ -329,14 +336,15 @@
 
   unsigned size = fl_utf8towc(_name, strlen(_name)+1, name, buffersize);
   if (size >= buffersize) {
-    vlog.error("Could not convert the parameter-name %s to wchar_t* when "
-	       "writing to the Registry, the buffersize is to small.", _name);
+    vlog.error(_("Could not convert the parameter-name %s to wchar_t* when "
+                 "writing to the Registry, the buffersize is to small."),
+                 _name);
     return;
   }
   
   LONG res = RegSetValueExW(*hKey, name, 0, REG_DWORD, (BYTE*)&value, sizeof(DWORD));
   if (res != ERROR_SUCCESS) {
-    vlog.error("Error(%d) writing %d(REG_DWORD) to Registry.", res, _value);
+    vlog.error(_("Error(%d) writing %d(REG_DWORD) to Registry."), res, _value);
     return;
   }
 }
@@ -350,8 +358,9 @@
 
   unsigned size = fl_utf8towc(_name, strlen(_name)+1, name, buffersize);
   if (size >= buffersize) {
-    vlog.error("Could not convert the parameter-name %s to wchar_t* when "
-	       "reading from the Registry, the buffersize is to small.", _name);
+    vlog.error(_("Could not convert the parameter-name %s to wchar_t* when "
+                 "reading from the Registry, the buffersize is to small."),
+                 _name);
     return false;
   }
 
@@ -360,7 +369,7 @@
     if (res == ERROR_FILE_NOT_FOUND) {
       // The value does not exist, defaults will be used.
     } else {
-      vlog.error("Error(%d) reading %s from Registry.", res, _name);
+      vlog.error(_("Error(%d) reading %s from Registry."), res, _name);
     }
     return false;
   }
@@ -368,9 +377,9 @@
   char utf8val[destSize];
   size = fl_utf8fromwc(utf8val, sizeof(utf8val), value, wcslen(value)+1);
   if (size >= sizeof(utf8val)) {
-    vlog.error("Could not convert the parameter-value for %s to utf8 char* "
-	       "when reading from the Registry, the buffer dest is to small.",
-	       _name);
+    vlog.error(_("Could not convert the parameter-value for %s to utf8 "
+                 "char* when reading from the Registry, the buffer dest is "
+                 "to small."), _name);
     return false;
   }
   const char *ret = utf8val;
@@ -391,8 +400,9 @@
 
   unsigned size = fl_utf8towc(_name, strlen(_name)+1, name, buffersize);
   if (size >= buffersize) {
-    vlog.error("Could not convert the parameter-name %s to wchar_t* when "
-	       "reading from the Registry, the buffersize is to small.", _name);
+    vlog.error(_("Could not convert the parameter-name %s to wchar_t* when "
+                 "reading from the Registry, the buffersize is to small."),
+                 _name);
     return false;
   }
 
@@ -401,7 +411,7 @@
     if (res == ERROR_FILE_NOT_FOUND) {
       // The value does not exist, defaults will be used.
     } else {
-      vlog.error("Error(%d) reading %s from Registry.", res, _name);
+      vlog.error(_("Error(%d) reading %s from Registry."), res, _name);
     }
     return false;
   }
@@ -418,7 +428,7 @@
   LONG res = RegCreateKeyExW(HKEY_CURRENT_USER, L"Software\\TigerVNC\\vncviewer", 0, NULL, 
 			     REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL);
   if (res != ERROR_SUCCESS) {
-    vlog.error("Error(%d) creating key: Software\\TigerVNC\\vncviewer", res);
+    vlog.error(_("Error(%d) creating key: Software\\TigerVNC\\vncviewer"), res);
     return;
   }
 
@@ -432,13 +442,14 @@
     } else if (dynamic_cast<BoolParameter*>(parameterArray[i]) != NULL) {
       setKeyInt(parameterArray[i]->getName(), (int)*(BoolParameter*)parameterArray[i], &hKey);
     } else {      
-      vlog.info("The parameterArray contains a object of a invalid type at line %d.", i);
+      vlog.info(_("The parameterArray contains a object of a invalid type "
+                  "at line %d."), i);
     }
   }
 
   res = RegCloseKey(hKey);
   if (res != ERROR_SUCCESS) {
-    vlog.error("Error(%d) closing key: Software\\TigerVNC\\vncviewer", res);
+    vlog.error(_("Error(%d) closing key: Software\\TigerVNC\\vncviewer"), res);
   }
 }
 
@@ -453,7 +464,7 @@
     if (res == ERROR_FILE_NOT_FOUND) {
       // The key does not exist, defaults will be used.
     } else {
-      vlog.error("Error(%d) opening key: Software\\TigerVNC\\vncviewer", res);
+      vlog.error(_("Error(%d) opening key: Software\\TigerVNC\\vncviewer"), res);
     }
     return NULL;
   }
@@ -479,13 +490,13 @@
       if (getKeyInt(parameterArray[i]->getName(), &intValue, &hKey))
 	((BoolParameter*)parameterArray[i])->setParam(intValue);
     } else {      
-      vlog.info("The parameterArray contains a object of a invalid type at line %d.", i);
+      vlog.info(_("The parameterArray contains a object of a invalid type at line %d."), i);
     }
   }
 
   res = RegCloseKey(hKey);
   if (res != ERROR_SUCCESS){
-    vlog.error("Error(%d) closing key:  Software\\TigerVNC\\vncviewer", res);
+    vlog.error(_("Error(%d) closing key:  Software\\TigerVNC\\vncviewer"), res);
   }
   
   return servername;
@@ -510,8 +521,8 @@
     
     char* homeDir = NULL;
     if (getvnchomedir(&homeDir) == -1) {
-      vlog.error("Failed to write configuration file, "
-		 "can't obtain home directory path.");
+      vlog.error(_("Failed to write configuration file, can't obtain home "
+                   "directory path."));
       return;
     }
 
@@ -524,7 +535,7 @@
   FILE* f = fopen(filepath, "w+");
   if (!f) {
     snprintf(write_error, sizeof(write_error),
-             "Failed to write configuration file, can't open %s", filepath);
+             _("Failed to write configuration file, can't open %s"), filepath);
     throw Exception(write_error);
   }
   
@@ -543,7 +554,8 @@
     } else if (dynamic_cast<BoolParameter*>(parameterArray[i]) != NULL) {
       fprintf(f, "%s=%d\n", ((BoolParameter*)parameterArray[i])->getName(), (int)*(BoolParameter*)parameterArray[i]);
     } else {      
-      vlog.info("The parameterArray contains a object of a invalid type at line %d.", i);
+      vlog.info(_("The parameterArray contains a object of a invalid type "
+                  "at line %d."), i);
     }
   }
   fclose(f);
@@ -569,8 +581,8 @@
 
     char* homeDir = NULL;
     if (getvnchomedir(&homeDir) == -1)
-      throw Exception("Failed to read configuration file, " 
-			   "can't obtain home directory path.");
+      throw Exception(_("Failed to read configuration file, "
+                        "can't obtain home directory path."));
 
     snprintf(filepath, sizeof(filepath), "%sdefault.tigervnc", homeDir);
   } else {
@@ -582,8 +594,8 @@
   if (!f) {
     if (!filename)
       return NULL; // Use defaults.
-    snprintf(readError, sizeof(readError), "Failed to read configuration file, "
-	     "can't open %s", filepath);
+    snprintf(readError, sizeof(readError),
+             _("Failed to read configuration file, can't open %s"), filepath);
     throw Exception(readError);
   }
   
@@ -594,15 +606,15 @@
     lineNr++;
     if (!fgets(line, sizeof(line), f)) {
       if (line[sizeof(line) -1] != '\0') {
-	vlog.error("Could not read the line(%d) in the configuration file,"
-		   "the buffersize is to small.", lineNr);
+        vlog.error(_("Could not read the line(%d) in the configuration file,"
+                     "the buffersize is to small."), lineNr);
 	return NULL;
       }
       if (feof(f))
 	break;
 
-      snprintf(readError, sizeof(readError), "Failed to read line %d in file %s", 
-	       lineNr, filepath);
+      snprintf(readError, sizeof(readError),
+               _("Failed to read line %d in file %s"), lineNr, filepath);
       throw Exception(readError);
     }
     
@@ -611,9 +623,10 @@
       if(strncmp(line, IDENTIFIER_STRING, strlen(IDENTIFIER_STRING)) == 0) {
 	continue;
       } else {
-	snprintf(readError, sizeof(readError), "Line 1 in file %s\n"
-		 "must contain the TigerVNC configurationfile identifier string:\n"
-		 "\"%s\"", filepath, IDENTIFIER_STRING);
+        snprintf(readError, sizeof(readError),
+                 _("Line 1 in file %s\nmust contain the TigerVNC "
+                   "configuration file identifier string:\n"
+                   "\"%s\""), filepath, IDENTIFIER_STRING);
 	throw Exception(readError);
       }
     }
@@ -631,7 +644,7 @@
     // Find the parameter value
     char *value = strchr(line, '=');
     if (value == NULL) {
-      vlog.info("Bad Name/Value pair on line: %d in file: %s", 
+      vlog.info(_("Bad Name/Value pair on line: %d in file: %s"),
 		lineNr, filepath);
       continue;
     }
@@ -644,8 +657,8 @@
     if (strcasecmp(line, "ServerName") == 0) {
 
       if(!decodeValue(value, decodingBuffer, sizeof(decodingBuffer))) {
-	vlog.info("The value of the parameter %s on line %d in file %s is invalid.",
-		  line, lineNr, filepath);
+        vlog.info(_("The value of the parameter %s on line %d in file %s "
+                    "is invalid."), line, lineNr, filepath);
 	continue;
       }
       snprintf(servername, sizeof(decodingBuffer), "%s", decodingBuffer);
@@ -660,8 +673,8 @@
 	  if (strcasecmp(line, ((StringParameter*)parameterArray[i])->getName()) == 0) {
 
 	    if(!decodeValue(value, decodingBuffer, sizeof(decodingBuffer))) {
-	      vlog.info("The value of the parameter %s on line %d in file %s is invalid.",
-			line, lineNr, filepath);
+        vlog.info(_("The value of the parameter %s on line %d in file %s "
+                    "is invalid."), line, lineNr, filepath);
 	      continue;
 	    }
 	    ((StringParameter*)parameterArray[i])->setParam(decodingBuffer);
@@ -681,13 +694,14 @@
 	  }
 
 	} else {      
-	  vlog.info("The parameterArray contains a object of a invalid type at line %d.", lineNr);
+    vlog.info(_("The parameterArray contains a object of a invalid type "
+                "at line %d."), lineNr);
 	}
       }
     }
 
     if (invalidParameterName)
-      vlog.info("Invalid parameter name on line: %d in file: %s", 
+      vlog.info(_("Invalid parameter name on line: %d in file: %s"),
 		lineNr, filepath);
   }
   fclose(f); f=0;
diff --git a/vncviewer/vncviewer.cxx b/vncviewer/vncviewer.cxx
index 8e24937..c818d33 100644
--- a/vncviewer/vncviewer.cxx
+++ b/vncviewer/vncviewer.cxx
@@ -115,7 +115,7 @@
 {
   // CleanupSignalHandler allows C++ object cleanup to happen because it calls
   // exit() rather than the default which is to abort.
-  vlog.info("CleanupSignalHandler called");
+  vlog.info(_("CleanupSignalHandler called"));
   exit(1);
 }
 
@@ -461,8 +461,8 @@
 #ifndef WIN32
   /* Specifying -via and -listen together is nonsense */
   if (listenMode && strlen(via.getValueStr()) > 0) {
-    vlog.error("Parameters -listen and -via are incompatible");
-    fl_alert("Parameters -listen and -via are incompatible");
+    vlog.error(_("Parameters -listen and -via are incompatible"));
+    fl_alert(_("Parameters -listen and -via are incompatible"));
     exit_vncviewer();
     return 1;
   }
@@ -476,7 +476,7 @@
 
       TcpListener listener(NULL, port);
 
-      vlog.info("Listening on port %d\n", port);
+      vlog.info(_("Listening on port %d\n"), port);
       sock = listener.accept();   
     } catch (rdr::Exception& e) {
       vlog.error("%s", e.str());