Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 1d6130f

Browse files
committed
docs(i18n): incorporate corrections and feedback from Victor Berchet
See PR #2491
1 parent c8a6c22 commit 1d6130f

18 files changed

+1857
-32
lines changed

public/docs/_examples/cb-i18n/ts/app/i18n-providers.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ export function getTranslationProviders(): Promise<Object[]> {
99
// return no providers if fail to get translation file for locale
1010
const noProviders: Object[] = [];
1111

12-
// No locale or English: no translation providers
13-
if (!locale || locale === 'en') {
12+
// No locale or U.S. English: no translation providers
13+
if (!locale || locale === 'en-US') {
1414
return Promise.resolve(noProviders);
1515
}
1616

17-
// Ex: 'i18n/fr/messages.fr.xlf`
18-
const translationFile = `./i18n/${locale}/messages.${locale}.xlf`;
17+
// Ex: 'locale/messages.fr.xlf`
18+
const translationFile = `./locale/messages.${locale}.xlf`;
1919

2020
return getTranslationsWithSystemJs(translationFile)
2121
.then( (translations: string ) => [

public/docs/_examples/cb-i18n/ts/plnkr.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"app/**/*.css",
55
"app/**/*.html",
66
"app/**/*.ts",
7-
"i18n/messages.xlf",
8-
"i18n/fr/messages.fr.xlf",
7+
"locale/messages.xlf",
8+
"locale/messages.fr.xlf",
99

1010
"!**/*.[1].*",
1111

Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* This file is generated by the Angular 2 template compiler.
3+
* Do not edit.
4+
*/
5+
/* tslint:disable */
6+
7+
export const styles:any[] = ['h1[_ngcontent-%COMP%] {\n font-size: 1.2em;\n color: #999;\n margin-bottom: 0;\n}\nh2[_ngcontent-%COMP%] {\n font-size: 2em;\n margin-top: 0;\n padding-top: 0;\n}\nnav[_ngcontent-%COMP%] a[_ngcontent-%COMP%] {\n padding: 5px 10px;\n text-decoration: none;\n margin-top: 10px;\n display: inline-block;\n background-color: #eee;\n border-radius: 4px;\n}\nnav[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:visited, a[_ngcontent-%COMP%]:link {\n color: #607D8B;\n}\nnav[_ngcontent-%COMP%] a[_ngcontent-%COMP%]:hover {\n color: #039be5;\n background-color: #CFD8DC;\n}\nnav[_ngcontent-%COMP%] a.active[_ngcontent-%COMP%] {\n color: #039be5;\n}'];
Lines changed: 268 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
/**
2+
* This file is generated by the Angular 2 template compiler.
3+
* Do not edit.
4+
*/
5+
/* tslint:disable */
6+
7+
import * as import0 from '@angular/core/src/render/api';
8+
import * as import1 from '@angular/core/src/linker/view';
9+
import * as import2 from '@angular/core/src/linker/element';
10+
import * as import3 from '../../app/app.component';
11+
import * as import4 from '@angular/core/src/linker/view_utils';
12+
import * as import5 from '@angular/core/src/di/injector';
13+
import * as import6 from '@angular/core/src/linker/view_type';
14+
import * as import7 from '@angular/core/src/change_detection/change_detection';
15+
import * as import8 from '@angular/core/src/metadata/view';
16+
import * as import9 from '@angular/core/src/linker/component_factory';
17+
import * as import10 from './app.component.css.shim';
18+
import * as import11 from '@angular/router/src/directives/router_link';
19+
import * as import12 from '@angular/router/src/directives/router_link_active';
20+
import * as import13 from '@angular/core/src/linker/query_list';
21+
import * as import14 from '@angular/router/src/directives/router_outlet';
22+
import * as import15 from '@angular/router/src/router';
23+
import * as import16 from '@angular/router/src/router_state';
24+
import * as import17 from '@angular/common/src/location/location_strategy';
25+
import * as import18 from '@angular/core/src/linker/element_ref';
26+
import * as import19 from '@angular/router/src/router_outlet_map';
27+
import * as import20 from '@angular/core/src/linker/component_factory_resolver';
28+
import * as import21 from '@angular/core/src/security';
29+
var renderType_AppComponent_Host:import0.RenderComponentType = (null as any);
30+
class _View_AppComponent_Host0 extends import1.AppView<any> {
31+
_el_0:any;
32+
/*private*/ _appEl_0:import2.AppElement;
33+
_AppComponent_0_4:import3.AppComponent;
34+
constructor(viewUtils:import4.ViewUtils,parentInjector:import5.Injector,declarationEl:import2.AppElement) {
35+
super(_View_AppComponent_Host0,renderType_AppComponent_Host,import6.ViewType.HOST,viewUtils,parentInjector,declarationEl,import7.ChangeDetectorStatus.CheckAlways);
36+
}
37+
createInternal(rootSelector:string):import2.AppElement {
38+
this._el_0 = this.selectOrCreateHostElement('my-app',rootSelector,(null as any));
39+
this._appEl_0 = new import2.AppElement(0,(null as any),this,this._el_0);
40+
var compView_0:any = viewFactory_AppComponent0(this.viewUtils,this.injector(0),this._appEl_0);
41+
this._AppComponent_0_4 = new import3.AppComponent();
42+
this._appEl_0.initComponent(this._AppComponent_0_4,[],compView_0);
43+
compView_0.create(this._AppComponent_0_4,this.projectableNodes,(null as any));
44+
this.init([].concat([this._el_0]),[this._el_0],[],[]);
45+
return this._appEl_0;
46+
}
47+
injectorGetInternal(token:any,requestNodeIndex:number,notFoundResult:any):any {
48+
if (((token === import3.AppComponent) && (0 === requestNodeIndex))) { return this._AppComponent_0_4; }
49+
return notFoundResult;
50+
}
51+
}
52+
function viewFactory_AppComponent_Host0(viewUtils:import4.ViewUtils,parentInjector:import5.Injector,declarationEl:import2.AppElement):import1.AppView<any> {
53+
if ((renderType_AppComponent_Host === (null as any))) { (renderType_AppComponent_Host = viewUtils.createRenderComponentType('',0,import8.ViewEncapsulation.None,[],{})); }
54+
return new _View_AppComponent_Host0(viewUtils,parentInjector,declarationEl);
55+
}
56+
export const AppComponentNgFactory:import9.ComponentFactory<import3.AppComponent> = new import9.ComponentFactory<import3.AppComponent>('my-app',viewFactory_AppComponent_Host0,import3.AppComponent);
57+
const styles_AppComponent:any[] = [import10.styles];
58+
var renderType_AppComponent:import0.RenderComponentType = (null as any);
59+
class _View_AppComponent0 extends import1.AppView<import3.AppComponent> {
60+
_text_0:any;
61+
_el_1:any;
62+
_text_2:any;
63+
_text_3:any;
64+
_el_4:any;
65+
_text_5:any;
66+
_el_6:any;
67+
_RouterLinkWithHref_6_3:import11.RouterLinkWithHref;
68+
_RouterLinkActive_6_4:import12.RouterLinkActive;
69+
_query_RouterLink_6_0:import13.QueryList<any>;
70+
_query_RouterLinkWithHref_6_1:import13.QueryList<any>;
71+
_text_7:any;
72+
_text_8:any;
73+
_el_9:any;
74+
_RouterLinkWithHref_9_3:import11.RouterLinkWithHref;
75+
_RouterLinkActive_9_4:import12.RouterLinkActive;
76+
_query_RouterLink_9_0:import13.QueryList<any>;
77+
_query_RouterLinkWithHref_9_1:import13.QueryList<any>;
78+
_text_10:any;
79+
_text_11:any;
80+
_text_12:any;
81+
_el_13:any;
82+
/*private*/ _appEl_13:import2.AppElement;
83+
_RouterOutlet_13_5:import14.RouterOutlet;
84+
_text_14:any;
85+
/*private*/ _expr_0:any;
86+
/*private*/ _expr_2:any;
87+
/*private*/ _expr_3:any;
88+
/*private*/ _expr_4:any;
89+
/*private*/ _expr_6:any;
90+
/*private*/ _expr_7:any;
91+
/*private*/ _expr_8:any;
92+
constructor(viewUtils:import4.ViewUtils,parentInjector:import5.Injector,declarationEl:import2.AppElement) {
93+
super(_View_AppComponent0,renderType_AppComponent,import6.ViewType.COMPONENT,viewUtils,parentInjector,declarationEl,import7.ChangeDetectorStatus.CheckAlways);
94+
}
95+
createInternal(rootSelector:string):import2.AppElement {
96+
const parentRenderNode:any = this.renderer.createViewRoot(this.declarationAppElement.nativeElement);
97+
this._text_0 = this.renderer.createText(parentRenderNode,'\n ',(null as any));
98+
this._el_1 = this.renderer.createElement(parentRenderNode,'h1',(null as any));
99+
this._text_2 = this.renderer.createText(this._el_1,'',(null as any));
100+
this._text_3 = this.renderer.createText(parentRenderNode,'\n ',(null as any));
101+
this._el_4 = this.renderer.createElement(parentRenderNode,'nav',(null as any));
102+
this._text_5 = this.renderer.createText(this._el_4,'\n ',(null as any));
103+
this._el_6 = this.renderer.createElement(this._el_4,'a',(null as any));
104+
this.renderer.setElementAttribute(this._el_6,'routerLink','/dashboard');
105+
this.renderer.setElementAttribute(this._el_6,'routerLinkActive','active');
106+
this._RouterLinkWithHref_6_3 = new import11.RouterLinkWithHref(this.parentInjector.get(import15.Router),this.parentInjector.get(import16.ActivatedRoute),this.parentInjector.get(import17.LocationStrategy));
107+
this._RouterLinkActive_6_4 = new import12.RouterLinkActive(this.parentInjector.get(import15.Router),new import18.ElementRef(this._el_6),this.renderer);
108+
this._query_RouterLink_6_0 = new import13.QueryList<any>();
109+
this._query_RouterLinkWithHref_6_1 = new import13.QueryList<any>();
110+
this._text_7 = this.renderer.createText(this._el_6,'Dashboard',(null as any));
111+
this._text_8 = this.renderer.createText(this._el_4,'\n ',(null as any));
112+
this._el_9 = this.renderer.createElement(this._el_4,'a',(null as any));
113+
this.renderer.setElementAttribute(this._el_9,'routerLink','/heroes');
114+
this.renderer.setElementAttribute(this._el_9,'routerLinkActive','active');
115+
this._RouterLinkWithHref_9_3 = new import11.RouterLinkWithHref(this.parentInjector.get(import15.Router),this.parentInjector.get(import16.ActivatedRoute),this.parentInjector.get(import17.LocationStrategy));
116+
this._RouterLinkActive_9_4 = new import12.RouterLinkActive(this.parentInjector.get(import15.Router),new import18.ElementRef(this._el_9),this.renderer);
117+
this._query_RouterLink_9_0 = new import13.QueryList<any>();
118+
this._query_RouterLinkWithHref_9_1 = new import13.QueryList<any>();
119+
this._text_10 = this.renderer.createText(this._el_9,'Heroes',(null as any));
120+
this._text_11 = this.renderer.createText(this._el_4,'\n ',(null as any));
121+
this._text_12 = this.renderer.createText(parentRenderNode,'\n ',(null as any));
122+
this._el_13 = this.renderer.createElement(parentRenderNode,'router-outlet',(null as any));
123+
this._appEl_13 = new import2.AppElement(13,(null as any),this,this._el_13);
124+
this._RouterOutlet_13_5 = new import14.RouterOutlet(this.parentInjector.get(import19.RouterOutletMap),this._appEl_13.vcRef,this.parentInjector.get(import20.ComponentFactoryResolver),(null as any));
125+
this._text_14 = this.renderer.createText(parentRenderNode,'\n ',(null as any));
126+
this._expr_0 = import7.UNINITIALIZED;
127+
var disposable_0:Function = this.renderer.listen(this._el_6,'click',this.eventHandler(this._handle_click_6_0.bind(this)));
128+
this._expr_2 = import7.UNINITIALIZED;
129+
this._expr_3 = import7.UNINITIALIZED;
130+
this._expr_4 = import7.UNINITIALIZED;
131+
var disposable_1:Function = this.renderer.listen(this._el_9,'click',this.eventHandler(this._handle_click_9_0.bind(this)));
132+
this._expr_6 = import7.UNINITIALIZED;
133+
this._expr_7 = import7.UNINITIALIZED;
134+
this._expr_8 = import7.UNINITIALIZED;
135+
this.init([],[
136+
this._text_0,
137+
this._el_1,
138+
this._text_2,
139+
this._text_3,
140+
this._el_4,
141+
this._text_5,
142+
this._el_6,
143+
this._text_7,
144+
this._text_8,
145+
this._el_9,
146+
this._text_10,
147+
this._text_11,
148+
this._text_12,
149+
this._el_13,
150+
this._text_14
151+
]
152+
,[
153+
disposable_0,
154+
disposable_1
155+
]
156+
,[]);
157+
return (null as any);
158+
}
159+
injectorGetInternal(token:any,requestNodeIndex:number,notFoundResult:any):any {
160+
if (((token === import11.RouterLinkWithHref) && ((6 <= requestNodeIndex) && (requestNodeIndex <= 7)))) { return this._RouterLinkWithHref_6_3; }
161+
if (((token === import12.RouterLinkActive) && ((6 <= requestNodeIndex) && (requestNodeIndex <= 7)))) { return this._RouterLinkActive_6_4; }
162+
if (((token === import11.RouterLinkWithHref) && ((9 <= requestNodeIndex) && (requestNodeIndex <= 10)))) { return this._RouterLinkWithHref_9_3; }
163+
if (((token === import12.RouterLinkActive) && ((9 <= requestNodeIndex) && (requestNodeIndex <= 10)))) { return this._RouterLinkActive_9_4; }
164+
if (((token === import14.RouterOutlet) && (13 === requestNodeIndex))) { return this._RouterOutlet_13_5; }
165+
return notFoundResult;
166+
}
167+
detectChangesInternal(throwOnChange:boolean):void {
168+
var changes:{[key: string]:import7.SimpleChange} = (null as any);
169+
changes = (null as any);
170+
const currVal_2:any = '/dashboard';
171+
if (import4.checkBinding(throwOnChange,this._expr_2,currVal_2)) {
172+
this._RouterLinkWithHref_6_3.routerLink = currVal_2;
173+
if ((changes === (null as any))) { (changes = {}); }
174+
changes['routerLink'] = new import7.SimpleChange(this._expr_2,currVal_2);
175+
this._expr_2 = currVal_2;
176+
}
177+
if ((changes !== (null as any))) { this._RouterLinkWithHref_6_3.ngOnChanges(changes); }
178+
changes = (null as any);
179+
const currVal_4:any = 'active';
180+
if (import4.checkBinding(throwOnChange,this._expr_4,currVal_4)) {
181+
this._RouterLinkActive_6_4.routerLinkActive = currVal_4;
182+
if ((changes === (null as any))) { (changes = {}); }
183+
changes['routerLinkActive'] = new import7.SimpleChange(this._expr_4,currVal_4);
184+
this._expr_4 = currVal_4;
185+
}
186+
if ((changes !== (null as any))) { this._RouterLinkActive_6_4.ngOnChanges(changes); }
187+
changes = (null as any);
188+
const currVal_6:any = '/heroes';
189+
if (import4.checkBinding(throwOnChange,this._expr_6,currVal_6)) {
190+
this._RouterLinkWithHref_9_3.routerLink = currVal_6;
191+
if ((changes === (null as any))) { (changes = {}); }
192+
changes['routerLink'] = new import7.SimpleChange(this._expr_6,currVal_6);
193+
this._expr_6 = currVal_6;
194+
}
195+
if ((changes !== (null as any))) { this._RouterLinkWithHref_9_3.ngOnChanges(changes); }
196+
changes = (null as any);
197+
const currVal_8:any = 'active';
198+
if (import4.checkBinding(throwOnChange,this._expr_8,currVal_8)) {
199+
this._RouterLinkActive_9_4.routerLinkActive = currVal_8;
200+
if ((changes === (null as any))) { (changes = {}); }
201+
changes['routerLinkActive'] = new import7.SimpleChange(this._expr_8,currVal_8);
202+
this._expr_8 = currVal_8;
203+
}
204+
if ((changes !== (null as any))) { this._RouterLinkActive_9_4.ngOnChanges(changes); }
205+
this.detectContentChildrenChanges(throwOnChange);
206+
if (!throwOnChange) {
207+
if (this._query_RouterLink_6_0.dirty) {
208+
this._query_RouterLink_6_0.reset([]);
209+
this._RouterLinkActive_6_4.links = this._query_RouterLink_6_0;
210+
this._query_RouterLink_6_0.notifyOnChanges();
211+
}
212+
if (this._query_RouterLinkWithHref_6_1.dirty) {
213+
this._query_RouterLinkWithHref_6_1.reset([this._RouterLinkWithHref_6_3]);
214+
this._RouterLinkActive_6_4.linksWithHrefs = this._query_RouterLinkWithHref_6_1;
215+
this._query_RouterLinkWithHref_6_1.notifyOnChanges();
216+
}
217+
if (this._query_RouterLink_9_0.dirty) {
218+
this._query_RouterLink_9_0.reset([]);
219+
this._RouterLinkActive_9_4.links = this._query_RouterLink_9_0;
220+
this._query_RouterLink_9_0.notifyOnChanges();
221+
}
222+
if (this._query_RouterLinkWithHref_9_1.dirty) {
223+
this._query_RouterLinkWithHref_9_1.reset([this._RouterLinkWithHref_9_3]);
224+
this._RouterLinkActive_9_4.linksWithHrefs = this._query_RouterLinkWithHref_9_1;
225+
this._query_RouterLinkWithHref_9_1.notifyOnChanges();
226+
}
227+
if ((this.numberOfChecks === 0)) { this._RouterLinkActive_6_4.ngAfterContentInit(); }
228+
if ((this.numberOfChecks === 0)) { this._RouterLinkActive_9_4.ngAfterContentInit(); }
229+
}
230+
const currVal_0:any = import4.interpolate(1,'',this.context.title,'');
231+
if (import4.checkBinding(throwOnChange,this._expr_0,currVal_0)) {
232+
this.renderer.setText(this._text_2,currVal_0);
233+
this._expr_0 = currVal_0;
234+
}
235+
const currVal_3:any = this._RouterLinkWithHref_6_3.href;
236+
if (import4.checkBinding(throwOnChange,this._expr_3,currVal_3)) {
237+
this.renderer.setElementProperty(this._el_6,'href',this.viewUtils.sanitizer.sanitize(import21.SecurityContext.URL,currVal_3));
238+
this._expr_3 = currVal_3;
239+
}
240+
const currVal_7:any = this._RouterLinkWithHref_9_3.href;
241+
if (import4.checkBinding(throwOnChange,this._expr_7,currVal_7)) {
242+
this.renderer.setElementProperty(this._el_9,'href',this.viewUtils.sanitizer.sanitize(import21.SecurityContext.URL,currVal_7));
243+
this._expr_7 = currVal_7;
244+
}
245+
this.detectViewChildrenChanges(throwOnChange);
246+
}
247+
destroyInternal():void {
248+
this._RouterLinkWithHref_6_3.ngOnDestroy();
249+
this._RouterLinkActive_6_4.ngOnDestroy();
250+
this._RouterLinkWithHref_9_3.ngOnDestroy();
251+
this._RouterLinkActive_9_4.ngOnDestroy();
252+
this._RouterOutlet_13_5.ngOnDestroy();
253+
}
254+
private _handle_click_6_0($event:any):boolean {
255+
this.markPathToRootAsCheckOnce();
256+
const pd_0:any = ((<any>this._RouterLinkWithHref_6_3.onClick($event.button,$event.ctrlKey,$event.metaKey)) !== false);
257+
return (true && pd_0);
258+
}
259+
private _handle_click_9_0($event:any):boolean {
260+
this.markPathToRootAsCheckOnce();
261+
const pd_0:any = ((<any>this._RouterLinkWithHref_9_3.onClick($event.button,$event.ctrlKey,$event.metaKey)) !== false);
262+
return (true && pd_0);
263+
}
264+
}
265+
export function viewFactory_AppComponent0(viewUtils:import4.ViewUtils,parentInjector:import5.Injector,declarationEl:import2.AppElement):import1.AppView<import3.AppComponent> {
266+
if ((renderType_AppComponent === (null as any))) { (renderType_AppComponent = viewUtils.createRenderComponentType('C:/github/angular.io.ideablade/public/docs/_examples/toh-6/ts/app/app.component.ts class AppComponent - inline template',0,import8.ViewEncapsulation.Emulated,styles_AppComponent,{})); }
267+
return new _View_AppComponent0(viewUtils,parentInjector,declarationEl);
268+
}

0 commit comments

Comments
 (0)