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/gui/theme/landscape_hdpi/ui.xml b/gui/theme/landscape_hdpi/ui.xml
index ef967f5..8241641 100644
--- a/gui/theme/landscape_hdpi/ui.xml
+++ b/gui/theme/landscape_hdpi/ui.xml
@@ -94,8 +94,13 @@
 		<variable name="tab_height" value="72" />
 		<variable name="tab_indicator_height" value="4" />
 		<variable name="tab4_width" value="480" />
+		<variable name="tab5_width" value="384" />
 		<variable name="tab4_col2_x" value="480" />
 		<variable name="tab4_col4_x" value="1440" />
+		<variable name="tab5_col2_x" value="384" />
+		<variable name="tab5_col3_x" value="768" />
+		<variable name="tab5_col4_x" value="1152" />
+		<variable name="tab5_col5_x" value="1536" />
 		<variable name="btn4_col2_x_left" value="282" />
 		<variable name="btn4_col3_x_left" value="516" />
 		<variable name="btn4_col4_x_left" value="750" />
@@ -255,7 +260,7 @@
 				<condition var1="tw_no_cpu_temp" var2="0" />
 				<font resource="font_m" />
 				<placement x="%indent%" y="%row1_header_y%" />
-				<text>CPU: %tw_cpu_temp% &#xB0;C</text>
+				<text>{@cpu_temp=CPU: %tw_cpu_temp% &#xB0;C}</text>
 			</object>
 
 			<object type="text" color="%text_color%">
@@ -272,7 +277,7 @@
 				</conditions>
 				<font resource="font_m" />
 				<placement x="%indent_right%" y="%row1_header_y%" placement="1" />
-				<text>Battery: %tw_battery%</text>
+				<text>{@battery_pct=Battery: %tw_battery%}</text>
 			</object>
 
 			<object type="fill" color="#000000">
@@ -456,14 +461,14 @@
 			<object type="button" style="sort_asc">
 				<condition var1="tw_gui_sort_order" op="=" var2="1" />
 				<placement x="%col_button_right%" y="%row1a_y%" />
-				<text>Sort by Name</text>
+				<text>{@sort_by_name=Sort by Name}</text>
 				<action function="set">tw_gui_sort_order=-1</action>
 			</object>
 
 			<object type="button" style="sort_desc">
 				<condition var1="tw_gui_sort_order" op="=" var2="-1" />
 				<placement x="%col_button_right%" y="%row1a_y%" />
-				<text>Sort by Name</text>
+				<text>{@sort_by_name=Sort by Name}</text>
 				<action function="set">tw_gui_sort_order=1</action>
 			</object>
 
@@ -473,21 +478,21 @@
 					<condition var1="tw_gui_sort_order" op="!=" var2="-1" />
 				</conditions>
 				<placement x="%col_button_right%" y="%row1a_y%" />
-				<text>Sort by Name</text>
+				<text>{@sort_by_name=Sort by Name}</text>
 				<action function="set">tw_gui_sort_order=1</action>
 			</object>
 
 			<object type="button" style="sort_asc">
 				<condition var1="tw_gui_sort_order" op="=" var2="2" />
 				<placement x="%col_button_right%" y="%row4a_y%" />
-				<text>Sort by Date</text>
+				<text>{@sort_by_date=Sort by Date}</text>
 				<action function="set">tw_gui_sort_order=-2</action>
 			</object>
 
 			<object type="button" style="sort_desc">
 				<condition var1="tw_gui_sort_order" op="=" var2="-2" />
 				<placement x="%col_button_right%" y="%row4a_y%" />
-				<text>Sort by Date</text>
+				<text>{@sort_by_date=Sort by Date}</text>
 				<action function="set">tw_gui_sort_order=2</action>
 			</object>
 
@@ -497,21 +502,21 @@
 					<condition var1="tw_gui_sort_order" op="!=" var2="-2" />
 				</conditions>
 				<placement x="%col_button_right%" y="%row4a_y%" />
-				<text>Sort by Date</text>
+				<text>{@sort_by_date=Sort by Date}</text>
 				<action function="set">tw_gui_sort_order=2</action>
 			</object>
 
 			<object type="button" style="sort_asc">
 				<condition var1="tw_gui_sort_order" op="=" var2="3" />
 				<placement x="%col_button_right%" y="%row7a_y%" />
-				<text>Sort by Size</text>
+				<text>{@sort_by_size=Sort by Size}</text>
 				<action function="set">tw_gui_sort_order=-3</action>
 			</object>
 
 			<object type="button" style="sort_desc">
 				<condition var1="tw_gui_sort_order" op="=" var2="-3" />
 				<placement x="%col_button_right%" y="%row7a_y%" />
-				<text>Sort by Size</text>
+				<text>{@sort_by_size=Sort by Size}</text>
 				<action function="set">tw_gui_sort_order=3</action>
 			</object>
 
@@ -521,35 +526,41 @@
 					<condition var1="tw_gui_sort_order" op="!=" var2="-3" />
 				</conditions>
 				<placement x="%col_button_right%" y="%row7a_y%" />
-				<text>Sort by Size</text>
+				<text>{@sort_by_size=Sort by Size}</text>
 				<action function="set">tw_gui_sort_order=3</action>
 			</object>
 		</template>
 
 		<template name="tabs_settings">
 			<object type="button" style="tab">
-				<placement x="0" y="%row1_y%" w="%tab4_width%" h="%tab_height%" />
-				<text>GENERAL</text>
+				<placement x="0" y="%row1_y%" w="%tab5_width%" h="%tab_height%" />
+				<text>{@tab_general=GENERAL}</text>
 				<action function="page">settings</action>
 			</object>
 
 			<object type="button" style="tab">
-				<placement x="%tab4_col2_x%" y="%row1_y%" w="%tab4_width%" h="%tab_height%" />
-				<text>TIME ZONE</text>
+				<placement x="%tab5_col2_x%" y="%row1_y%" w="%tab5_width%" h="%tab_height%" />
+				<text>{@tab_time_zone=TIME ZONE}</text>
 				<action function="page">settings_timezone</action>
 			</object>
 
 			<object type="button" style="tab">
-				<placement x="%center_x%" y="%row1_y%" w="%tab4_width%" h="%tab_height%" />
-				<text>SCREEN</text>
+				<placement x="%tab5_col3_x%" y="%row1_y%" w="%tab5_width%" h="%tab_height%" />
+				<text>{@tab_screen=SCREEN}</text>
 				<action function="page">settings_screen</action>
 			</object>
 
 			<object type="button" style="tab">
-				<placement x="%tab4_col4_x%" y="%row1_y%" w="%tab4_width%" h="%tab_height%" />
-				<text>VIBRATION</text>
+				<placement x="%tab5_col4_x%" y="%row1_y%" w="%tab5_width%" h="%tab_height%" />
+				<text>{@tab_vibration=VIBRATION}</text>
 				<action function="page">settings_vibration</action>
 			</object>
+
+			<object type="button" style="tab">
+				<placement x="%tab5_col5_x%" y="%row1_y%" w="%tab5_width%" h="%tab_height%" />
+				<text>{@tab_language=LANGUAGE}</text>
+				<action function="page">settings_language</action>
+			</object>
 		</template>
 
 		<template name="console">