-
Notifications
You must be signed in to change notification settings - Fork 62
[WIP] feat(i18n): integrate internationalization and russian language support #144
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<h2> Examples </h2> | ||
<h2> {{ 'OPERATOR.EXAMPLES' | translate }} </h2> | ||
<div | ||
class="code-example" | ||
*ngFor="let example of operatorExamples" | ||
appHighlightJs> | ||
<div class="code-block mat-elevation-z2"> | ||
<div class="example-header"> | ||
<div class="header-title" [innerHTML]="example.name"></div> | ||
<div class="header-title" [innerHTML]="example.name[currentLang]"></div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would make sense to write a pipe for this behaviour. To get the element at currentLang will be pretty repetiv. |
||
<button | ||
mat-icon-button | ||
ngxClipboard | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
<h2> Parameters </h2> | ||
<h2> {{ 'OPERATOR.PARAMETERS.TITLE' | translate }} </h2> | ||
<table class="parameter-table mat-elevation-z2"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Type</th> | ||
<th>Attribute</th> | ||
<th>Description</th> | ||
<th>{{'OPERATOR.PARAMETERS.NAME' | translate}}</th> | ||
<th>{{'OPERATOR.PARAMETERS.TYPE' | translate}}</th> | ||
<th>{{'OPERATOR.PARAMETERS.ATTRIBUTE' | translate}}</th> | ||
<th>{{'OPERATOR.PARAMETERS.DESCRIPTION' | translate}}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let parameter of operatorParameters"> | ||
<td> {{parameter.name}} </td> | ||
<td> {{parameter.type}} </td> | ||
<td> {{parameter.attribute}} </td> | ||
<td> {{parameter.description}} </td> | ||
<td> {{parameter.description[currentLang]}} </td> | ||
</tr> | ||
</tbody> | ||
</table> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import { Component, Input } from '@angular/core'; | ||
import { OperatorParameters } from '../../../../operator-docs'; | ||
import { Component, Input } from "@angular/core"; | ||
import { OperatorParameters } from "../../../../operator-docs"; | ||
|
||
@Component({ | ||
selector: 'app-operator-parameters', | ||
templateUrl: './operator-parameters.component.html', | ||
styleUrls: ['./operator-parameters.component.scss'] | ||
selector: "app-operator-parameters", | ||
templateUrl: "./operator-parameters.component.html", | ||
styleUrls: ["./operator-parameters.component.scss"] | ||
}) | ||
export class OperatorParametersComponent { | ||
@Input() operatorParameters: OperatorParameters[]; | ||
@Input() currentLang = "en"; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
import { Component, Input, OnInit, ChangeDetectionStrategy } from '@angular/core'; | ||
import { | ||
Component, | ||
Input, | ||
OnInit, | ||
ChangeDetectionStrategy | ||
} from '@angular/core'; | ||
import { OperatorDoc } from '../../../../operator-docs/operator.model'; | ||
|
||
@Component({ | ||
|
@@ -9,6 +14,7 @@ import { OperatorDoc } from '../../../../operator-docs/operator.model'; | |
}) | ||
export class OperatorComponent { | ||
@Input() operator: OperatorDoc; | ||
@Input() currentLang = 'en'; | ||
|
||
private readonly baseSourceUrl = 'https://github.com/ReactiveX/rxjs/blob/master/src/operators/'; | ||
private readonly baseSpecUrl = 'http://reactivex.io/rxjs/test-file/spec-js/operators'; | ||
|
@@ -38,7 +44,7 @@ export class OperatorComponent { | |
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i18n needed for |
||
|
||
get walkthrough() { | ||
return this.operator.walkthrough && this.operator.walkthrough.description; | ||
return this.operator.walkthrough && this.operator.walkthrough.description[this.currentLang]; | ||
} | ||
|
||
get parameters() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
<h2> Walkthrough </h2> | ||
<h2> {{ 'OPERATOR.WALKTHROGH' | translate }} </h2> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: type |
||
<div class="walkthrough-container" [innerHTML]="operatorWalkthrough"> | ||
|
||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
<mat-sidenav-container | ||
class="operator-container"> | ||
<mat-sidenav-container class="operator-container"> | ||
<mat-sidenav | ||
[mode]="sidenavMode" | ||
[opened]="!smallScreen" | ||
|
@@ -18,6 +17,7 @@ <h3 mat-subheader class="category-subheader">{{ category }}</h3> | |
</mat-sidenav> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i18n for |
||
<app-operator | ||
*ngFor="let operator of operators" | ||
[currentLang]="currentLang" | ||
[operator]="operator"> | ||
</app-operator> | ||
</mat-sidenav-container> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need i18n on lines 4, 7 and 10