diff options
author | Dirk Dougherty <nobody@android.com> | 2009-07-15 16:41:48 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-07-15 16:41:48 -0700 |
commit | efdcda4f90214a92ac8b78de93a09f384e52a625 (patch) | |
tree | 4b06fed6d0b4b85e7f2a4b4e9b1f3b3194d65477 /tools | |
parent | d8cfce0ddf954340d5f5587f72509ca685b5bc1a (diff) | |
download | build-efdcda4f90214a92ac8b78de93a09f384e52a625.zip build-efdcda4f90214a92ac8b78de93a09f384e52a625.tar.gz build-efdcda4f90214a92ac8b78de93a09f384e52a625.tar.bz2 |
AI 150537: Add support for language-specific tabs in android developer's blog. Pass the current language pref as an hl=lang url query.
BUG=1910893
Automated import of CL 150537
Diffstat (limited to 'tools')
-rw-r--r-- | tools/droiddoc/templates-sdk/header_tabs.cs | 23 | ||||
-rw-r--r-- | tools/droiddoc/templates/assets/android-developer-docs.js | 21 |
2 files changed, 40 insertions, 4 deletions
diff --git a/tools/droiddoc/templates-sdk/header_tabs.cs b/tools/droiddoc/templates-sdk/header_tabs.cs index 7fd8486..02fc8bf 100644 --- a/tools/droiddoc/templates-sdk/header_tabs.cs +++ b/tools/droiddoc/templates-sdk/header_tabs.cs @@ -7,16 +7,22 @@ elif:videos ?>videos<?cs /if ?>"> <li id="home-link"><a href="<?cs var:toroot ?><?cs if:android.whichdoc != "online" ?>offline.html<?cs else ?>index.html<?cs /if ?>"> + <?cs if:!sdk.redirect ?> <span class="en">Home</span> <span class="de">Startseite</span> + <span class="es"></span> + <span class="fr"></span> + <span class="it"></span> <span class="ja">ホーム</span> <span class="zh-CN">主页</span> <span class="zh-TW">首頁</span> + <?cs /if ?> </a></li> <li id="sdk-link"><a href="<?cs var:toroot ?>sdk/<?cs var:sdk.current ?>/index.html"> <span class="en">SDK</span> </a></li> <li id="guide-link"><a href="<?cs var:toroot ?>guide/index.html" onClick="return loadLast('guide')"> + <?cs if:!sdk.redirect ?> <span class="en">Dev Guide</span> <span class="de">Handbuch</span> <span class="es">Guía</span> @@ -25,8 +31,10 @@ <span class="ja">開発ガイド</span> <span class="zh-CN">开发人员指南</span> <span class="zh-TW">開發指南</span> + <?cs /if ?> </a></li> <li id="reference-link"><a href="<?cs var:toroot ?>reference/packages.html" onClick="return loadLast('reference')"> + <?cs if:!sdk.redirect ?> <span class="en">Reference</span> <span class="de">Referenz</span> <span class="es">Referencia</span> @@ -35,24 +43,35 @@ <span class="ja">リファレンス</span> <span class="zh-CN">参考</span> <span class="zh-TW">參考資料</span> + <?cs /if ?> </a></li> - <li><a href="http://android-developers.blogspot.com"> + <li><a href="http://android-developers.blogspot.com" onClick="return requestAppendHL(this.href)"> + <?cs if:!sdk.redirect ?> <span class="en">Blog</span> + <span class="de"></span> + <span class="es"></span> + <span class="fr"></span> + <span class="it"></span> <span class="ja">ブログ</span> <span class="zh-CN">博客</span> <span class="zh-TW">網誌</span> + <?cs /if ?> </a></li> <li id="videos-link"><a href="<?cs var:toroot ?>videos/index.html" onClick="return loadLast('videos')"> <span class="en">Videos</span> <span class="ja">ビデオ</span> </a></li> <li id="community-link"><a href="<?cs var:toroot ?>community/index.html"> + <?cs if:!sdk.redirect ?> <span class="en">Community</span> + <span class="de"></span> <span class="es">Comunidad</span> <span class="fr">Communauté</span> + <span class="it"></span> <span class="ja">コミュニティ</span> <span class="zh-CN">社区</span> <span class="zh-TW">社群</span> + <?cs /if ?> </a></li> -</ul>
\ No newline at end of file +</ul> diff --git a/tools/droiddoc/templates/assets/android-developer-docs.js b/tools/droiddoc/templates/assets/android-developer-docs.js index 654e9a8..af1b700 100644 --- a/tools/droiddoc/templates/assets/android-developer-docs.js +++ b/tools/droiddoc/templates/assets/android-developer-docs.js @@ -208,7 +208,7 @@ function resizeAll() { } function getBaseUri(uri) { - intlUrl = uri.substring(0,6) == "/intl/"; + var 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); @@ -220,6 +220,19 @@ function getBaseUri(uri) { } } +function requestAppendHL(uri) { +//append "?hl=<lang> to an outgoing request (such as to blog) + var lang = getLangPref(); + if (lang) { + var q = 'hl=' + lang; + uri += '?' + q; + window.location = uri; + return false; + } else { + return true; + } +} + function loadLast(cookiePath) { var location = window.location.href; if (location.indexOf("/"+cookiePath+"/") != -1) { @@ -418,5 +431,9 @@ function loadLangPref() { } function getLangPref() { - return $("#language").find(":selected").attr("value"); + var lang = $("#language").find(":selected").attr("value"); + if (!lang) { + lang = readCookie("pref_lang"); + } + return (lang != 0) ? lang : 'en'; } |