diff --git a/public/_includes/_scripts-include.jade b/public/_includes/_scripts-include.jade index 7170fb57de..5dd3407ed7 100644 --- a/public/_includes/_scripts-include.jade +++ b/public/_includes/_scripts-include.jade @@ -15,6 +15,7 @@ script(src="/resources/js/vendor/angular-material.min.js") +script(src="/resources/js/translate.js") script(src="/resources/js/site.js") script(src="/resources/js/controllers/app-controller.js") script(src="/resources/js/directives/cheatsheet.js") diff --git a/public/about/index.jade b/public/about/index.jade index 14f24c232f..d49f225fbd 100644 --- a/public/about/index.jade +++ b/public/about/index.jade @@ -8,6 +8,7 @@ making web development feel effortless. We believe that writing beautiful apps should be joyful and fun. We're building a platform for the future. + p.text-body. Angular由一个工程师组织打造,我们拥有共同的热情 —— 让Web开发变得更简单。我们深信,写漂亮的程序快乐而有趣。 我们正在构建一个面向未来的平台。 diff --git a/public/docs/ts/latest/quickstart.jade b/public/docs/ts/latest/quickstart.jade index 23b67b46fd..f5a8432d3c 100644 --- a/public/docs/ts/latest/quickstart.jade +++ b/public/docs/ts/latest/quickstart.jade @@ -53,9 +53,9 @@ figure.image-display 在此日程中,我们将会看到很多代码块。它们都很容易拷贝和粘贴: code-example(format='.', language='html'). - Click the glyph on the right to copy code snippets to the clipboard ⇨⇨⇨⇨⇨⇨⇨⇨⇨⇨ - - 点击右边的图标来把代码片段拷贝到剪贴板 ⇨⇨⇨⇨⇨⇨⇨⇨⇨⇨ + Click the glyph on the right to copy code snippets to the clipboard ==========> + + 点击右边的图标来把代码片段拷贝到剪贴板 ==========> button(class="verbose off md-primary md-button md-ink-ripple", type="button", onclick="verbose(false)"). Hide explanations @@ -82,6 +82,7 @@ a(id="devenv") ## 开发环境 We need to set up our development environment: + 我们要设置开发环境: * install node and npm * 安装 node 和 npm @@ -804,23 +805,23 @@ figure.image-display quickstart/ts/typings/typings.d.1.ts +makeTabs(` - quickstart/ts/app/app.component.ts, - quickstart/ts/app/main.ts, - quickstart/ts/index.html, - quickstart/ts/package.1.json, - quickstart/ts/tsconfig.1.json, - quickstart/ts/typings.1.json, - quickstart/ts/styles.1.css, - quickstart/ts/system.config.1.js` - ,null, - `app/app.component.ts, - app/main.ts, - index.html, - package.json, - tsconfig.json, - typings.json, - styles.css, - system.config.js`) + quickstart/ts/app/app.component.ts, +quickstart / ts / app / main.ts, +quickstart / ts / index.html, +quickstart / ts / package.1.json, +quickstart / ts / tsconfig.1.json, +quickstart / ts / typings.1.json, +quickstart / ts / styles.1.css, +quickstart / ts / system.config.1.js` +,null, +`app/app.component.ts, +app / main.ts, +index.html, +package.json, +tsconfig.json, +typings.json, +styles.css, +system.config.js`) :marked .l-main-section diff --git a/public/index.jade b/public/index.jade index 44c1a3da9c..03e914c839 100644 --- a/public/index.jade +++ b/public/index.jade @@ -60,7 +60,7 @@ div(class="home-rows") div(class="promo-img-container promo-4") div img(src="resources/images/home/loved-by-millions.png") - + .cta-bar a(href="/docs/ts/latest/quickstart.html" class="button button-large button-shield md-raised " + "md-primary" md-button) 立即开始 diff --git a/public/resources/css/_translate.scss b/public/resources/css/_translate.scss new file mode 100644 index 0000000000..2724ccfa28 --- /dev/null +++ b/public/resources/css/_translate.scss @@ -0,0 +1,3 @@ +.hidden { + display: none !important; +} diff --git a/public/resources/css/main.scss b/public/resources/css/main.scss index 27b87b088d..ac1749935a 100644 --- a/public/resources/css/main.scss +++ b/public/resources/css/main.scss @@ -9,6 +9,7 @@ @import 'theme'; @import 'base/reset'; @import 'base/type'; +@import "translate"; @import 'angular'; diff --git a/public/resources/js/translate.js b/public/resources/js/translate.js new file mode 100644 index 0000000000..2d615da58c --- /dev/null +++ b/public/resources/js/translate.js @@ -0,0 +1,38 @@ +(function () { + var targets = document.querySelectorAll('p, li, h1, h2, h3, h4, h5, h6, header, a, button'); + _.each(targets, function (node) { + if (isTranslationResult(node)) { + var prevNode = node.previousElementSibling; + if (prevNode && !prevNode.classList.contains('nav-list-item')) { + prevNode.classList.add('hidden'); + } + node.title = prevNode.innerText; + } + }); + + function isOriginalEnglish(text) { + return /[\1-\255⇨]/.test(text); + } + + function isClonedNode(node1, node2) { + return node1.parentNode === node2.parentNode && node1.tagName === node2.tagName && node1.className === node2.className; + } + + function indexOf(node) { + var i = 0; + var aNode = node.parentNode.firstChild; + while (aNode !== node) { + ++i; + if (aNode.tagName !== node.tagName) { + i = 0; + } + aNode = aNode.nextElementSibling; + } + return i; + } + + function isTranslationResult(node) { + var prevNode = node.previousElementSibling; + return indexOf(node) % 2 === 1 && prevNode && isClonedNode(node, prevNode) && isOriginalEnglish(prevNode.innerText); + } +})();