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

Commit bf7abad

Browse files
committed
docs(i18n): add new features - Ward's touches
1 parent 30f7c9f commit bf7abad

File tree

12 files changed

+264
-161
lines changed

12 files changed

+264
-161
lines changed

public/docs/_examples/cb-i18n/e2e-spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ describe('i18n E2E Tests', () => {
1717
expect(element(by.css('my-app')).getText()).toContain('Yo tampoco genero ningún elemento');
1818
});
1919

20-
it('should display the translated alt attribute', function () {
21-
const alt = element(by.css('img')).getAttribute('alt');
22-
expect(alt).toBe('Logo de Angular 2');
20+
it('should display the translated title attribute', function () {
21+
const title = element(by.css('img')).getAttribute('title');
22+
expect(title).toBe('Logo de Angular 2');
2323
});
2424

2525
it('should display the plural of: a horde of wolves', function () {
26-
expect(element.all(by.css('div')).get(0).getText()).toBe('una horda de lobos');
26+
expect(element.all(by.css('span')).get(0).getText()).toBe('ningún lobo');
2727
});
2828

29-
it('should display the select of sex', function () {
30-
expect(element.all(by.css('div')).get(1).getText()).toBe('El heroe es mujer');
29+
it('should display the select of gender', function () {
30+
expect(element.all(by.css('span')).get(1).getText()).toBe('El heroe es mujer');
3131
});
3232

3333
});
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
**/*.ngfactory.ts
22
**/*.metadata.json
3-
**/messages.xlf
43
dist
54
!app/tsconfig.json
6-
!rollup.js
5+
!rollup.js

public/docs/_examples/cb-i18n/ts/app/app.component.1.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ <h1 i18n>Hello i18n!</h1>
1010
<h1 i18n="An introduction header for this sample">Hello i18n!</h1>
1111
<!--#enddocregion i18n-attribute-desc-->
1212

13-
<!--#docregion i18n-alt-->
14-
<img [src]="logo" alt="Angular 2 logo">
15-
<!--#enddocregion i18n-alt-->
13+
<!--#docregion i18n-title-->
14+
<img [src]="logo" title="Angular 2 logo">
15+
<!--#enddocregion i18n-title-->

public/docs/_examples/cb-i18n/ts/app/app.component.html

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@ <h1 i18n="User welcome|An introduction header for this sample">Hello i18n!</h1>
1717

1818
<br />
1919

20-
<!--#docregion i18n-alt-translate-->
21-
<img [src]="logo" i18n-alt alt="Angular 2 logo" />
22-
<!--#enddocregion i18n-alt-translate-->
23-
20+
<!--#docregion i18n-title-translate-->
21+
<img [src]="logo" i18n-title title="Angular 2 logo" />
22+
<!--#enddocregion i18n-title-translate-->
23+
<br>
24+
<button (click)="inc(1)">+</button> <button (click)="inc(-1)">-</button>
2425
<!--#docregion i18n-plural-->
25-
<div i18n>{wolves, plural, zero {no wolves} =1 {one wolf} two {two wolves} other {a horde of wolves}}</div>
26+
<span i18n>{wolves, plural, =0 {no wolves} =1 {one wolf} =2 {two wolves} other {a wolf pack}}</span>
2627
<!--#enddocregion i18n-plural-->
27-
28+
({{wolves}})
29+
<br><br>
30+
<button (click)="male()">&#9794;</button> <button (click)="female()">&#9792;</button>
2831
<!--#docregion i18n-select-->
29-
<div i18n>The hero is {sex, select, m {male} f {female}}</div>
32+
<span i18n>The hero is {gender, select, m {male} f {female}}</span>
3033
<!--#enddocregion i18n-select-->
34+
<br>

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ import { Component } from '@angular/core';
77
templateUrl: 'app.component.html'
88
})
99
export class AppComponent {
10-
wolves = 5;
11-
sex = 'f';
10+
wolves = 0;
11+
gender = 'f';
1212
fly = true;
1313
logo = 'https://angular.io/resources/images/logos/angular2/angular.png';
14+
inc(i: number) {
15+
this.wolves = Math.min(5, Math.max(0, this.wolves + i));
16+
}
17+
male() { this.gender = 'm'; }
18+
female() { this.gender = 'f'; }
1419
}
1520

