Skip to content

Commit

Permalink
Add i18n attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Jun 5, 2018
1 parent 989e526 commit b1d40cf
Show file tree
Hide file tree
Showing 96 changed files with 3,211 additions and 690 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div *ngIf="account" class="row">
<div class="block col-md-6 col-sm-12">
<div class="small-title">Description</div>
<div i18n class="small-title">Description</div>
<div class="content">{{ getAccountDescription() }}</div>
</div>

<div class="block col-md-6 col-sm-12">
<div class="small-title">Stats</div>
<div i18n class="small-title">Stats</div>

<div class="content">Joined {{ account.createdAt | date }}</div>
<div i18n class="content">Joined {{ account.createdAt | date }}</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'
import { ActivatedRoute } from '@angular/router'
import { Account } from '@app/shared/account/account.model'
import { AccountService } from '@app/shared/account/account.service'
import { I18n } from '@ngx-translate/i18n-polyfill'

@Component({
selector: 'my-account-about',
Expand All @@ -12,7 +13,8 @@ export class AccountAboutComponent implements OnInit {
account: Account

constructor (
protected route: ActivatedRoute,
private route: ActivatedRoute,
private i18n: I18n,
private accountService: AccountService
) { }

Expand All @@ -25,6 +27,6 @@ export class AccountAboutComponent implements OnInit {
getAccountDescription () {
if (this.account.description) return this.account.description

return 'No description'
return this.i18n('No description')
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div *ngIf="account" class="row">
<a
*ngFor="let videoChannel of videoChannels" [routerLink]="[ '/video-channels', videoChannel.uuid ]"
class="video-channel" title="See this video channel"
class="video-channel" i18n-title title="See this video channel"
>
<img [src]="videoChannel.avatarUrl" alt="Avatar" />

<div class="video-channel-display-name">{{ videoChannel.displayName }}</div>
<div class="video-channel-followers">{{ videoChannel.followersCount }} subscribers</div>
<div i18n class="video-channel-followers">{{ videoChannel.followersCount }} subscribers</div>
</a>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { VideoService } from '../../shared/video/video.service'
import { Account } from '@app/shared/account/account.model'
import { AccountService } from '@app/shared/account/account.service'
import { tap } from 'rxjs/operators'
import { I18n } from '@ngx-translate/i18n-polyfill'

@Component({
selector: 'my-account-videos',
Expand All @@ -20,7 +21,7 @@ import { tap } from 'rxjs/operators'
]
})
export class AccountVideosComponent extends AbstractVideoList implements OnInit, OnDestroy {
titlePage = 'Published videos'
titlePage: string
marginContent = false // Disable margin
currentRoute = '/account/videos'
loadOnInit = false
Expand All @@ -34,10 +35,13 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit,
protected notificationsService: NotificationsService,
protected confirmService: ConfirmService,
protected location: Location,
protected i18n: I18n,
private accountService: AccountService,
private videoService: VideoService
) {
super()

this.titlePage = this.i18n('Published videos')
}

ngOnInit () {
Expand All @@ -63,7 +67,11 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit,

return this.videoService
.getAccountVideos(this.account, newPagination, this.sort)
.pipe(tap(({ totalVideos }) => this.titlePage = `Published ${totalVideos} videos`))
.pipe(
tap(({ totalVideos }) => {
this.titlePage = this.i18n('Published {{ totalVideos }} videos', { totalVideos })
})
)
}

generateSyndicationList () {
Expand Down
8 changes: 4 additions & 4 deletions client/src/app/+accounts/accounts.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
<div class="actor-display-name">{{ account.displayName }}</div>
<div class="actor-name">{{ account.nameWithHost }}</div>
</div>
<div class="actor-followers">{{ account.followersCount }} subscribers</div>
<div i18n class="actor-followers">{{ account.followersCount }} subscribers</div>
</div>
</div>

<div class="links">
<a routerLink="videos" routerLinkActive="active" class="title-page">Videos</a>
<a i18n routerLink="videos" routerLinkActive="active" class="title-page">Videos</a>

<a routerLink="video-channels" routerLinkActive="active" class="title-page">Video channels</a>
<a i18n routerLink="video-channels" routerLinkActive="active" class="title-page">Video channels</a>

<a routerLink="about" routerLinkActive="active" class="title-page">About</a>
<a i18n routerLink="about" routerLinkActive="active" class="title-page">About</a>
</div>
</div>

Expand Down
12 changes: 6 additions & 6 deletions client/src/app/+admin/admin.component.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<div class="row">
<div class="sub-menu">
<a *ngIf="hasUsersRight()" routerLink="/admin/users" routerLinkActive="active" class="title-page">
<a i18n *ngIf="hasUsersRight()" routerLink="/admin/users" routerLinkActive="active" class="title-page">
Users
</a>

<a *ngIf="hasServerFollowRight()" routerLink="/admin/follows" routerLinkActive="active" class="title-page">
<a i18n *ngIf="hasServerFollowRight()" routerLink="/admin/follows" routerLinkActive="active" class="title-page">
Manage follows
</a>

<a *ngIf="hasVideoAbusesRight()" routerLink="/admin/video-abuses" routerLinkActive="active" class="title-page">
<a i18n *ngIf="hasVideoAbusesRight()" routerLink="/admin/video-abuses" routerLinkActive="active" class="title-page">
Video abuses
</a>

<a *ngIf="hasVideoBlacklistRight()" routerLink="/admin/video-blacklist" routerLinkActive="active" class="title-page">
<a i18n *ngIf="hasVideoBlacklistRight()" routerLink="/admin/video-blacklist" routerLinkActive="active" class="title-page">
Video blacklist
</a>

<a *ngIf="hasJobsRight()" routerLink="/admin/jobs" routerLinkActive="active" class="title-page">
<a i18n *ngIf="hasJobsRight()" routerLink="/admin/jobs" routerLinkActive="active" class="title-page">
Jobs
</a>

<a *ngIf="hasConfigRight()" routerLink="/admin/config" routerLinkActive="active" class="title-page">
<a i18n *ngIf="hasConfigRight()" routerLink="/admin/config" routerLinkActive="active" class="title-page">
Configuration
</a>
</div>
Expand Down
Loading

0 comments on commit b1d40cf

Please sign in to comment.