am 235f4d4f
: refactor the logic for changing languages in global strings. instead of using separate <span> elements for each language, provide a unique attribute in each <a> element for each localized version of that link\'s title.
* commit '235f4d4f8580a56d553e19c1beab1f8c22132e84': refactor the logic for changing languages in global strings. instead of using separate <span> elements for each language, provide a unique attribute in each <a> element for each localized version of that link's title.
This commit is contained in:
commit
b649b41604
4 changed files with 162 additions and 247 deletions
|
@ -979,36 +979,18 @@ function requestAppendHL(uri) {
|
|||
}
|
||||
|
||||
|
||||
function changeTabLang(lang) {
|
||||
var nodes = $("#header,#nav-x,.training-nav-top").find("."+lang);
|
||||
for (i=0; i < nodes.length; i++) { // for each node in this language
|
||||
var node = $(nodes[i]);
|
||||
node.siblings().css("display","none"); // hide all siblings
|
||||
if (node.not(":empty").length != 0) { //if this languages node has a translation, show it
|
||||
node.css("display","inline");
|
||||
} else { //otherwise, show English instead
|
||||
node.css("display","none");
|
||||
node.siblings().filter(".en").css("display","inline");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeNavLang(lang) {
|
||||
var nodes = $("#devdoc-nav").find("."+lang);
|
||||
for (i=0; i < nodes.length; i++) { // for each node in this language
|
||||
var node = $(nodes[i]);
|
||||
node.siblings().css("display","none"); // hide all siblings
|
||||
if (node.not(":empty").length != 0) { // if this languages node has a translation, show it
|
||||
node.css("display","inline");
|
||||
} else { // otherwise, show English instead
|
||||
node.css("display","none");
|
||||
node.siblings().filter(".en").css("display","inline");
|
||||
var $links = $("#devdoc-nav,#header,#nav-x,.training-nav-top,.content-footer").find("a["+lang+"-lang]");
|
||||
$links.each(function(i){ // for each link with a translation
|
||||
var $link = $(this);
|
||||
if (lang != "en") { // No need to worry about English, because a language change invokes new request
|
||||
// put the desired language from the attribute as the text
|
||||
$link.text($link.attr(lang+"-lang"))
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function changeDocLang(lang) {
|
||||
changeTabLang(lang);
|
||||
changeNavLang(lang);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,36 +12,34 @@
|
|||
</div>
|
||||
</div>
|
||||
<ul class="nav-x col-9">
|
||||
<li class="design"><a href="<?cs var:toroot ?>design/index.html" <?cs
|
||||
if:design ?>class="selected"<?cs /if ?> >
|
||||
<span class="en">Design</span>
|
||||
<span class="zh-TW" style="display:none">設計</span>
|
||||
<span class="zh-CN" style="display:none">设计</span>
|
||||
<span class="ru" style="display:none">Проектирование</span>
|
||||
<span class="ko" style="display:none">디자인</span>
|
||||
<span class="ja" style="display:none">設計</span>
|
||||
<span class="es" style="display:none">Diseñar</span>
|
||||
</a></li>
|
||||
<li class="design">
|
||||
<a href="<?cs var:toroot ?>design/index.html" <?cs
|
||||
if:design ?>class="selected"<?cs /if ?>
|
||||
zh-TW-lang="設計"
|
||||
zh-CN-lang="设计"
|
||||
ru-lang="Проектирование"
|
||||
ko-lang="디자인"
|
||||
ja-lang="設計"
|
||||
es-lang="Diseñar"
|
||||
>Design</a></li>
|
||||
<li class="develop"><a href="<?cs var:toroot ?>develop/index.html" <?cs
|
||||
if:training || guide || reference || tools || develop ?>class="selected"<?cs /if ?> >
|
||||
<span class="en">Develop</span>
|
||||
<span class="zh-TW" style="display:none">開發</span>
|
||||
<span class="zh-CN" style="display:none">开发</span>
|
||||
<span class="ru" style="display:none">Разработка</span>
|
||||
<span class="ko" style="display:none">개발</span>
|
||||
<span class="ja" style="display:none">開発</span>
|
||||
<span class="es" style="display:none">Desarrollar</span>
|
||||
</a></li>
|
||||
if:training || guide || reference || tools || develop ?>class="selected"<?cs /if ?>
|
||||
zh-TW-lang="開發"
|
||||
zh-CN-lang="开发"
|
||||
ru-lang="Разработка"
|
||||
ko-lang="개발"
|
||||
ja-lang="開発"
|
||||
es-lang="Desarrollar"
|
||||
>Develop</a></li>
|
||||
<li class="distribute last"><a href="<?cs var:toroot ?>distribute/index.html" <?cs
|
||||
if:distribute ?>class="selected"<?cs /if ?> >
|
||||
<span class="en">Distribute</span>
|
||||
<span class="zh-TW" style="display:none">發佈</span>
|
||||
<span class="zh-CN" style="display:none">分发</span>
|
||||
<span class="ru" style="display:none">Распространение</span>
|
||||
<span class="ko" style="display:none">배포</span>
|
||||
<span class="ja" style="display:none">配布</span>
|
||||
<span class="es" style="display:none">Distribuir</span>
|
||||
</a></li>
|
||||
if:distribute ?>class="selected"<?cs /if ?>
|
||||
zh-TW-lang="發佈"
|
||||
zh-CN-lang="分发"
|
||||
ru-lang="Распространение"
|
||||
ko-lang="배포"
|
||||
ja-lang="配布"
|
||||
es-lang="Distribuir"
|
||||
>Distribute</a></li>
|
||||
</ul>
|
||||
|
||||
<!-- New Search -->
|
||||
|
@ -129,42 +127,38 @@ onkeyup="return search_changed(event, false, '<?cs var:toroot ?>')" />
|
|||
</li>
|
||||
<li class="develop">
|
||||
<ul>
|
||||
<li><a href="<?cs var:toroot ?>training/index.html">
|
||||
<span class="en">Training</span>
|
||||
<span class="zh-TW" style="display:none">訓練課程</span>
|
||||
<span class="zh-CN" style="display:none">培训</span>
|
||||
<span class="ru" style="display:none">Курсы</span>
|
||||
<span class="ko" style="display:none">교육</span>
|
||||
<span class="ja" style="display:none">トレーニング</span>
|
||||
<span class="es" style="display:none">Capacitación</span>
|
||||
</a></li>
|
||||
<li><a href="<?cs var:toroot ?>guide/components/index.html">
|
||||
<span class="en">API Guides</span>
|
||||
<span class="zh-TW" style="display:none">API 指南</span>
|
||||
<span class="zh-CN" style="display:none">API 指南</span>
|
||||
<span class="ru" style="display:none">Руководства по API</span>
|
||||
<span class="ko" style="display:none">API 가이드</span>
|
||||
<span class="ja" style="display:none">API ガイド</span>
|
||||
<span class="es" style="display:none">Guías de la API</span>
|
||||
</a></li>
|
||||
<li><a href="<?cs var:toroot ?>reference/packages.html">
|
||||
<span class="en">Reference</span>
|
||||
<span class="zh-TW" style="display:none">參考資源</span>
|
||||
<span class="zh-CN" style="display:none">参考</span>
|
||||
<span class="ru" style="display:none">Справочник</span>
|
||||
<span class="ko" style="display:none">참조문서</span>
|
||||
<span class="ja" style="display:none">リファレンス</span>
|
||||
<span class="es" style="display:none">Referencia</span>
|
||||
</a></li>
|
||||
<li><a href="<?cs var:toroot ?>tools/index.html">
|
||||
<span class="en">Tools</span>
|
||||
<span class="zh-TW" style="display:none">相關工具</span>
|
||||
<span class="zh-CN" style="display:none">工具</span>
|
||||
<span class="ru" style="display:none">Инструменты</span>
|
||||
<span class="ko" style="display:none">도구</span>
|
||||
<span class="ja" style="display:none">ツール</span>
|
||||
<span class="es" style="display:none">Herramientas</span>
|
||||
</a>
|
||||
<li><a href="<?cs var:toroot ?>training/index.html"
|
||||
zh-TW-lang="訓練課程"
|
||||
zh-CN-lang="培训"
|
||||
ru-lang="Курсы"
|
||||
ko-lang="교육"
|
||||
ja-lang="トレーニング"
|
||||
es-lang="Capacitación"
|
||||
>Training</a></li>
|
||||
<li><a href="<?cs var:toroot ?>guide/components/index.html"
|
||||
zh-TW-lang="API 指南"
|
||||
zh-CN-lang="API 指南"
|
||||
ru-lang="Руководства по API"
|
||||
ko-lang="API 가이드"
|
||||
ja-lang="API ガイド"
|
||||
es-lang="Guías de la API"
|
||||
>API Guides</a></li>
|
||||
<li><a href="<?cs var:toroot ?>reference/packages.html"
|
||||
zh-TW-lang="參考資源"
|
||||
zh-CN-lang="参考"
|
||||
ru-lang="Справочник"
|
||||
ko-lang="참조문서"
|
||||
ja-lang="リファレンス"
|
||||
es-lang="Referencia"
|
||||
>Reference</a></li>
|
||||
<li><a href="<?cs var:toroot ?>tools/index.html"
|
||||
zh-TW-lang="相關工具"
|
||||
zh-CN-lang="工具"
|
||||
ru-lang="Инструменты"
|
||||
ko-lang="도구"
|
||||
ja-lang="ツール"
|
||||
es-lang="Herramientas"
|
||||
>Tools</a>
|
||||
<ul><li><a href="<?cs var:toroot ?>sdk/index.html">Get the
|
||||
SDK</a></li></ul>
|
||||
</li>
|
||||
|
@ -201,47 +195,42 @@ Distribution</a></li>
|
|||
<div class="wrap">
|
||||
<ul class="nav-x col-9 develop" style="width:75%">
|
||||
<li><a href="<?cs var:toroot ?>training/index.html" <?cs
|
||||
if:training ?>class="selected"<?cs /if ?> >
|
||||
<span class="en">Training</span>
|
||||
<span class="zh-TW" style="display:none">訓練課程</span>
|
||||
<span class="zh-CN" style="display:none">培训</span>
|
||||
<span class="ru" style="display:none">Курсы</span>
|
||||
<span class="ko" style="display:none">교육</span>
|
||||
<span class="ja" style="display:none">トレーニング</span>
|
||||
<span class="es" style="display:none">Capacitación</span>
|
||||
</a></li>
|
||||
<li><a href="<?cs var:toroot ?>guide/components/index.html" <?cs
|
||||
if:guide ?>class="selected"<?cs /if ?> >
|
||||
<span class="en">API Guides</span>
|
||||
<span class="zh-TW" style="display:none">API 指南</span>
|
||||
<span class="zh-CN" style="display:none">API 指南</span>
|
||||
<span class="ru" style="display:none">Руководства по API</span>
|
||||
<span class="ko" style="display:none">API 가이드</span>
|
||||
<span class="ja" style="display:none">API ガイド</span>
|
||||
<span class="es" style="display:none">Guías de la API</span>
|
||||
</a></li>
|
||||
if:training ?>class="selected"<?cs /if ?>
|
||||
zh-TW-lang="訓練課程"
|
||||
zh-CN-lang="培训"
|
||||
ru-lang="Курсы"
|
||||
ko-lang="교육"
|
||||
ja-lang="トレーニング"
|
||||
es-lang="Capacitación"
|
||||
>Training</a></li>
|
||||
<li><a href="<?cs var:toroot ?>guide/components/index.html" <?cs
|
||||
if:guide ?>class="selected"<?cs /if ?>
|
||||
zh-TW-lang="API 指南"
|
||||
zh-CN-lang="API 指南"
|
||||
ru-lang="Руководства по API"
|
||||
ko-lang="API 가이드"
|
||||
ja-lang="API ガイド"
|
||||
es-lang="Guías de la API"
|
||||
>API Guides</a></li>
|
||||
<li><a href="<?cs var:toroot ?>reference/packages.html" <?cs
|
||||
if:reference ?>class="selected"<?cs /if ?> >
|
||||
<span class="en">Reference</span>
|
||||
<span class="zh-TW" style="display:none">參考資源</span>
|
||||
<span class="zh-CN" style="display:none">参考</span>
|
||||
<span class="ru" style="display:none">Справочник</span>
|
||||
<span class="ko" style="display:none">참조문서</span>
|
||||
<span class="ja" style="display:none">リファレンス</span>
|
||||
<span class="es" style="display:none">Referencia</span>
|
||||
</a></li>
|
||||
if:reference ?>class="selected"<?cs /if ?>
|
||||
zh-TW-lang="參考資源"
|
||||
zh-CN-lang="参考"
|
||||
ru-lang="Справочник"
|
||||
ko-lang="참조문서"
|
||||
ja-lang="リファレンス"
|
||||
es-lang="Referencia"
|
||||
>Reference</a></li>
|
||||
<li><a href="<?cs var:toroot ?>tools/index.html" <?cs
|
||||
if:tools ?>class="selected"<?cs /if ?> >
|
||||
<span class="en">Tools</span>
|
||||
<span class="zh-TW" style="display:none">相關工具</span>
|
||||
<span class="zh-CN" style="display:none">工具</span>
|
||||
<span class="ru" style="display:none">Инструменты</span>
|
||||
<span class="ko" style="display:none">도구</span>
|
||||
<span class="ja" style="display:none">ツール</span>
|
||||
<span class="es" style="display:none">Herramientas</span>
|
||||
</a></li>
|
||||
if:tools ?>class="selected"<?cs /if ?>
|
||||
zh-TW-lang="相關工具"
|
||||
zh-CN-lang="工具"
|
||||
ru-lang="Инструменты"
|
||||
ko-lang="도구"
|
||||
ja-lang="ツール"
|
||||
es-lang="Herramientas"
|
||||
>Tools</a></li>
|
||||
</ul>
|
||||
<!-- <a class="button-secondary download-sdk">Download the SDK</a> -->
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -27,63 +27,57 @@
|
|||
</div>
|
||||
<?cs if:training ?>
|
||||
<div class="training-nav-top layout-content-col span-5" itemscope itemtype="http://schema.org/SiteNavigationElement">
|
||||
<a href="#" class="prev-page-link hide">
|
||||
<span class="en">Previous</span>
|
||||
<span class="zh-TW" style="display:none">上一堂課</span>
|
||||
<span class="zh-CN" style="display:none">上一课</span>
|
||||
<span class="ru" style="display:none;font-size:85%">Предыдущий</span>
|
||||
<span class="ko" style="display:none">이전</span>
|
||||
<span class="ja" style="display:none">前へ</span>
|
||||
<span class="es" style="display:none">Anterior</span>
|
||||
</a>
|
||||
<a href="#" class="next-page-link hide">
|
||||
<span class="en">Next</span>
|
||||
<span class="zh-TW" style="display:none">下一堂課</span>
|
||||
<span class="zh-CN" style="display:none">下一课</span>
|
||||
<span class="ru" style="display:none;font-size:85%">Следующий</span>
|
||||
<span class="ko" style="display:none">다음</span>
|
||||
<span class="ja" style="display:none">次へ</span>
|
||||
<span class="es" style="display:none">Siguiente</span>
|
||||
</a>
|
||||
<a href="#" class="start-class-link hide">
|
||||
<span class="en">Get started</span>
|
||||
<span class="zh-TW" style="display:none">開始上課</span>
|
||||
<span class="zh-CN" style="display:none">开始</span>
|
||||
<span class="ru" style="display:none">Начало работы</span>
|
||||
<span class="ko" style="display:none">시작하기</span>
|
||||
<span class="ja" style="display:none">開始する</span>
|
||||
<span class="es" style="display:none">Empezar</span>
|
||||
</a>
|
||||
<a href="#" class="start-course-link hide">
|
||||
<span class="en">First class</span>
|
||||
<span class="zh-TW" style="display:none">第一堂課</span>
|
||||
<span class="zh-CN" style="display:none">第一课</span>
|
||||
<span class="ru" style="display:none">Первый урок</span>
|
||||
<span class="ko" style="display:none">첫 번째 강의</span>
|
||||
<span class="ja" style="display:none">最初のクラス</span>
|
||||
<span class="es" style="display:none">Primera clase</span>
|
||||
</a>
|
||||
<a href="#" class="prev-page-link hide"
|
||||
zh-TW-lang="上一堂課"
|
||||
zh-CN-lang="上一课"
|
||||
ru-lang="Предыдущий"
|
||||
ko-lang="이전"
|
||||
ja-lang="前へ"
|
||||
es-lang="Anterior"
|
||||
>Previous</a>
|
||||
<a href="#" class="next-page-link hide"
|
||||
zh-TW-lang="下一堂課"
|
||||
zh-CN-lang="下一课"
|
||||
ru-lang="Следующий"
|
||||
ko-lang="다음"
|
||||
ja-lang="次へ"
|
||||
es-lang="Siguiente"
|
||||
>Next</a>
|
||||
<a href="#" class="start-class-link hide"
|
||||
zh-TW-lang="開始上課"
|
||||
zh-CN-lang="开始"
|
||||
ru-lang="Начало работы"
|
||||
ko-lang="시작하기"
|
||||
ja-lang="開始する"
|
||||
es-lang="Empezar"
|
||||
>Get started</a>
|
||||
<a href="#" class="start-course-link hide"
|
||||
zh-TW-lang="第一堂課"
|
||||
zh-CN-lang="第一课"
|
||||
ru-lang="Первый урок"
|
||||
ko-lang="첫 번째 강의"
|
||||
ja-lang="最初のクラス"
|
||||
es-lang="Primera clase"
|
||||
>First class</a>
|
||||
</div>
|
||||
<?cs else ?>
|
||||
<div class="paging-links layout-content-col span-4" itemscope itemtype="http://schema.org/SiteNavigationElement">
|
||||
<a href="#" class="prev-page-link hide">
|
||||
<span class="en">Previous</span>
|
||||
<span class="zh-TW" style="display:none">上一堂課</span>
|
||||
<span class="zh-CN" style="display:none">上一课</span>
|
||||
<span class="ru" style="display:none;font-size:85%">Предыдущий</span>
|
||||
<span class="ko" style="display:none">이전</span>
|
||||
<span class="ja" style="display:none">前へ</span>
|
||||
<span class="es" style="display:none">Anterior</span>
|
||||
</a>
|
||||
<a href="#" class="next-page-link hide">
|
||||
<span class="en">Next</span>
|
||||
<span class="zh-TW" style="display:none">下一堂課</span>
|
||||
<span class="zh-CN" style="display:none">下一课</span>
|
||||
<span class="ru" style="display:none;font-size:85%">Следующий</span>
|
||||
<span class="ko" style="display:none">다음</span>
|
||||
<span class="ja" style="display:none">次へ</span>
|
||||
<span class="es" style="display:none">Siguiente</span>
|
||||
</a>
|
||||
<a href="#" class="prev-page-link hide"
|
||||
zh-TW-lang="上一堂課"
|
||||
zh-CN-lang="上一课"
|
||||
ru-lang="Предыдущий"
|
||||
ko-lang="이전"
|
||||
ja-lang="前へ"
|
||||
es-lang="Anterior"
|
||||
>Previous</a>
|
||||
<a href="#" class="next-page-link hide"
|
||||
zh-TW-lang="下一堂課"
|
||||
zh-CN-lang="下一课"
|
||||
ru-lang="Следующий"
|
||||
ko-lang="다음"
|
||||
ja-lang="次へ"
|
||||
es-lang="Siguiente"
|
||||
>Next</a>
|
||||
</div>
|
||||
<?cs /if ?><?cs # end if training ?>
|
||||
</div>
|
||||
|
@ -135,24 +129,22 @@
|
|||
<?cs if:!fullscreen ?>
|
||||
<div class="paging-links layout-content-col col-4">
|
||||
<?cs if:(design||training||guide||walkthru) && !page.landing && !footer.hide ?>
|
||||
<a href="#" class="prev-page-link hide">
|
||||
<span class="en">Previous</span>
|
||||
<span class="zh-TW" style="display:none">上一堂課</span>
|
||||
<span class="zh-CN" style="display:none">上一课</span>
|
||||
<span class="ru" style="display:none;font-size:85%">Предыдущий</span>
|
||||
<span class="ko" style="display:none">이전</span>
|
||||
<span class="ja" style="display:none">前へ</span>
|
||||
<span class="es" style="display:none">Anterior</span>
|
||||
</a>
|
||||
<a href="#" class="next-page-link hide">
|
||||
<span class="en">Next</span>
|
||||
<span class="zh-TW" style="display:none">下一堂課</span>
|
||||
<span class="zh-CN" style="display:none">下一课</span>
|
||||
<span class="ru" style="display:none;font-size:85%">Следующий</span>
|
||||
<span class="ko" style="display:none">다음</span>
|
||||
<span class="ja" style="display:none">次へ</span>
|
||||
<span class="es" style="display:none">Siguiente</span>
|
||||
</a>
|
||||
<a href="#" class="prev-page-link hide"
|
||||
zh-TW-lang="上一堂課"
|
||||
zh-CN-lang="上一课"
|
||||
ru-lang="Предыдущий"
|
||||
ko-lang="이전"
|
||||
ja-lang="前へ"
|
||||
es-lang="Anterior"
|
||||
>Previous</a>
|
||||
<a href="#" class="next-page-link hide"
|
||||
zh-TW-lang="下一堂課"
|
||||
zh-CN-lang="下一课"
|
||||
ru-lang="Следующий"
|
||||
ko-lang="다음"
|
||||
ja-lang="次へ"
|
||||
es-lang="Siguiente"
|
||||
>Next</a>
|
||||
<?cs /if ?>
|
||||
</div>
|
||||
<?cs /if ?>
|
||||
|
|
|
@ -1,50 +1,2 @@
|
|||
|
||||
<!-- CURRENTLY NOT USED... ALL TABS ARE IN masthead.cs -->
|
||||
|
||||
<ul id="header-tabs" class="<?cs
|
||||
if:reference ?>reference<?cs
|
||||
elif:guide ?>guide<?cs
|
||||
elif:sdk ?>sdk<?cs
|
||||
elif:home ?>home<?cs
|
||||
elif:resources ?>resources<?cs
|
||||
elif:training ?>training<?cs
|
||||
elif:tools ?>tools<?cs
|
||||
elif:videos ?>videos<?cs /if ?>">
|
||||
|
||||
<li id="sdk-link"><a href="<?cs var:toroot ?>design/index.html">
|
||||
<span class="en">Design</span>
|
||||
</a></li>
|
||||
<li id="sdk-link"><a href="<?cs var:toroot ?>develop/index.html">
|
||||
<span class="en">Develop</span>
|
||||
</a></li>
|
||||
<li id="sdk-link"><a href="<?cs var:toroot ?>distribute/index.html">
|
||||
<span class="en">Distribute</span>
|
||||
</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<li id="guide-link"><a href="<?cs var:toroot ?>guide/index.html" onClick="return loadLast('guide')">
|
||||
<?cs if:!sdk.redirect ?>
|
||||
<span class="en">Guide</span>
|
||||
<span style="display:none" class="de">Handbuch</span>
|
||||
<span style="display:none" class="es">Guía</span>
|
||||
<span style="display:none" class="fr">Guide</span>
|
||||
<span style="display:none" class="it">Guida</span>
|
||||
<span style="display:none" class="ja">開発ガイド</span>
|
||||
<span style="display:none" class="zh-CN">开发人员指南</span>
|
||||
<span style="display:none" class="zh-TW">開發指南</span>
|
||||
<?cs /if ?>
|
||||
</a></li>
|
||||
-->
|
||||
|
||||
|
||||
|
||||
|
||||
</ul>
|
||||
|
|
Loading…
Reference in a new issue