public/docs/_examples/cb-i18n/ts/locale/messages.es.xlf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ I don&apos;t output any element either
2424
<source>Angular 2 logo</source>
2525
<target>Logo de Angular 2</target>
2626
</trans-unit>
27-
<trans-unit id="fd3463eb234ef776cae5f7d9a8efa19c3fd3f959" datatype="html">
27+
<trans-unit id="6e22e74e8cbd3095560cfe08993c4fdfa3c50eb0" datatype="html">
2828
<source/>
29-
<target>{wolves, plural, zero {ningún lobo} =1 {un lobo} two {dos lobos} other {una horda de lobos}}</target>
29+
<target>{wolves, plural, =0 {ningún lobo} =1 {un lobo} =2 {dos lobos} other {una horda de lobos}}</target>
3030
</trans-unit>
31-
<trans-unit id="989a4716b006c7bd26c4dfd9bc45dc6c792e34b1" datatype="html">
31+
<trans-unit id="61cafedb85466ab789b3ae817bba1a545468ee1c" datatype="html">
3232
<source>The hero is <x id="ICU"/></source>
3333
<target>El heroe es <x id="ICU"/></target>
3434
</trans-unit>
35-
<trans-unit id="c0ca5e58fe954d528bbfa516007a5a11690a7e99" datatype="html">
35+
<trans-unit id="14c7055d67771a3b7b6888d282ac092896be06b6" datatype="html">
3636
<source/>
37-
<target>{sex, select, m {hombre} f {mujer}}</target>
37+
<target>{gender, select, m {hombre} f {mujer}}</target>
3838
</trans-unit>
3939
</body>
4040
</file>

public/docs/_examples/cb-i18n/ts/locale/messages.es.xlf.html

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,24 @@
2929
</trans-unit>
3030
<!-- #enddocregion translated-other-nodes -->
3131
<!-- #docregion translated-plural -->
32-
<trans-unit id="fd3463eb234ef776cae5f7d9a8efa19c3fd3f959" datatype="html">
32+
<trans-unit id="6e22e74e8cbd3095560cfe08993c4fdfa3c50eb0" datatype="html">
3333
<source/>
34-
<target>{wolves, plural, zero {ningún lobo} =1 {un lobo} two {dos lobos} other {una horda de lobos}}</target>
34+
<target>{wolves, plural, =0 {ningún lobo} =1 {un lobo} =2 {dos lobos} other {una horda de lobos}}</target>
3535
</trans-unit>
3636
<!-- #enddocregion translated-plural -->
3737
<!-- #docregion translated-select -->
38-
<trans-unit id="989a4716b006c7bd26c4dfd9bc45dc6c792e34b1" datatype="html">
38+
<!-- #docregion translate-select-1 -->
39+
<trans-unit id="61cafedb85466ab789b3ae817bba1a545468ee1c" datatype="html">
3940
<source>The hero is <x id="ICU"/></source>
4041
<target>El heroe es <x id="ICU"/></target>
4142
</trans-unit>
42-
<trans-unit id="c0ca5e58fe954d528bbfa516007a5a11690a7e99" datatype="html">
43+
<!-- #enddocregion translate-select-1 -->
44+
<!-- #docregion translate-select-2 -->
45+
<trans-unit id="14c7055d67771a3b7b6888d282ac092896be06b6" datatype="html">
4346
<source/>
44-
<target>{sex, select, m {hombre} f {mujer}}</target>
47+
<target>{gender, select, m {hombre} f {mujer}}</target>
4548
</trans-unit>
49+
<!-- #enddocregion translate-select-2 -->
4650
<!-- #enddocregion translated-select -->
4751
</body>
4852
</file>

public/docs/_examples/cb-i18n/ts/locale/trans-unit.html

Lines changed: 0 additions & 38 deletions
This file was deleted.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3+
<file source-language="en" datatype="plaintext" original="ng2.template">
4+
<body>
5+
<trans-unit id="af2ccf4b5dba59616e92cf1531505af02da8f6d2" datatype="html">
6+
<source>Hello i18n!</source>
7+
<target/>
8+
<note priority="1" from="description">An introduction header for this sample</note>
9+
<note priority="1" from="meaning">User welcome</note>
10+
</trans-unit>
11+
<trans-unit id="ba0cc104d3d69bf669f97b8d96a4c5d8d9559aa3" datatype="html">
12+
<source>I don&apos;t output any element</source>
13+
<target/>
14+
</trans-unit>
15+
<trans-unit id="df3cf8b55cb528cf8c00167e0b119bfb828538b5" datatype="html">
16+
<source>
17+
I don&apos;t output any element either
18+
</source>
19+
<target/>
20+
<note priority="1" from="description">optional description</note>
21+
<note priority="1" from="meaning">optional meaning</note>
22+
</trans-unit>
23+
<trans-unit id="35ab5d6121ecbe0decdda638571a5a55ac77d5c4" datatype="html">
24+
<source>Angular 2 logo</source>
25+
<target/>
26+
</trans-unit>
27+
<trans-unit id="6e22e74e8cbd3095560cfe08993c4fdfa3c50eb0" datatype="html">
28+
<source/>
29+
<target/>
30+
</trans-unit>
31+
<trans-unit id="61cafedb85466ab789b3ae817bba1a545468ee1c" datatype="html">
32+
<source>The hero is <x id="ICU"/></source>
33+
<target/>
34+
</trans-unit>
35+
<trans-unit id="14c7055d67771a3b7b6888d282ac092896be06b6" datatype="html">
36+
<source/>
37+
<target/>
38+
</trans-unit>
39+
</body>
40+
</file>
41+
</xliff>

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-
"locale/messages.xlf",
8-
"locale/messages.es.xlf",
7+
"messages.xlf",
8+
"locale/messages.*.xlf",
99

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

0 commit comments

Comments
 (0)