From 8f950c26f2dda91a1e1e480d889377cfd2d68584 Mon Sep 17 00:00:00 2001 From: Zhicheng Wang Date: Thu, 3 Aug 2017 15:30:35 +0800 Subject: [PATCH] fix: change v2's link to v2.angular.cn --- aio/content/navigation.json | 2 +- aio/src/app/app.component.spec.ts | 2 +- aio/src/app/documents/document.service.ts | 44 +++++++++---------- .../app/navigation/navigation.service.spec.ts | 2 +- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/aio/content/navigation.json b/aio/content/navigation.json index cba9583642..689200c08f 100644 --- a/aio/content/navigation.json +++ b/aio/content/navigation.json @@ -441,7 +441,7 @@ ], "docVersions": [ - { "title": "v2", "url": "https://v2.angular.io" }, + { "title": "v2", "url": "https://v2.angular.cn" }, { "title": "AngularDart", "url": "https://webdev.dartlang.org/angular" } ] diff --git a/aio/src/app/app.component.spec.ts b/aio/src/app/app.component.spec.ts index 5aec4219d7..c69ffe6fdd 100644 --- a/aio/src/app/app.component.spec.ts +++ b/aio/src/app/app.component.spec.ts @@ -911,7 +911,7 @@ class TestHttp { static versionFull = '4.0.0-local+sha.73808dd'; static docVersions: NavigationNode[] = [ - { title: 'v2', url: 'https://v2.angular.io' } + { title: 'v2', url: 'https://v2.angular.cn' } ]; // tslint:disable:quotemark diff --git a/aio/src/app/documents/document.service.ts b/aio/src/app/documents/document.service.ts index c7617465f2..2e88611b8c 100644 --- a/aio/src/app/documents/document.service.ts +++ b/aio/src/app/documents/document.service.ts @@ -1,18 +1,18 @@ import { Injectable } from '@angular/core'; import { Http, Response } from '@angular/http'; - -import { Observable } from 'rxjs/Observable'; -import { AsyncSubject } from 'rxjs/AsyncSubject'; -import { of } from 'rxjs/observable/of'; +import { LocationService } from 'app/shared/location.service'; +import { Logger } from 'app/shared/logger.service'; import 'rxjs/add/operator/catch'; import 'rxjs/add/operator/map'; import 'rxjs/add/operator/switchMap'; +import { AsyncSubject } from 'rxjs/AsyncSubject'; + +import { Observable } from 'rxjs/Observable'; +import { of } from 'rxjs/observable/of'; import { DocumentContents } from './document-contents'; -export { DocumentContents } from './document-contents'; -import { LocationService } from 'app/shared/location.service'; -import { Logger } from 'app/shared/logger.service'; +export { DocumentContents } from './document-contents'; export const FILE_NOT_FOUND_ID = 'file-not-found'; export const FETCHING_ERROR_ID = 'fetching-error'; @@ -23,10 +23,9 @@ const FETCHING_ERROR_CONTENTS = `
error_outline
-

Request for document failed.

+

请求文档失败

- We are unable to retrieve the "" page at this time. - Please check your connection and try again later. + 抱歉,这次我们没能取到 "" 页。请检查你的网络连接,稍后再试。

@@ -39,10 +38,9 @@ export class DocumentService { currentDocument: Observable; - constructor( - private logger: Logger, - private http: Http, - location: LocationService) { + constructor(private logger: Logger, + private http: Http, + location: LocationService) { // Whenever the URL changes we try to get the appropriate doc this.currentDocument = location.currentPath.switchMap(path => this.getDocument(path)); } @@ -50,7 +48,7 @@ export class DocumentService { private getDocument(url: string) { const id = url || 'index'; this.logger.log('getting document', id); - if ( !this.cache.has(id)) { + if (!this.cache.has(id)) { this.cache.set(id, this.fetchDocument(id)); } return this.cache.get(id); @@ -61,12 +59,12 @@ export class DocumentService { this.logger.log('fetching document from', requestPath); const subject = new AsyncSubject(); this.http - .get(requestPath) - .map(response => response.json()) - .catch((error: Response) => { - return error.status === 404 ? this.getFileNotFoundDoc(id) : this.getErrorDoc(id, error); - }) - .subscribe(subject); + .get(requestPath) + .map(response => response.json()) + .catch((error: Response) => { + return error.status === 404 ? this.getFileNotFoundDoc(id) : this.getErrorDoc(id, error); + }) + .subscribe(subject); return subject.asObservable(); } @@ -78,7 +76,7 @@ export class DocumentService { } else { return of({ id: FILE_NOT_FOUND_ID, - contents: 'Document not found' + contents: '文档未找到', }); } } @@ -88,7 +86,7 @@ export class DocumentService { this.cache.delete(id); return Observable.of({ id: FETCHING_ERROR_ID, - contents: FETCHING_ERROR_CONTENTS + contents: FETCHING_ERROR_CONTENTS, }); } } diff --git a/aio/src/app/navigation/navigation.service.spec.ts b/aio/src/app/navigation/navigation.service.spec.ts index 09e1d2dcde..d8c1547b1e 100644 --- a/aio/src/app/navigation/navigation.service.spec.ts +++ b/aio/src/app/navigation/navigation.service.spec.ts @@ -250,7 +250,7 @@ describe('NavigationService', () => { actualDocVersions = []; docVersions = [ { title: 'v4.0.0' }, - { title: 'v2', url: 'https://v2.angular.io' } + { title: 'v2', url: 'https://v2.angular.cn' } ]; expectedDocVersions = docVersions.map(v => (