Multiple Language Support

This is similar to https://gerrit.omnirom.org/#/c/14014

A lot of the features built in the older patch set have been split
out into separate patches, most of which have already been merged.
The remaining functionality here should all be directly related to
language selection and loading. We always load English as a base
before loading other languages over the top of the base. The idea
is that if another language is missing a translation, then we will
still display the English.

Maybe still to do: read the /cache/recovery/last_locale file and
load a language based on that. For me, this file contains just:
en_US
We probably won't bother with region specific translations so we
would have to look at either trimming off the _US or using some
other method like perhaps a symlink or a combination of the two.

Thanks to _that for twmsg.cpp class

Change-Id: I9647a22e47883a3ddd2de1da51f64aab7c328f74
diff --git a/twrp.cpp b/twrp.cpp
index d49ae80..b33a6ad 100644
--- a/twrp.cpp
+++ b/twrp.cpp
@@ -15,12 +15,13 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
+#include <string>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <time.h>
 #include <unistd.h>
 #include <signal.h>
+#include "gui/twmsg.h"
 
 #include "cutils/properties.h"
 extern "C" {
@@ -37,6 +38,9 @@
 #include "gui/gui.h"
 #include "set_metadata.h"
 }
+#include "gui/gui.hpp"
+#include "gui/pages.hpp"
+#include "gui/objects.hpp"
 #include "twcommon.h"
 #include "twrp-functions.hpp"
 #include "data.hpp"
@@ -162,14 +166,14 @@
 			lgetfilecon("/sbin/teamwin", &contexts);
 		}
 		if (!contexts) {
-			gui_print_color("warning", "Kernel does not have support for reading SELinux contexts.\n");
+			gui_warn("no_kernel_selinux=Kernel does not have support for reading SELinux contexts.");
 		} else {
 			free(contexts);
-			gui_print("Full SELinux support is present.\n");
+			gui_msg("full_selinux=Full SELinux support is present.");
 		}
 	}
 #else
-	gui_print_color("warning", "No SELinux support (no libselinux).\n");
+	gui_warn("no_selinux=No SELinux support (no libselinux).");
 #endif
 
 	PartitionManager.Mount_By_Path("/cache", true);
@@ -307,6 +311,8 @@
 	DataManager::SetValue("tw_mtp_enabled", 1);
 #endif
 	DataManager::ReadSettingsFile();
+	PageManager::LoadLanguage(DataManager::GetStrValue("tw_language"));
+	GUIConsole::Translate_Now();
 
 	// Fixup the RTC clock on devices which require it
 	if(crash_counter == 0)
@@ -328,13 +334,13 @@
 			if (!PartitionManager.Enable_MTP())
 				PartitionManager.Disable_MTP();
 			else
-				gui_print("MTP Enabled\n");
+				gui_msg("mtp_enabled=MTP Enabled");
 		} else {
 			PartitionManager.Disable_MTP();
 		}
 		property_set("mtp.crash_check", "0");
 	} else {
-		gui_print_color("warning", "MTP Crashed, not starting MTP on boot.\n");
+		gui_warn("mtp_crash=MTP Crashed, not starting MTP on boot.");
 		DataManager::SetValue("tw_mtp_enabled", 0);
 		PartitionManager.Disable_MTP();
 	}
@@ -367,7 +373,6 @@
 		}
 	}
 #endif
-
 	// Launch the main GUI
 	gui_start();
 
@@ -391,7 +396,7 @@
 	// Reboot
 	TWFunc::Update_Intent_File(Reboot_Value);
 	TWFunc::Update_Log_File();
-	gui_print("Rebooting...\n");
+	gui_msg(Msg("rebooting=Rebooting..."));
 	string Reboot_Arg;
 	DataManager::GetValue("tw_reboot_arg", Reboot_Arg);
 	if (Reboot_Arg == "recovery")