docs: use devsite hdf bool as a javascript condition for managing the lang toggle.
sync the sdk and ds templates so we can move toward one template set

Change-Id: I5316d4cd085734a47953beba203ba8beeb64549e
diff --git a/tools/droiddoc/templates-ds/assets/js/docs.js b/tools/droiddoc/templates-ds/assets/js/docs.js
index a7440c7..557a242 100644
--- a/tools/droiddoc/templates-ds/assets/js/docs.js
+++ b/tools/droiddoc/templates-ds/assets/js/docs.js
@@ -15,8 +15,10 @@
 
 var navBarIsFixed = false;
 $(document).ready(function() {
-  // move the lang selector into the overflow menu
-  $("#moremenu .mid div.header:last").after($("#language").detach());
+  if (devsite) {
+    // move the lang selector into the overflow menu
+    $("#moremenu .mid div.header:last").after($("#language").detach());
+  }
 
   // init the fullscreen toggle click event
   $('#nav-swap .fullscreen').click(function(){
@@ -1051,8 +1053,20 @@
   // keep this for 50 years
   //alert("expires: " + expires)
   writeCookie("pref_lang", lang, null, expires);
-  if (submit) {
-    $("#setlang").submit();
+
+  //  #######  TODO:  Remove this condition once we're stable on devsite #######
+  //  This condition is only needed if we still need to support legacy GAE server
+  if (devsite) {
+    // Switch language when on Devsite server
+    if (submit) {
+      $("#setlang").submit();
+    }
+  } else {
+    // Switch language when on legacy GAE server
+    changeDocLang(lang);
+    if (submit) {
+      window.location = getBaseUri(location.pathname);
+    }
   }
 }