AI 150370: Add localized content infrastructure in droiddoc templates, javascript, and css. DocFile.java - instead of FileReader, use InputStreamReader with UTF-8 encoding. ClearPage.java - add UTF-8 output encoding to FileOutputStreamWriter. Note: this change also up-integrates gerrit 2146 (smain).
BUG=1910893 Automated import of CL 150370
This commit is contained in:
parent
9e202af99c
commit
233bc0b84a
7 changed files with 99 additions and 54 deletions
|
@ -126,7 +126,7 @@ public class ClearPage
|
|||
OutputStreamWriter stream = null;
|
||||
try {
|
||||
stream = new OutputStreamWriter(
|
||||
new FileOutputStream(file));
|
||||
new FileOutputStream(file), "UTF-8");
|
||||
String rendered = cs.render();
|
||||
stream.write(rendered, 0, rendered.length());
|
||||
}
|
||||
|
|
|
@ -33,7 +33,8 @@ public class DocFile
|
|||
try {
|
||||
File f = new File(filename);
|
||||
int length = (int)f.length();
|
||||
FileReader reader = new FileReader(f);
|
||||
FileInputStream is = new FileInputStream(f);
|
||||
InputStreamReader reader = new InputStreamReader(is, "UTF-8");
|
||||
char[] buf = new char[length];
|
||||
int index = 0;
|
||||
int amt;
|
||||
|
|
|
@ -11,12 +11,12 @@ def:default_search_box() ?>
|
|||
<table class="gsc-search-box" cellpadding="0" cellspacing="0"><tbody>
|
||||
<tr>
|
||||
<td class="gsc-input">
|
||||
<input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off"
|
||||
<input id="search_autocomplete" class="gsc-input" type="text" size="33" autocomplete="off"
|
||||
title="search developer docs" name="q"
|
||||
value="search developer docs"
|
||||
onFocus="search_focus_changed(this, true)"
|
||||
onBlur="search_focus_changed(this, false)"
|
||||
onkeydown="return search_changed(event, true, '<?cs var:toroot?>')"
|
||||
value="search developer docs"
|
||||
onFocus="search_focus_changed(this, true)"
|
||||
onBlur="search_focus_changed(this, false)"
|
||||
onkeydown="return search_changed(event, true, '<?cs var:toroot?>')"
|
||||
onkeyup="return search_changed(event, false, '<?cs var:toroot?>')" />
|
||||
<div id="search_filtered_div" class="no-display">
|
||||
<table id="search_filtered" cellspacing=0>
|
||||
|
@ -46,19 +46,29 @@ def:custom_masthead() ?>
|
|||
</div>
|
||||
<div id="headerRight">
|
||||
<div id="headerLinks">
|
||||
<!-- <img src="<?cs var:toroot ?>assets/images/icon_world.jpg" alt="" /> -->
|
||||
<?cs if:template.showLanguageMenu ?>
|
||||
<img src="<?cs var:toroot ?>assets/images/icon_world.jpg" alt="" />
|
||||
<span id="language">
|
||||
<select name="language" onChange="changeLangPref(this.value)">
|
||||
<option value="en">English</option>
|
||||
<!-- <option value="ja"></option> -->
|
||||
</select>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
loadLangPref();
|
||||
//-->
|
||||
</script>
|
||||
</span>
|
||||
<a href="http://www.android.com">Android.com</a>
|
||||
<select name="language" onChange="changeLangPref(this.value, true)">
|
||||
<option value="en">English </option>
|
||||
<option value="ja">日本語</option>
|
||||
<?cs #
|
||||
<option value="de">Deutsch</option>
|
||||
<option value="es">Español</option>
|
||||
<option value="fr">Français</option>
|
||||
<option value="it">Italiano</option>
|
||||
<option value="zh-CN">中文 (简体)</option>
|
||||
<option value="zh-TW">中文 (繁體)</option>
|
||||
?>
|
||||
</select>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
loadLangPref();
|
||||
//-->
|
||||
</script>
|
||||
</span>
|
||||
<?cs /if ?>
|
||||
<a href="http://www.android.com">Android.com</a>
|
||||
</div><?cs
|
||||
call:default_search_box() ?>
|
||||
</div><!-- headerRight -->
|
||||
|
@ -151,9 +161,8 @@ def:default_left_nav() ?>
|
|||
if (!isMobile) {
|
||||
$("<a href='#' id='nav-swap' onclick='swapNav();return false;' style='font-size:10px;line-height:9px;margin-left:1em;text-decoration:none;'><span id='tree-link'>Use Tree Navigation</span><span id='panel-link' style='display:none'>Use Panel Navigation</span></a>").appendTo("#side-nav");
|
||||
chooseDefaultNav();
|
||||
if ($("#nav-tree").is(':visible')) {
|
||||
init_default_navtree("<?cs var:toroot ?>");
|
||||
} else {
|
||||
if ($("#nav-tree").is(':visible')) init_navtree("nav-tree", "<?cs var:toroot ?>", NAVTREE_DATA);
|
||||
else {
|
||||
addLoadEvent(function() {
|
||||
scrollIntoView("packages-nav");
|
||||
scrollIntoView("classes-nav");
|
||||
|
|
|
@ -9,27 +9,47 @@
|
|||
|
||||
<li id="home-link"><a href="<?cs var:toroot ?><?cs if:android.whichdoc != "online" ?>offline.html<?cs else ?>index.html<?cs /if ?>">
|
||||
<span class="en">Home</span>
|
||||
<span class="ja"></span>
|
||||
<span class="de">Startseite</span>
|
||||
<span class="ja">ホーム</span>
|
||||
<span class="zh-CN">主页</span>
|
||||
<span class="zh-TW">首頁</span>
|
||||
</a></li>
|
||||
<li id="sdk-link"><a href="<?cs var:toroot ?>sdk/<?cs var:sdk.current ?>/index.html">
|
||||
<span class="en">SDK</span>
|
||||
<span class="ja"></span>
|
||||
</a></li>
|
||||
<li id="guide-link"><a href="<?cs var:toroot ?>guide/index.html" onClick="return loadLast('guide')">
|
||||
<span class="en">Dev Guide</span>
|
||||
<span class="ja"></span>
|
||||
<span class="de">Handbuch</span>
|
||||
<span class="es">Guía</span>
|
||||
<span class="fr">Guide</span>
|
||||
<span class="it">Guida</span>
|
||||
<span class="ja">開発ガイド</span>
|
||||
<span class="zh-CN">开发人员指南</span>
|
||||
<span class="zh-TW">開發指南</span>
|
||||
</a></li>
|
||||
<li id="reference-link"><a href="<?cs var:toroot ?>reference/packages.html" onClick="return loadLast('reference')">
|
||||
<span class="en">Reference</span>
|
||||
<span class="ja"></span>
|
||||
<span class="de">Referenz</span>
|
||||
<span class="es">Referencia</span>
|
||||
<span class="fr">Référence</span>
|
||||
<span class="it">Riferimento</span>
|
||||
<span class="ja">リファレンス</span>
|
||||
<span class="zh-CN">参考</span>
|
||||
<span class="zh-TW">參考資料</span>
|
||||
</a></li>
|
||||
<li><a href="http://android-developers.blogspot.com">
|
||||
<span class="en">Blog</span>
|
||||
<span class="ja"></span>
|
||||
<span class="ja">ブログ</span>
|
||||
<span class="zh-CN">博客</span>
|
||||
<span class="zh-TW">網誌</span>
|
||||
</a></li>
|
||||
<li id="community-link"><a href="<?cs var:toroot ?>community/index.html">
|
||||
<span class="en">Community</span>
|
||||
<span class="ja"></span>
|
||||
<span class="es">Comunidad</span>
|
||||
<span class="fr">Communauté</span>
|
||||
<span class="ja">コミュニティ</span>
|
||||
<span class="zh-CN">社区</span>
|
||||
<span class="zh-TW">社群</span>
|
||||
</a></li>
|
||||
|
||||
</ul>
|
||||
</ul>
|
||||
|
|
|
@ -238,6 +238,10 @@ hr.blue {
|
|||
top:7px;
|
||||
}
|
||||
|
||||
#header li a span+span {
|
||||
display:none;
|
||||
}
|
||||
|
||||
/* TAB HIGHLIGHTING */
|
||||
.home #home-link a,
|
||||
.publish #publish-link a,
|
||||
|
@ -276,8 +280,12 @@ hr.blue {
|
|||
color: #7FA9B5;
|
||||
}
|
||||
|
||||
#headerLinks img {
|
||||
vertical-align:middle;
|
||||
}
|
||||
|
||||
#language {
|
||||
margin:0 10px;
|
||||
margin:0 10px 0 4px;
|
||||
}
|
||||
|
||||
#search {
|
||||
|
|
|
@ -89,6 +89,10 @@
|
|||
zoom:1;
|
||||
}
|
||||
|
||||
#side-nav li a span+span {
|
||||
display:none;
|
||||
}
|
||||
|
||||
#side-nav li a:hover {
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
@ -1130,9 +1134,9 @@ body .ui-resizable-autohide .ui-resizable-handle { display: none; } /* use 'body
|
|||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
#qv,
|
||||
/* #qv,
|
||||
#qv-wrapper {
|
||||
display:none;
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -31,15 +31,6 @@ if ((agent.indexOf("Mobile") != -1) ||
|
|||
addLoadEvent(mobileSetup);
|
||||
}
|
||||
|
||||
/* loads the lists.js file to the page.
|
||||
Loading this in the head was slowing page load time */
|
||||
addLoadEvent( function() {
|
||||
var lists = document.createElement("script");
|
||||
lists.setAttribute("type","text/javascript");
|
||||
lists.setAttribute("src", toRoot+"reference/lists.js");
|
||||
$("head").append($(lists));
|
||||
} );
|
||||
|
||||
window.onresize = resizeAll;
|
||||
|
||||
function mobileSetup() {
|
||||
|
@ -214,6 +205,19 @@ function resizeAll() {
|
|||
}
|
||||
}
|
||||
|
||||
function getBaseUri(uri) {
|
||||
intlUrl = uri.substring(0,6) == "/intl/";
|
||||
if (intlUrl) {
|
||||
base = uri.substring(uri.indexOf('intl/')+5,uri.length);
|
||||
base = base.substring(base.indexOf('/')+1, base.length);
|
||||
//alert("intl, returning base url: /" + base);
|
||||
return ("/" + base);
|
||||
} else {
|
||||
//alert("not intl, returning uri as found.");
|
||||
return uri;
|
||||
}
|
||||
}
|
||||
|
||||
function loadLast(cookiePath) {
|
||||
var location = window.location.href;
|
||||
if (location.indexOf("/"+cookiePath+"/") != -1) {
|
||||
|
@ -228,7 +232,7 @@ function loadLast(cookiePath) {
|
|||
}
|
||||
|
||||
$(window).unload(function(){
|
||||
var path = location.pathname;
|
||||
var path = getBaseUri(location.pathname);
|
||||
if (path.indexOf("/reference/") != -1) {
|
||||
writeCookie("lastpage", path, "reference", null);
|
||||
} else if (path.indexOf("/guide/") != -1) {
|
||||
|
@ -236,8 +240,6 @@ $(window).unload(function(){
|
|||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
function toggle(obj, slide) {
|
||||
var ul = $("ul", obj);
|
||||
var li = ul.parent();
|
||||
|
@ -258,8 +260,6 @@ function toggle(obj, slide) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function buildToggleLists() {
|
||||
$(".toggle-list").each(
|
||||
function(i) {
|
||||
|
@ -291,11 +291,11 @@ function swapNav() {
|
|||
nav_pref = NAV_PREF_PANELS;
|
||||
} else {
|
||||
nav_pref = NAV_PREF_TREE;
|
||||
init_default_navtree(toRoot);
|
||||
init_navtree("nav-tree", toRoot, NAVTREE_DATA);
|
||||
}
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime()+(10*365*24*60*60*1000)); // keep this for 10 years
|
||||
writeCookie("nav", nav_pref, null, date.toGMTString());
|
||||
writeCookie("nav", nav_pref, "reference", date.toGMTString());
|
||||
|
||||
$("#nav-panels").toggle();
|
||||
$("#panel-link").toggle();
|
||||
|
@ -396,12 +396,16 @@ function changeDocLang(lang) {
|
|||
changeNavLang(lang);
|
||||
}
|
||||
|
||||
function changeLangPref(lang) {
|
||||
function changeLangPref(lang, refresh) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime()+(50*365*24*60*60*1000)); // keep this for 50 years
|
||||
writeCookie("pref_lang", lang, null, date);
|
||||
|
||||
changeDocLang(lang);
|
||||
expires = date.toGMTString(date.setTime(date.getTime()+(10*365*24*60*60*1000))); // keep this for 50 years
|
||||
//alert("expires: " + expires)
|
||||
writeCookie("pref_lang", lang, null, expires);
|
||||
//changeDocLang(lang);
|
||||
if (refresh) {
|
||||
l = getBaseUri(location.pathname);
|
||||
window.location = l;
|
||||
}
|
||||
}
|
||||
|
||||
function loadLangPref() {
|
||||
|
@ -414,4 +418,3 @@ function loadLangPref() {
|
|||
function getLangPref() {
|
||||
return $("#language").find(":selected").attr("value");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue