Merge pull request #130 from todoubaba/translate

Fixes translate.js
This commit is contained in:
Rex 2016-11-24 18:08:00 +00:00 committed by GitHub
commit aaa052b13c
4 changed files with 51 additions and 20 deletions

View File

@ -1163,11 +1163,9 @@ a#lazy-load
* `HeroModule`和`CrisisModule`会被惰性加载。 * `HeroModule`和`CrisisModule`会被惰性加载。
<a id="app-component-template"></a> <a id="app-component-template"></a>
<a id="app-component-template"></a>
Let's start at the top with the new `AppComponent` template: a title, three links, and a `<router-outlet>`. Let's start at the top with the new `AppComponent` template: a title, three links, and a `<router-outlet>`.
<a id="app-component-template"></a>
我们从这个`AppComponent`新模板的顶部看起:标题、三个链接和`<router-outlet>`。 我们从这个`AppComponent`新模板的顶部看起:标题、三个链接和`<router-outlet>`。
+makeExample('ngmodule/ts/app/app.component.3.ts', 'template', 'app/app.component.ts (v3 - Template)')(format='.') +makeExample('ngmodule/ts/app/app.component.3.ts', 'template', 'app/app.component.ts (v3 - Template)')(format='.')

View File

@ -38,21 +38,27 @@
ul ul
li li
a(href="/docs/#{lang}/#{vers}/guide/ngmodule.html") Angular Modules a(href="/docs/#{lang}/#{vers}/guide/ngmodule.html") Angular Modules
li
a(href="/docs/#{lang}/#{vers}/guide/ngmodule.html") Angular模块 a(href="/docs/#{lang}/#{vers}/guide/ngmodule.html") Angular模块
li li
a(href="/docs/#{lang}/#{vers}/guide/animations.html") Animations a(href="/docs/#{lang}/#{vers}/guide/animations.html") Animations
li
a(href="/docs/#{lang}/#{vers}/guide/animations.html") 动画 a(href="/docs/#{lang}/#{vers}/guide/animations.html") 动画
li li
a(href="/docs/#{lang}/#{vers}/guide/attribute-directives.html") Attribute Directives a(href="/docs/#{lang}/#{vers}/guide/attribute-directives.html") Attribute Directives
li
a(href="/docs/#{lang}/#{vers}/guide/attribute-directives.html") 属性型指令 a(href="/docs/#{lang}/#{vers}/guide/attribute-directives.html") 属性型指令
li li
a(href="/docs/#{lang}/#{vers}/guide/browser-support.html") Browser Support a(href="/docs/#{lang}/#{vers}/guide/browser-support.html") Browser Support
li
a(href="/docs/#{lang}/#{vers}/guide/browser-support.html") 浏览器支持 a(href="/docs/#{lang}/#{vers}/guide/browser-support.html") 浏览器支持
li li
a(href="/docs/#{lang}/#{vers}/guide/component-styles.html") Component Styles a(href="/docs/#{lang}/#{vers}/guide/component-styles.html") Component Styles
li
a(href="/docs/#{lang}/#{vers}/guide/component-styles.html") 组件样式 a(href="/docs/#{lang}/#{vers}/guide/component-styles.html") 组件样式
li li
a(href="/docs/#{lang}/#{vers}/guide/ngmodule.html") View All... a(href="/docs/#{lang}/#{vers}/guide/ngmodule.html") View All...
li
a(href="/docs/#{lang}/#{vers}/guide/ngmodule.html") 查看全部…… a(href="/docs/#{lang}/#{vers}/guide/ngmodule.html") 查看全部……
.c4.secondary-content-list .c4.secondary-content-list
@ -61,21 +67,27 @@
ul ul
li li
a(href="/docs/#{lang}/#{vers}/cookbook/aot-compiler.html") Ahead-of-Time Compilation a(href="/docs/#{lang}/#{vers}/cookbook/aot-compiler.html") Ahead-of-Time Compilation
li
a(href="/docs/#{lang}/#{vers}/cookbook/aot-compiler.html") 预编译 a(href="/docs/#{lang}/#{vers}/cookbook/aot-compiler.html") 预编译
li li
a(href="/docs/#{lang}/#{vers}/cookbook/a1-a2-quick-reference.html") Angular 1 to Angular 2 a(href="/docs/#{lang}/#{vers}/cookbook/a1-a2-quick-reference.html") Angular 1 to Angular 2
li
a(href="/docs/#{lang}/#{vers}/cookbook/a1-a2-quick-reference.html") Angular 1迁移到Angular 2 a(href="/docs/#{lang}/#{vers}/cookbook/a1-a2-quick-reference.html") Angular 1迁移到Angular 2
li li
a(href="/docs/#{lang}/#{vers}/cookbook/ngmodule-faq.html") Angular Module FAQ a(href="/docs/#{lang}/#{vers}/cookbook/ngmodule-faq.html") Angular Module FAQ
li
a(href="/docs/#{lang}/#{vers}/cookbook/ngmodule-faq.html") Angular模块FAQ a(href="/docs/#{lang}/#{vers}/cookbook/ngmodule-faq.html") Angular模块FAQ
li li
a(href="/docs/#{lang}/#{vers}/cookbook/component-communication.html") Component Interaction a(href="/docs/#{lang}/#{vers}/cookbook/component-communication.html") Component Interaction
li
a(href="/docs/#{lang}/#{vers}/cookbook/component-communication.html") 组件交互 a(href="/docs/#{lang}/#{vers}/cookbook/component-communication.html") 组件交互
li li
a(href="/docs/#{lang}/#{vers}/cookbook/component-relative-paths.html") Component-Relative Paths a(href="/docs/#{lang}/#{vers}/cookbook/component-relative-paths.html") Component-Relative Paths
li
a(href="/docs/#{lang}/#{vers}/cookbook/component-relative-paths.html") 相对于组件的路径 a(href="/docs/#{lang}/#{vers}/cookbook/component-relative-paths.html") 相对于组件的路径
li li
a(href="/docs/#{lang}/#{vers}/cookbook/") View All... a(href="/docs/#{lang}/#{vers}/cookbook/") View All...
li
a(href="/docs/#{lang}/#{vers}/cookbook/") 查看全部... a(href="/docs/#{lang}/#{vers}/cookbook/") 查看全部...
.c4.secondary-content-list .c4.secondary-content-list
@ -84,10 +96,15 @@
ul ul
li li
a(target="_blank" href="https://github.com/angular/universal") Angular Universal a(target="_blank" href="https://github.com/angular/universal") Angular Universal
li
a(target="_blank" href="https://github.com/angular/universal") Angular Universal
li
a(target="_blank" href="https://augury.angular.io/") Augury
li li
a(target="_blank" href="https://augury.angular.io/") Augury a(target="_blank" href="https://augury.angular.io/") Augury
li li
a(target="_blank" href="https://github.com/jaxio/celerio-angular-quickstart") Celerio Angular Quickstart a(target="_blank" href="https://github.com/jaxio/celerio-angular-quickstart") Celerio Angular Quickstart
li
a(target="_blank" href="https://github.com/jaxio/celerio-angular-quickstart") Celerio Angular快速起步 a(target="_blank" href="https://github.com/jaxio/celerio-angular-quickstart") Celerio Angular快速起步
li li
a(target="_blank" href="https://github.com/mgechev/codelyzer") Codelyzer a(target="_blank" href="https://github.com/mgechev/codelyzer") Codelyzer
@ -95,4 +112,5 @@
a(target="_blank" href="https://github.com/johnpapa/lite-server") Lite-server a(target="_blank" href="https://github.com/johnpapa/lite-server") Lite-server
li li
a(target="_blank" href="/resources/") View All... a(target="_blank" href="/resources/") View All...
li
a(target="_blank" href="/resources/") 查看全部…… a(target="_blank" href="/resources/") 查看全部……

View File

@ -28,10 +28,26 @@
margin-top: -($unit * 3); margin-top: -($unit * 3);
} }
.card {
height: auto;
min-height: 194px;
h2.original-english {
margin-top: $unit;
padding-top: $unit;
}
p.original-english {
margin-top: 0;
}
}
li { li {
p { p {
margin: 0; margin: 0;
} }
ul {
margin: 0;
}
} }
} }

View File

@ -22,6 +22,7 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
* @param container * @param container
*/ */
function processContainer(container) { function processContainer(container) {
var count = 0;
for (var i = 0; i < container.children.length; i++) { for (var i = 0; i < container.children.length; i++) {
var node = container.children[i]; var node = container.children[i];
@ -40,35 +41,30 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
case 'H5': case 'H5':
case 'H6': case 'H6':
case 'HEADER': case 'HEADER':
count++;
if (processBlock(node)) { if (processBlock(node)) {
i++; i++;
} count++;
break;
case 'LI':
if($(node).find('p').length <= 1){
if (processBlock(node)) {
i++;
}
} }
break; break;
case 'TD': case 'TD':
case 'TH': case 'TH':
case 'UL':
case 'OL':
processContainer(node); processContainer(node);
// return; // stop
break; break;
default: default:
if (node.children.length > 0) { if (processContainer(node) <= 1) {
processContainer(node); if (processBlock(node)) {
// For <li><p>...</p></li>, processes it as block. i++;
// if (node.children.length === 1) { count++;
// if (processBlock(node)) { }
// i++;
// }
// }
} }
break; break;
} }
} }
return count;
} }
/** /**
@ -85,11 +81,14 @@ var sourceVisible = localStorage.getItem('source-visible') === 'true';
if (sibling) { if (sibling) {
if (isClonedNode(current, sibling)) { if (isClonedNode(current, sibling)) {
if (isPureEnglish(current.textContent)) { if (isPureEnglish(current.textContent)) {
processContainer(sibling);
$current.addClass('original-english'); $current.addClass('original-english');
$sibling.addClass('translated'); $sibling.addClass('translated');
$sibling.addClass('translated-cn'); $sibling.addClass('translated-cn');
$sibling.after($current); $sibling.after($current);
$sibling.on('click', function () { $sibling.on('click', function (event) {
// for nested structure.
event.stopPropagation();
$current.toggleClass('hidden'); $current.toggleClass('hidden');
}); });
return true; return true;