Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.

Commit 7b1a2d2

Browse files
Merge pull request #268 from IraErshova/feat-i18n-default-text
feat(i18n): Translate hard code text in operator components
2 parents f0ec397 + 2ab6b1c commit 7b1a2d2

File tree

9 files changed

+69
-22
lines changed

9 files changed

+69
-22
lines changed

src/app/operators/components/additional-resources/additional-resources.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<h2> Additional Resources </h2>
1+
<h2> {{'OPERATOR.ADDITIONAL_RESOURCES.TITLE' | translate}} </h2>
22
<ul class="section-list">
33
<li>
4-
<a [href]="sourceUrl" target="_blank"> Source Code </a>
4+
<a [href]="sourceUrl" target="_blank"> {{'OPERATOR.ADDITIONAL_RESOURCES.SOURCE' | translate}} </a>
55
</li>
66
<li>
7-
<a [href]="specsUrl" target="_blank"> Specs </a>
7+
<a [href]="specsUrl" target="_blank"> {{'OPERATOR.ADDITIONAL_RESOURCES.SPECS' | translate}} </a>
88
</li>
99
<li *ngFor="let resource of additionalResources">
1010
<a [href]="resource.url" target="_blank"> {{ resource.description }} </a>

src/app/operators/components/operator-examples/operator-examples.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h2> Examples </h2>
1+
<h2> {{'OPERATOR.EXAMPLES.TITLE' | translate}} </h2>
22
<div class="code-example" *ngFor="let example of operatorExamples" appHighlightJs>
33
<div class="code-block mat-elevation-z2">
44
<div class="example-header">

src/app/operators/components/operator-parameters/operator-parameters.component.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<h2> Parameters </h2>
1+
<h2> {{'OPERATOR.PARAMETER.TITLE' | translate}} </h2>
22
<table class="parameter-table mat-elevation-z2">
33
<thead>
44
<tr>
5-
<th>Name</th>
6-
<th>Type</th>
7-
<th>Attribute</th>
8-
<th>Description</th>
5+
<th>{{'OPERATOR.PARAMETER.NAME' | translate}}</th>
6+
<th>{{'OPERATOR.PARAMETER.TYPE' | translate}}</th>
7+
<th>{{'OPERATOR.PARAMETER.ATTRIBUTE' | translate}}</th>
8+
<th>{{'OPERATOR.PARAMETER.DESCRIPTION' | translate}}</th>
99
</tr>
1010
</thead>
1111
<tbody>

src/app/operators/components/operator/operator.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class OperatorComponent implements OnInit {
2424
public operator: OperatorDoc;
2525
public operatorsMap = new Map<string, OperatorDoc>();
2626

27-
private readonly baseSourceUrl = 'https://github.com/ReactiveX/rxjs/blob/master/src/operators/';
27+
private readonly baseSourceUrl = 'https://github.com/ReactiveX/rxjs/blob/master/src/internal/operators/';
2828
private readonly baseSpecUrl = 'http://reactivex.io/rxjs/test-file/spec-js/operators';
2929

3030
constructor(

src/app/operators/components/related-operators/related-operators.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<h2 class="related-operators"
2-
*ngIf="relatedOperators?.length"> Related Operators </h2>
2+
*ngIf="relatedOperators?.length"> {{'OPERATOR.RELATED_OPERATORS.TITLE' | translate}} </h2>
33
<ul class="section-list">
44
<li *ngFor="let related of relatedOperators">
55
<a [routerLink]="['/operators', related]"> {{ related }} </a>
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
<h2> Walkthrough </h2>
2-
<div class="walkthrough-container" [innerHTML]="operatorWalkthrough">
3-
4-
</div>
1+
<h2> {{'OPERATOR.WALKTHROUGH.TITLE' | translate}} </h2>
2+
<div class="walkthrough-container" [innerHTML]="operatorWalkthrough"></div>

src/app/operators/operators.module.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import {
2-
NgModule,
3-
InjectionToken,
4-
CUSTOM_ELEMENTS_SCHEMA
5-
} from '@angular/core';
1+
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
62
import { CommonModule } from '@angular/common';
73
import { LayoutModule } from '@angular/cdk/layout';
4+
import { TranslateModule } from '@ngx-translate/core';
85

9-
import { ALL_OPERATORS, OperatorDoc } from '../../operator-docs';
6+
import { ALL_OPERATORS } from '../../operator-docs';
107
import { OperatorsRoutingModule } from './operators-routing.module';
118
import { OperatorsComponent, OPERATORS_TOKEN } from './operators.component';
129
import {
@@ -40,7 +37,13 @@ import { MaterialModule } from '../material/material.module';
4037
HighlightJsDirective,
4138
SafeUrlPipe
4239
],
43-
imports: [CommonModule, MaterialModule, OperatorsRoutingModule, LayoutModule],
40+
imports: [
41+
CommonModule,
42+
MaterialModule,
43+
OperatorsRoutingModule,
44+
LayoutModule,
45+
TranslateModule
46+
],
4447
providers: [
4548
{ provide: OPERATORS_TOKEN, useValue: ALL_OPERATORS },
4649
{ provide: OPERATOR_TOKEN, useValue: ALL_OPERATORS }

src/assets/i18n/en.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,28 @@
44
"OPERATORS": "Operators",
55
"COMPANIES": "Companies",
66
"TEAM": "Team"
7+
},
8+
"OPERATOR": {
9+
"PARAMETER": {
10+
"TITLE": "Parameters",
11+
"NAME": "Name",
12+
"TYPE": "Type",
13+
"ATTRIBUTE": "Attribute",
14+
"DESCRIPTION": "Description"
15+
},
16+
"ADDITIONAL_RESOURCES": {
17+
"TITLE": "Additional Resources",
18+
"SOURCE": "Source Code",
19+
"SPECS": "Specs"
20+
},
21+
"EXAMPLES": {
22+
"TITLE": "Examples"
23+
},
24+
"RELATED_OPERATORS": {
25+
"TITLE": "Related Operators"
26+
},
27+
"WALKTHROUGH": {
28+
"TITLE": "Walkthrough"
29+
}
730
}
831
}

src/assets/i18n/ru.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,28 @@
44
"OPERATORS": "Операторы",
55
"COMPANIES": "Компании",
66
"TEAM": "Команда"
7+
},
8+
"OPERATOR": {
9+
"PARAMETER": {
10+
"TITLE": "Параметры",
11+
"NAME": "Название",
12+
"TYPE": "Тип",
13+
"ATTRIBUTE": "Аттрибут",
14+
"DESCRIPTION": "Описание"
15+
},
16+
"ADDITIONAL_RESOURCES": {
17+
"TITLE": "Дополнительные Источники",
18+
"SOURCE": "Исходный Код",
19+
"SPECS": "Спецификации"
20+
},
21+
"EXAMPLES": {
22+
"TITLE": "Примеры"
23+
},
24+
"RELATED_OPERATORS": {
25+
"TITLE": "Смотрите также"
26+
},
27+
"WALKTHROUGH": {
28+
"TITLE": "Описание"
29+
}
730
}
831
}

0 commit comments

Comments
 (0)