diff options
author | Scott Main <smain@google.com> | 2014-05-23 00:38:23 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-05-23 00:38:23 +0000 |
commit | e280837053708f85520574c3ccb36be3e367a255 (patch) | |
tree | ec708af80e455f1893acdc8a115f1fa205961174 /tools | |
parent | 0250f80ef0708e9ba71a77cffb29afb2356a5d25 (diff) | |
parent | c0387cd0f156b9e657e72ca2e24d402e5e0fe57c (diff) | |
download | build-e280837053708f85520574c3ccb36be3e367a255.zip build-e280837053708f85520574c3ccb36be3e367a255.tar.gz build-e280837053708f85520574c3ccb36be3e367a255.tar.bz2 |
am c0387cd0: am e7d75351: when generating training course pages, use localized descriptions when available
* commit 'c0387cd0f156b9e657e72ca2e24d402e5e0fe57c':
when generating training course pages, use localized descriptions when available
Diffstat (limited to 'tools')
-rw-r--r-- | tools/droiddoc/templates-sdk/assets/js/docs.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js index 23f0660..66c72a8 100644 --- a/tools/droiddoc/templates-sdk/assets/js/docs.js +++ b/tools/droiddoc/templates-sdk/assets/js/docs.js @@ -347,7 +347,20 @@ false; // navigate across topic boundaries only in design docs // Set up the course landing pages for Training with class names and descriptions if ($('body.trainingcourse').length) { var $classLinks = $selListItem.find('ul li a').not('#nav .nav-section .nav-section ul a'); - var $classDescriptions = $classLinks.attr('description'); + + // create an array for all the class descriptions + var $classDescriptions = new Array($classLinks.length); + var lang = getLangPref(); + $classLinks.each(function(index) { + var langDescr = $(this).attr(lang + "-description"); + if (typeof langDescr !== 'undefined' && langDescr !== false) { + // if there's a class description in the selected language, use that + $classDescriptions[index] = langDescr; + } else { + // otherwise, use the default english description + $classDescriptions[index] = $(this).attr("description"); + } + }); var $olClasses = $('<ol class="class-list"></ol>'); var $liClass; @@ -359,7 +372,7 @@ false; // navigate across topic boundaries only in design docs $classLinks.each(function(index) { $liClass = $('<li></li>'); $h2Title = $('<a class="title" href="'+$(this).attr('href')+'"><h2>' + $(this).html()+'</h2><span></span></a>'); - $pSummary = $('<p class="description">' + $(this).attr('description') + '</p>'); + $pSummary = $('<p class="description">' + $classDescriptions[index] + '</p>'); $olLessons = $('<ol class="lesson-list"></ol>'); @@ -3538,7 +3551,6 @@ function showSamples() { while (i < resources.length) { var cardSize = cardSizes[j++ % cardSizes.length]; cardSize = cardSize.replace(/^\s+|\s+$/,''); - // console.log("cardsize is " + cardSize); // Some card sizes do not get a plusone button, such as where space is constrained // or for cards commonly embedded in docs (to improve overall page speed). plusone = !((cardSize == "6x2") || (cardSize == "6x3") || |