"builder": "@angular-devkit/build-angular:browser",
"options": {
"aot": true,
+ "localize": true,
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"budgets": []
},
"hmr": {
+ "localize": false,
"budgets": [
{
"type": "anyComponentStyle",
]
},
"e2e": {
+ "localize": false,
"budgets": [
{
"type": "anyComponentStyle",
"with": "src/environments/environment.e2e.ts"
}
]
- },
- "ar": {
- "localize": [ "ar" ]
- },
- "hu-HU": {
- "localize": [ "hu" ]
- },
- "th-TH": {
- "localize": [ "th" ]
- },
- "fi-FI": {
- "localize": [ "fi" ]
- },
- "nl-NL": {
- "localize": [ "nl" ]
- },
- "gd": {
- "localize": [ "gd" ]
- },
- "el-GR": {
- "localize": [ "el" ]
- },
- "es-ES": {
- "localize": [ "es" ]
- },
- "oc": {
- "localize": [ "oc" ]
- },
- "pt-BR": {
- "localize": [ "pt" ]
- },
- "pt-PT": {
- "localize": [ "pt-PT" ]
- },
- "sv-SE": {
- "localize": [ "sv" ]
- },
- "pl-PL": {
- "localize": [ "pl" ]
- },
- "ru-RU": {
- "localize": [ "ru" ]
- },
- "zh-Hans-CN": {
- "localize": [ "zh-Hans" ]
- },
- "zh-Hant-TW": {
- "localize": [ "zh-Hant" ]
- },
- "fr-FR": {
- "localize": [ "fr" ]
- },
- "ja-JP": {
- "localize": [ "ja" ]
- },
- "eu-ES": {
- "localize": [ "eu" ]
- },
- "ca-ES": {
- "localize": [ "ca" ]
- },
- "cs-CZ": {
- "localize": [ "cs" ]
- },
- "eo": {
- "localize": [ "eo" ]
- },
- "de-DE": {
- "localize": [ "de" ]
- },
- "it-IT": {
- "localize": [ "it" ]
- },
- "vi-VN": {
- "localize": [ "vi" ]
- },
- "kab": {
- "localize": [ "kab" ]
}
}
},
"typings": "*.d.ts",
"devDependencies": {
"@angular-devkit/build-angular": "^0.1001.0-next.4",
- "@angular/animations": "^10.1.0-next.4",
+ "@angular/animations": "^10.1.0-next.5",
"@angular/cdk": "^10.0.0",
"@angular/cli": "^10.1.0-next.4",
- "@angular/common": "^10.1.0-next.4",
- "@angular/compiler": "^10.1.0-next.4",
- "@angular/compiler-cli": "^10.1.0-next.4",
- "@angular/core": "^10.1.0-next.4",
- "@angular/forms": "^10.1.0-next.4",
- "@angular/localize": "^10.1.0-next.4",
- "@angular/platform-browser": "^10.1.0-next.4",
- "@angular/platform-browser-dynamic": "^10.1.0-next.4",
- "@angular/router": "^10.1.0-next.4",
- "@angular/service-worker": "^10.1.0-next.4",
+ "@angular/common": "^10.1.0-next.5",
+ "@angular/compiler": "^10.1.0-next.5",
+ "@angular/compiler-cli": "^10.1.0-next.5",
+ "@angular/core": "^10.1.0-next.5",
+ "@angular/forms": "^10.1.0-next.5",
+ "@angular/localize": "^10.1.0-next.5",
+ "@angular/platform-browser": "^10.1.0-next.5",
+ "@angular/platform-browser-dynamic": "^10.1.0-next.5",
+ "@angular/router": "^10.1.0-next.5",
+ "@angular/service-worker": "^10.1.0-next.5",
"@angularclass/hmr": "^2.1.3",
"@neos21/bootstrap3-glyphicons": "^1.0.1",
"@ng-bootstrap/ng-bootstrap": "^7.0.0",
"@ngx-loading-bar/http-client": "^5.0.0",
"@ngx-loading-bar/router": "^5.0.0",
"@ngx-meta/core": "^9.0.0",
- "@ngx-translate/i18n-polyfill": "^1.0.0",
"@types/chart.js": "^2.9.16",
"@types/core-js": "^2.5.2",
"@types/debug": "^4.1.5",
import { InstanceService } from '@app/shared/shared-instance'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig } from '@shared/models'
@Component({
private instanceValidatorsService: InstanceValidatorsService,
private instanceService: InstanceService,
private serverService: ServerService,
- private notifier: Notifier,
- private i18n: I18n
+ private notifier: Notifier
) {
super()
}
this.instanceService.contactAdministrator(fromEmail, fromName, subject, body)
.subscribe(
() => {
- this.notifier.success(this.i18n('Your message has been sent.'))
+ this.notifier.success($localize`Your message has been sent.`)
this.hide()
},
err => {
this.error = err.status === 403
- ? this.i18n('You already sent this form recently')
+ ? $localize`You already sent this form recently`
: err.message
}
)
import { Component, OnDestroy, OnInit } from '@angular/core'
import { MarkdownService } from '@app/core'
import { Account, AccountService } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-account-about',
private accountSub: Subscription
constructor (
- private i18n: I18n,
private accountService: AccountService,
private markdownService: MarkdownService
) { }
getAccountDescription () {
if (this.descriptionHTML) return this.descriptionHTML
- return this.i18n('No description')
+ return $localize`No description`
}
}
import { immutableAssign } from '@app/helpers'
import { Account, AccountService, VideoService } from '@app/shared/shared-main'
import { AbstractVideoList } from '@app/shared/shared-video-miniature'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-account-videos',
private accountSub: Subscription
constructor (
- protected i18n: I18n,
protected router: Router,
protected serverService: ServerService,
protected route: ActivatedRoute,
.getAccountVideos(this.account, newPagination, this.sort)
.pipe(
tap(({ total }) => {
- this.titlePage = this.i18n('Published {{total}} videos', { total })
+ this.titlePage = $localize`Published ${total} videos`
})
)
}
import { AuthService, Notifier, RedirectService, RestExtractor, ScreenService, UserService } from '@app/core'
import { Account, AccountService, DropdownAction, ListOverflowItem, VideoChannel, VideoChannelService } from '@app/shared/shared-main'
import { AccountReportComponent } from '@app/shared/shared-moderation'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { User, UserRight } from '@shared/models'
@Component({
private restExtractor: RestExtractor,
private redirectService: RedirectService,
private authService: AuthService,
- private screenService: ScreenService,
- private i18n: I18n
+ private screenService: ScreenService
) {
}
)
this.links = [
- { label: this.i18n('VIDEO CHANNELS'), routerLink: 'video-channels' },
- { label: this.i18n('VIDEOS'), routerLink: 'videos' },
- { label: this.i18n('ABOUT'), routerLink: 'about' }
+ { label: $localize`VIDEO CHANNELS`, routerLink: 'video-channels' },
+ { label: $localize`VIDEOS`, routerLink: 'videos' },
+ { label: $localize`ABOUT`, routerLink: 'about' }
]
}
}
activateCopiedMessage () {
- this.notifier.success(this.i18n('Username copied'))
+ this.notifier.success($localize`Username copied`)
}
subscribersDisplayFor (count: number) {
- return this.i18n('{count, plural, =1 {1 subscriber} other {{{count}} subscribers}}', { count })
+ if (count === 1) return $localize`1 subscriber`
+
+ return $localize`${count} subscribers`
}
private onAccount (account: Account) {
() => {
this.isAccountManageable = this.account.userId && this.account.userId === this.authService.getUser().id
- this.accountFollowerTitle = this.i18n(
- '{{followers}} direct account followers',
- { followers: this.subscribersDisplayFor(account.followersCount) }
- )
+ const followers = this.subscribersDisplayFor(account.followersCount)
+ this.accountFollowerTitle = $localize`${followers} direct account followers`
// It's not our account, we can report it
if (!this.isAccountManageable) {
this.prependModerationActions = [
{
- label: this.i18n('Report account'),
+ label: $localize`Report account`,
handler: () => this.showReportModal()
}
]
import { Component, OnInit } from '@angular/core'
import { AuthService, ScreenService } from '@app/core'
import { ListOverflowItem } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { UserRight } from '@shared/models'
import { TopMenuDropdownParam } from '@app/shared/shared-main/misc/top-menu-dropdown.component'
+import { UserRight } from '@shared/models'
@Component({
templateUrl: './admin.component.html',
constructor (
private auth: AuthService,
- private screen: ScreenService,
- private i18n: I18n
+ private screen: ScreenService
) { }
get isBroadcastMessageDisplayed () {
ngOnInit () {
const federationItems: TopMenuDropdownParam = {
- label: this.i18n('Federation'),
+ label: $localize`Federation`,
children: [
{
- label: this.i18n('Instances you follow'),
+ label: $localize`Instances you follow`,
routerLink: '/admin/follows/following-list',
iconName: 'following'
},
{
- label: this.i18n('Instances following you'),
+ label: $localize`Instances following you`,
routerLink: '/admin/follows/followers-list',
iconName: 'follower'
},
{
- label: this.i18n('Video redundancies'),
+ label: $localize`Video redundancies`,
routerLink: '/admin/follows/video-redundancies-list',
iconName: 'videos'
}
}
const moderationItems: TopMenuDropdownParam = {
- label: this.i18n('Moderation'),
+ label: $localize`Moderation`,
children: []
}
if (this.hasAbusesRight()) {
moderationItems.children.push({
- label: this.i18n('Reports'),
+ label: $localize`Reports`,
routerLink: '/admin/moderation/abuses/list',
iconName: 'flag'
})
}
if (this.hasVideoBlocklistRight()) {
moderationItems.children.push({
- label: this.i18n('Video blocks'),
+ label: $localize`Video blocks`,
routerLink: '/admin/moderation/video-blocks/list',
iconName: 'cross'
})
}
if (this.hasAccountsBlocklistRight()) {
moderationItems.children.push({
- label: this.i18n('Muted accounts'),
+ label: $localize`Muted accounts`,
routerLink: '/admin/moderation/blocklist/accounts',
iconName: 'user-x'
})
}
if (this.hasServersBlocklistRight()) {
moderationItems.children.push({
- label: this.i18n('Muted servers'),
+ label: $localize`Muted servers`,
routerLink: '/admin/moderation/blocklist/servers',
iconName: 'peertube-x'
})
}
if (this.hasUsersRight()) {
- this.menuEntries.push({ label: this.i18n('Users'), routerLink: '/admin/users' })
+ this.menuEntries.push({ label: $localize`Users`, routerLink: '/admin/users' })
}
if (this.hasServerFollowRight()) this.menuEntries.push(federationItems)
if (this.hasAbusesRight() || this.hasVideoBlocklistRight()) this.menuEntries.push(moderationItems)
if (this.hasConfigRight()) {
- this.menuEntries.push({ label: this.i18n('Configuration'), routerLink: '/admin/config' })
+ this.menuEntries.push({ label: $localize`Configuration`, routerLink: '/admin/config' })
}
if (this.hasPluginsRight()) {
- this.menuEntries.push({ label: this.i18n('Plugins/Themes'), routerLink: '/admin/plugins' })
+ this.menuEntries.push({ label: $localize`Plugins/Themes`, routerLink: '/admin/plugins' })
}
if (this.hasJobsRight() || this.hasLogsRight() || this.hasDebugRight()) {
- this.menuEntries.push({ label: this.i18n('System'), routerLink: '/admin/system' })
+ this.menuEntries.push({ label: $localize`System`, routerLink: '/admin/system' })
}
}
UserValidatorsService
} from '@app/shared/shared-forms'
import { NgbNav } from '@ng-bootstrap/ng-bootstrap'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { CustomConfig, ServerConfig } from '@shared/models'
@Component({
private userValidatorsService: UserValidatorsService,
private notifier: Notifier,
private configService: ConfigService,
- private serverService: ServerService,
- private i18n: I18n
+ private serverService: ServerService
) {
super()
this.resolutions = [
{
id: '0p',
- label: this.i18n('Audio-only'),
- description: this.i18n('A <code>.mp4</code> that keeps the original audio track, with no video')
+ label: $localize`Audio-only`,
+ description: $localize`A <code>.mp4</code> that keeps the original audio track, with no video`
},
{
id: '240p',
- label: this.i18n('240p')
+ label: $localize`240p`
},
{
id: '360p',
- label: this.i18n('360p')
+ label: $localize`360p`
},
{
id: '480p',
- label: this.i18n('480p')
+ label: $localize`480p`
},
{
id: '720p',
- label: this.i18n('720p')
+ label: $localize`720p`
},
{
id: '1080p',
- label: this.i18n('1080p')
+ label: $localize`1080p`
},
{
id: '2160p',
- label: this.i18n('2160p')
+ label: $localize`2160p`
}
]
this.transcodingThreadOptions = [
- { value: 0, label: this.i18n('Auto (via ffmpeg)') },
+ { value: 0, label: $localize`Auto (via ffmpeg)` },
{ value: 1, label: '1' },
{ value: 2, label: '2' },
{ value: 4, label: '4' },
this.updateForm()
- this.notifier.success(this.i18n('Configuration updated.'))
+ this.notifier.success($localize`Configuration updated.`)
},
err => this.notifier.error(err.message)
import { HttpClient } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { RestExtractor } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { CustomConfig } from '@shared/models'
import { environment } from '../../../../environments/environment'
constructor (
private authHttp: HttpClient,
- private restExtractor: RestExtractor,
- private i18n: I18n
- ) {
+ private restExtractor: RestExtractor
+ ) {
this.videoQuotaOptions = [
{ value: undefined, label: 'Default quota', disabled: true },
- { value: -1, label: this.i18n('Unlimited') },
+ { value: -1, label: $localize`Unlimited` },
{ value: undefined, label: '─────', disabled: true },
- { value: 0, label: this.i18n('None - no upload possible') },
- { value: 100 * 1024 * 1024, label: this.i18n('100MB') },
- { value: 500 * 1024 * 1024, label: this.i18n('500MB') },
- { value: 1024 * 1024 * 1024, label: this.i18n('1GB') },
- { value: 5 * 1024 * 1024 * 1024, label: this.i18n('5GB') },
- { value: 20 * 1024 * 1024 * 1024, label: this.i18n('20GB') },
- { value: 50 * 1024 * 1024 * 1024, label: this.i18n('50GB') }
+ { value: 0, label: $localize`None - no upload possible` },
+ { value: 100 * 1024 * 1024, label: $localize`100MB` },
+ { value: 500 * 1024 * 1024, label: $localize`500MB` },
+ { value: 1024 * 1024 * 1024, label: $localize`1GB` },
+ { value: 5 * 1024 * 1024 * 1024, label: $localize`5GB` },
+ { value: 20 * 1024 * 1024 * 1024, label: $localize`20GB` },
+ { value: 50 * 1024 * 1024 * 1024, label: $localize`50GB` }
]
this.videoQuotaDailyOptions = [
{ value: undefined, label: 'Default daily upload limit', disabled: true },
- { value: -1, label: this.i18n('Unlimited') },
+ { value: -1, label: $localize`Unlimited` },
{ value: undefined, label: '─────', disabled: true },
- { value: 0, label: this.i18n('None - no upload possible') },
- { value: 10 * 1024 * 1024, label: this.i18n('10MB') },
- { value: 50 * 1024 * 1024, label: this.i18n('50MB') },
- { value: 100 * 1024 * 1024, label: this.i18n('100MB') },
- { value: 500 * 1024 * 1024, label: this.i18n('500MB') },
- { value: 2 * 1024 * 1024 * 1024, label: this.i18n('2GB') },
- { value: 5 * 1024 * 1024 * 1024, label: this.i18n('5GB') }
+ { value: 0, label: $localize`None - no upload possible` },
+ { value: 10 * 1024 * 1024, label: $localize`10MB` },
+ { value: 50 * 1024 * 1024, label: $localize`50MB` },
+ { value: 100 * 1024 * 1024, label: $localize`100MB` },
+ { value: 500 * 1024 * 1024, label: $localize`500MB` },
+ { value: 2 * 1024 * 1024 * 1024, label: $localize`2GB` },
+ { value: 5 * 1024 * 1024 * 1024, label: $localize`5GB` }
]
}
import { Component, OnInit } from '@angular/core'
import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'
import { InstanceFollowService } from '@app/shared/shared-instance'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ActorFollow } from '@shared/models'
@Component({
constructor (
private confirmService: ConfirmService,
private notifier: Notifier,
- private i18n: I18n,
private followService: InstanceFollowService
) {
super()
.subscribe(
() => {
const handle = follow.follower.name + '@' + follow.follower.host
- this.notifier.success(this.i18n('{{handle}} accepted in instance followers', { handle }))
+ this.notifier.success($localize`${handle} accepted in instance followers`)
},
err => {
}
async rejectFollower (follow: ActorFollow) {
- const message = this.i18n('Do you really want to reject this follower?')
- const res = await this.confirmService.confirm(message, this.i18n('Reject'))
+ const message = $localize`Do you really want to reject this follower?`
+ const res = await this.confirmService.confirm(message, $localize`Reject`)
if (res === false) return
this.followService.rejectFollower(follow)
.subscribe(
() => {
const handle = follow.follower.name + '@' + follow.follower.host
- this.notifier.success(this.i18n('{{handle}} rejected from instance followers', { handle }))
+ this.notifier.success($localize`${handle} rejected from instance followers`)
this.loadData()
},
}
async deleteFollower (follow: ActorFollow) {
- const message = this.i18n('Do you really want to delete this follower?')
- const res = await this.confirmService.confirm(message, this.i18n('Delete'))
+ const message = $localize`Do you really want to delete this follower?`
+ const res = await this.confirmService.confirm(message, $localize`Delete`)
if (res === false) return
this.followService.removeFollower(follow)
.subscribe(
() => {
const handle = follow.follower.name + '@' + follow.follower.host
- this.notifier.success(this.i18n('{{handle}} removed from instance followers', { handle }))
+ this.notifier.success($localize`${handle} removed from instance followers`)
this.loadData()
},
import { ConfirmService, Notifier, RestPagination, RestTable } from '@app/core'
import { InstanceFollowService } from '@app/shared/shared-instance'
import { BatchDomainsModalComponent } from '@app/shared/shared-moderation'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ActorFollow } from '@shared/models'
@Component({
constructor (
private notifier: Notifier,
private confirmService: ConfirmService,
- private followService: InstanceFollowService,
- private i18n: I18n
- ) {
+ private followService: InstanceFollowService
+ ) {
super()
}
async addFollowing (hosts: string[]) {
this.followService.follow(hosts).subscribe(
() => {
- this.notifier.success(this.i18n('Follow request(s) sent!'))
+ this.notifier.success($localize`Follow request(s) sent!`)
this.loadData()
},
async removeFollowing (follow: ActorFollow) {
const res = await this.confirmService.confirm(
- this.i18n('Do you really want to unfollow {{host}}?', { host: follow.following.host }),
- this.i18n('Unfollow')
+ $localize`Do you really want to unfollow ${follow.following.host}?`,
+ $localize`Unfollow`
)
if (res === false) return
this.followService.unfollow(follow).subscribe(
() => {
- this.notifier.success(this.i18n('You are not following {{host}} anymore.', { host: follow.following.host }))
+ this.notifier.success($localize`You are not following ${follow.following.host} anymore.`)
this.loadData()
},
import { Component, Input } from '@angular/core'
import { Notifier } from '@app/core'
import { RedundancyService } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-redundancy-checkbox',
constructor (
private notifier: Notifier,
- private redundancyService: RedundancyService,
- private i18n: I18n
- ) { }
+ private redundancyService: RedundancyService
+ ) { }
updateRedundancyState () {
this.redundancyService.updateRedundancy(this.host, this.redundancyAllowed)
.subscribe(
() => {
- const stateLabel = this.redundancyAllowed ? this.i18n('enabled') : this.i18n('disabled')
+ const stateLabel = this.redundancyAllowed ? $localize`enabled` : $localize`disabled`
- this.notifier.success(this.i18n('Redundancy for {{host}} is {{stateLabel}}', { host: this.host, stateLabel }))
+ this.notifier.success($localize`Redundancy for ${this.host} is ${stateLabel}`)
},
err => this.notifier.error(err.message)
import { Component, OnInit } from '@angular/core'
import { ConfirmService, Notifier, RestPagination, RestTable, ServerService } from '@app/core'
import { BytesPipe, RedundancyService } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
import { VideoRedundanciesTarget, VideoRedundancy } from '@shared/models'
import { VideosRedundancyStats } from '@shared/models/server'
private notifier: Notifier,
private confirmService: ConfirmService,
private redundancyService: RedundancyService,
- private serverService: ServerService,
- private i18n: I18n
- ) {
+ private serverService: ServerService
+ ) {
super()
this.bytesPipe = new BytesPipe()
this.redundanciesGraphsData.push({
stats,
graphData: {
- labels: [ this.i18n('Used'), this.i18n('Available') ],
+ labels: [ $localize`Used`, $localize`Available` ],
datasets: [
{
data: [ stats.totalUsed, totalSize ],
}
async removeRedundancy (redundancy: VideoRedundancy) {
- const message = this.i18n('Do you really want to remove this video redundancy?')
- const res = await this.confirmService.confirm(message, this.i18n('Remove redundancy'))
+ const message = $localize`Do you really want to remove this video redundancy?`
+ const res = await this.confirmService.confirm(message, $localize`Remove redundancy`)
if (res === false) return
this.redundancyService.removeVideoRedundancies(redundancy)
.subscribe(
() => {
- this.notifier.success(this.i18n('Video redundancies removed!'))
+ this.notifier.success($localize`Video redundancies removed!`)
this.loadData()
},
import { SortMeta } from 'primeng/api'
import { filter, switchMap } from 'rxjs/operators'
+import { buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/utils'
+import { environment } from 'src/environments/environment'
import { AfterViewInit, Component, OnInit } from '@angular/core'
+import { DomSanitizer } from '@angular/platform-browser'
import { ActivatedRoute, Params, Router } from '@angular/router'
import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable, ServerService } from '@app/core'
import { DropdownAction, Video, VideoService } from '@app/shared/shared-main'
import { VideoBlockService } from '@app/shared/shared-moderation'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoBlacklist, VideoBlacklistType } from '@shared/models'
-import { buildVideoOrPlaylistEmbed, buildVideoLink } from 'src/assets/player/utils'
-import { environment } from 'src/environments/environment'
-import { DomSanitizer } from '@angular/platform-browser'
@Component({
selector: 'my-video-block-list',
private sanitizer: DomSanitizer,
private videoService: VideoService,
private route: ActivatedRoute,
- private router: Router,
- private i18n: I18n
- ) {
+ private router: Router
+ ) {
super()
this.videoBlocklistActions = [
[
{
- label: this.i18n('Internal actions'),
+ label: $localize`Internal actions`,
isHeader: true,
isDisplayed: videoBlock => videoBlock.type === VideoBlacklistType.AUTO_BEFORE_PUBLISHED
},
{
- label: this.i18n('Switch video block to manual'),
+ label: $localize`Switch video block to manual`,
handler: videoBlock => {
this.videoBlocklistService.unblockVideo(videoBlock.video.id).pipe(
switchMap(_ => this.videoBlocklistService.blockVideo(videoBlock.video.id, undefined, true))
).subscribe(
() => {
- this.notifier.success(this.i18n('Video {{name}} switched to manual block.', { name: videoBlock.video.name }))
+ this.notifier.success($localize`Video ${videoBlock.video.name} switched to manual block.`)
this.loadData()
},
],
[
{
- label: this.i18n('Actions for the video'),
+ label: $localize`Actions for the video`,
isHeader: true
},
{
- label: this.i18n('Unblock'),
+ label: $localize`Unblock`,
handler: videoBlock => this.unblockVideo(videoBlock)
},
{
- label: this.i18n('Delete'),
+ label: $localize`Delete`,
handler: async videoBlock => {
const res = await this.confirmService.confirm(
- this.i18n('Do you really want to delete this video?'),
- this.i18n('Delete')
+ $localize`Do you really want to delete this video?`,
+ $localize`Delete`
)
if (res === false) return
this.videoService.removeVideo(videoBlock.video.id)
.subscribe(
() => {
- this.notifier.success(this.i18n('Video deleted.'))
+ this.notifier.success($localize`Video deleted.`)
},
err => this.notifier.error(err.message)
}
booleanToText (value: boolean) {
- if (value === true) return this.i18n('yes')
+ if (value === true) return $localize`yes`
- return this.i18n('no')
+ return $localize`no`
}
toHtml (text: string) {
}
async unblockVideo (entry: VideoBlacklist) {
- const confirmMessage = this.i18n(
- 'Do you really want to unblock this video? It will be available again in the videos list.'
- )
+ const confirmMessage = $localize`Do you really want to unblock this video? It will be available again in the videos list.`
- const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblock'))
+ const res = await this.confirmService.confirm(confirmMessage, $localize`Unblock`)
if (res === false) return
this.videoBlocklistService.unblockVideo(entry.video.id).subscribe(
() => {
- this.notifier.success(this.i18n('Video {{name}} unblocked.', { name: entry.video.name }))
+ this.notifier.success($localize`Video ${entry.video.name} unblocked.`)
this.loadData()
},
import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service'
import { ComponentPagination, ConfirmService, hasMoreItems, Notifier } from '@app/core'
import { PluginService } from '@app/core/plugins/plugin.service'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { compareSemVer } from '@shared/core-utils/miscs/miscs'
import { PeerTubePlugin } from '@shared/models/plugins/peertube-plugin.model'
import { PluginType } from '@shared/models/plugins/plugin.type'
onDataSubject = new Subject<any[]>()
constructor (
- private i18n: I18n,
private pluginService: PluginService,
private pluginApiService: PluginApiService,
private notifier: Notifier,
getNoResultMessage () {
if (this.pluginType === PluginType.PLUGIN) {
- return this.i18n("You don't have plugins installed yet.")
+ return $localize`You don't have plugins installed yet.`
}
- return this.i18n("You don't have themes installed yet.")
+ return $localize`You don't have themes installed yet.`
}
isUpdateAvailable (plugin: PeerTubePlugin) {
}
getUpdateLabel (plugin: PeerTubePlugin) {
- return this.i18n('Update to {{version}}', { version: plugin.latestVersion })
+ return $localize`Update to ${plugin.latestVersion}`
}
isUpdating (plugin: PeerTubePlugin) {
async uninstall (plugin: PeerTubePlugin) {
const res = await this.confirmService.confirm(
- this.i18n('Do you really want to uninstall {{pluginName}}?', { pluginName: plugin.name }),
- this.i18n('Uninstall')
+ $localize`Do you really want to uninstall ${plugin.name}?`,
+ $localize`Uninstall`
)
if (res === false) return
this.pluginApiService.uninstall(plugin.name, plugin.type)
.subscribe(
() => {
- this.notifier.success(this.i18n('{{pluginName}} uninstalled.', { pluginName: plugin.name }))
+ this.notifier.success($localize`${plugin.name} uninstalled.`)
this.plugins = this.plugins.filter(p => p.name !== plugin.name)
this.pagination.totalItems--
res => {
this.updating[updatingKey] = false
- this.notifier.success(this.i18n('{{pluginName}} updated.', { pluginName: plugin.name }))
+ this.notifier.success($localize`${plugin.name} updated.`)
Object.assign(plugin, res)
},
import { Component, OnInit } from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { PluginApiService } from '@app/+admin/plugins/shared/plugin-api.service'
-import { ComponentPagination, ConfirmService, hasMoreItems, Notifier, ServerService } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
+import { ComponentPagination, ConfirmService, hasMoreItems, Notifier } from '@app/core'
import { PeerTubePluginIndex } from '@shared/models/plugins/peertube-plugin-index.model'
import { PluginType } from '@shared/models/plugins/plugin.type'
private searchSubject = new Subject<string>()
constructor (
- private server: ServerService,
- private i18n: I18n,
private pluginService: PluginApiService,
private notifier: Notifier,
private confirmService: ConfirmService,
err => {
console.error(err)
- const message = this.i18n('The plugin index is not available. Please retry later.')
+ const message = $localize`The plugin index is not available. Please retry later.`
this.notifier.error(message)
}
)
if (this.installing[plugin.npmName]) return
const res = await this.confirmService.confirm(
- this.i18n('Please only install plugins or themes you trust, since they can execute any code on your instance.'),
- this.i18n('Install {{pluginName}}?', { pluginName: plugin.name })
+ $localize`Please only install plugins or themes you trust, since they can execute any code on your instance.`,
+ $localize`Install ${plugin.name}?`
)
if (res === false) return
this.installing[plugin.npmName] = false
this.pluginInstalled = true
- this.notifier.success(this.i18n('{{pluginName}} installed.', { pluginName: plugin.name }))
+ this.notifier.success($localize`${plugin.name} installed.`)
plugin.installed = true
},
import { ActivatedRoute } from '@angular/router'
import { Notifier } from '@app/core'
import { BuildFormArgument, FormReactive, FormValidatorService } from '@app/shared/shared-forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { PeerTubePlugin, RegisterServerSettingOptions } from '@shared/models'
import { PluginApiService } from '../shared/plugin-api.service'
constructor (
protected formValidatorService: FormValidatorService,
- private i18n: I18n,
private pluginService: PluginApiService,
private notifier: Notifier,
private route: ActivatedRoute
this.pluginService.updatePluginSettings(this.plugin.name, this.plugin.type, settings)
.subscribe(
() => {
- this.notifier.success(this.i18n('Settings updated.'))
+ this.notifier.success($localize`Settings updated.`)
},
err => this.notifier.error(err.message)
import { Injectable } from '@angular/core'
import { ComponentPagination, RestExtractor, RestService } from '@app/core'
import { PluginService } from '@app/core/plugins/plugin.service'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { peertubeTranslate } from '@shared/core-utils/i18n'
import {
InstallOrUpdatePlugin,
private authHttp: HttpClient,
private restExtractor: RestExtractor,
private restService: RestService,
- private i18n: I18n,
private pluginService: PluginService
) { }
getPluginTypeOptions () {
return [
{
- label: this.i18n('Plugins'),
+ label: $localize`Plugins`,
value: PluginType.PLUGIN
},
{
- label: this.i18n('Themes'),
+ label: $localize`Themes`,
value: PluginType.THEME
}
]
getPluginTypeLabel (type: PluginType) {
if (type === PluginType.PLUGIN) {
- return this.i18n('plugin')
+ return $localize`plugin`
}
- return this.i18n('theme')
+ return $localize`theme`
}
getPlugins (
import { Component, OnInit } from '@angular/core'
import { Notifier, RestPagination, RestTable } from '@app/core'
import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { Job, JobState, JobType } from '@shared/models'
import { JobStateClient } from '../../../../types/job-state-client.type'
import { JobTypeClient } from '../../../../types/job-type-client.type'
constructor (
private notifier: Notifier,
- private jobsService: JobService,
- private i18n: I18n
- ) {
+ private jobsService: JobService
+ ) {
super()
}
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'
import { Notifier } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { LogLevel } from '@shared/models'
import { LogRow } from './log-row.model'
import { LogsService } from './logs.service'
constructor (
private logsService: LogsService,
- private notifier: Notifier,
- private i18n: I18n
- ) { }
+ private notifier: Notifier
+ ) { }
ngOnInit (): void {
this.buildTimeChoices()
this.timeChoices = [
{
id: lastWeek.toISOString(),
- label: this.i18n('Last week')
+ label: $localize`Last week`
},
{
id: lastDay.toISOString(),
- label: this.i18n('Last day')
+ label: $localize`Last day`
},
{
id: lastHour.toISOString(),
- label: this.i18n('Last hour')
+ label: $localize`Last hour`
}
]
this.levelChoices = [
{
id: 'debug',
- label: this.i18n('Debug')
+ label: $localize`Debug`
},
{
id: 'info',
- label: this.i18n('Info')
+ label: $localize`Info`
},
{
id: 'warn',
- label: this.i18n('Warning')
+ label: $localize`Warning`
},
{
id: 'error',
- label: this.i18n('Error')
+ label: $localize`Error`
}
]
this.logTypeChoices = [
{
id: 'standard',
- label: this.i18n('Standard logs')
+ label: $localize`Standard logs`
},
{
id: 'audit',
- label: this.i18n('Audit logs')
+ label: $localize`Audit logs`
}
]
import { ConfigService } from '@app/+admin/config/shared/config.service'
import { AuthService, Notifier, ScreenService, ServerService, UserService } from '@app/core'
import { FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { UserCreate, UserRole } from '@shared/models'
import { UserEdit } from './user-edit'
private route: ActivatedRoute,
private router: Router,
private notifier: Notifier,
- private userService: UserService,
- private i18n: I18n
- ) {
+ private userService: UserService
+ ) {
super()
this.buildQuotaOptions()
this.userService.addUser(userCreate).subscribe(
() => {
- this.notifier.success(this.i18n('User {{username}} created.', { username: userCreate.username }))
+ this.notifier.success($localize`User ${userCreate.username} created.`)
this.router.navigate([ '/admin/users/list' ])
},
}
getFormButtonTitle () {
- return this.i18n('Create user')
+ return $localize`Create user`
}
}
import { Component, Input, OnInit } from '@angular/core'
import { Notifier, UserService } from '@app/core'
import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { UserUpdate } from '@shared/models'
@Component({
protected formValidatorService: FormValidatorService,
private userValidatorsService: UserValidatorsService,
private notifier: Notifier,
- private userService: UserService,
- private i18n: I18n
- ) {
+ private userService: UserService
+ ) {
super()
}
this.userService.updateUser(this.userId, userUpdate).subscribe(
() => {
- this.notifier.success(
- this.i18n('Password changed for user {{username}}.', { username: this.username })
- )
+ this.notifier.success($localize`Password changed for user ${this.username}.`)
},
err => this.error = err.message
}
getFormButtonTitle () {
- return this.i18n('Update user password')
+ return $localize`Update user password`
}
}
import { ConfigService } from '@app/+admin/config/shared/config.service'
import { AuthService, Notifier, ScreenService, ServerService, User, UserService } from '@app/core'
import { FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { User as UserType, UserAdminFlag, UserRole, UserUpdate } from '@shared/models'
import { UserEdit } from './user-edit'
private route: ActivatedRoute,
private router: Router,
private notifier: Notifier,
- private userService: UserService,
- private i18n: I18n
- ) {
+ private userService: UserService
+ ) {
super()
this.buildQuotaOptions()
this.userService.updateUser(this.user.id, userUpdate).subscribe(
() => {
- this.notifier.success(this.i18n('User {{username}} updated.', { username: this.user.username }))
+ this.notifier.success($localize`User ${this.user.username} updated.`)
this.router.navigate([ '/admin/users/list' ])
},
}
getFormButtonTitle () {
- return this.i18n('Update user')
+ return $localize`Update user`
}
resetPassword () {
this.userService.askResetPassword(this.user.email).subscribe(
() => {
- this.notifier.success(
- this.i18n('An email asking for password reset has been sent to {{username}}.', { username: this.user.username })
- )
+ this.notifier.success($localize`An email asking for password reset has been sent to ${this.user.username}.`)
},
err => this.error = err.message
import { SortMeta } from 'primeng/api'
import { Component, OnInit, ViewChild } from '@angular/core'
+import { ActivatedRoute, Params, Router } from '@angular/router'
import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService, UserService } from '@app/core'
import { Actor, DropdownAction } from '@app/shared/shared-main'
import { UserBanModalComponent } from '@app/shared/shared-moderation'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig, User, UserRole } from '@shared/models'
-import { Params, Router, ActivatedRoute } from '@angular/router'
type UserForList = User & {
rawVideoQuota: number
private userService: UserService,
private auth: AuthService,
private route: ActivatedRoute,
- private router: Router,
- private i18n: I18n
- ) {
+ private router: Router
+ ) {
super()
}
this.bulkUserActions = [
[
{
- label: this.i18n('Delete'),
- description: this.i18n('Videos will be deleted, comments will be tombstoned.'),
+ label: $localize`Delete`,
+ description: $localize`Videos will be deleted, comments will be tombstoned.`,
handler: users => this.removeUsers(users),
isDisplayed: users => users.every(u => this.authUser.canManage(u))
},
{
- label: this.i18n('Ban'),
- description: this.i18n('User won\'t be able to login anymore, but videos and comments will be kept as is.'),
+ label: $localize`Ban`,
+ description: $localize`User won't be able to login anymore, but videos and comments will be kept as is.`,
handler: users => this.openBanUserModal(users),
isDisplayed: users => users.every(u => this.authUser.canManage(u) && u.blocked === false)
},
{
- label: this.i18n('Unban'),
+ label: $localize`Unban`,
handler: users => this.unbanUsers(users),
isDisplayed: users => users.every(u => this.authUser.canManage(u) && u.blocked === true)
}
],
[
{
- label: this.i18n('Set Email as Verified'),
+ label: $localize`Set Email as Verified`,
handler: users => this.setEmailsAsVerified(users),
isDisplayed: users => {
return this.requiresEmailVerification &&
openBanUserModal (users: User[]) {
for (const user of users) {
if (user.username === 'root') {
- this.notifier.error(this.i18n('You cannot ban root.'))
+ this.notifier.error($localize`You cannot ban root.`)
return
}
}
}
async unbanUsers (users: User[]) {
- const message = this.i18n('Do you really want to unban {{num}} users?', { num: users.length })
-
- const res = await this.confirmService.confirm(message, this.i18n('Unban'))
+ const res = await this.confirmService.confirm($localize`Do you really want to unban ${users.length} users?`, $localize`Unban`)
if (res === false) return
this.userService.unbanUsers(users)
.subscribe(
() => {
- const message = this.i18n('{{num}} users unbanned.', { num: users.length })
-
- this.notifier.success(message)
+ this.notifier.success($localize`${users.length} users unbanned.`)
this.loadData()
},
async removeUsers (users: User[]) {
for (const user of users) {
if (user.username === 'root') {
- this.notifier.error(this.i18n('You cannot delete root.'))
+ this.notifier.error($localize`You cannot delete root.`)
return
}
}
- const message = this.i18n('If you remove these users, you will not be able to create others with the same username!')
- const res = await this.confirmService.confirm(message, this.i18n('Delete'))
+ const message = $localize`If you remove these users, you will not be able to create others with the same username!`
+ const res = await this.confirmService.confirm(message, $localize`Delete`)
if (res === false) return
this.userService.removeUser(users).subscribe(
() => {
- this.notifier.success(this.i18n('{{num}} users deleted.', { num: users.length }))
+ this.notifier.success($localize`${users.length} users deleted.`)
this.loadData()
},
async setEmailsAsVerified (users: User[]) {
this.userService.updateUsers(users, { emailVerified: true }).subscribe(
() => {
- this.notifier.success(this.i18n('{{num}} users email set as verified.', { num: users.length }))
+ this.notifier.success($localize`${users.length} users email set as verified.`)
this.loadData()
},
import { HooksService } from '@app/core/plugins/hooks.service'
import { FormReactive, FormValidatorService, LoginValidatorsService } from '@app/shared/shared-forms'
import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { RegisteredExternalAuthConfig, ServerConfig } from '@shared/models'
@Component({
private userService: UserService,
private redirectService: RedirectService,
private notifier: Notifier,
- private hooks: HooksService,
- private i18n: I18n
- ) {
+ private hooks: HooksService
+ ) {
super()
}
this.userService.askResetPassword(this.forgotPasswordEmail)
.subscribe(
() => {
- const message = this.i18n(
- 'An email with the reset password instructions will be sent to {{email}}. The link will expire within 1 hour.',
- { email: this.forgotPasswordEmail }
- )
+ const message = $localize`An email with the reset password instructions will be sent to ${this.forgotPasswordEmail}.
+The link will expire within 1 hour.`
+
this.notifier.success(message)
this.hideForgotPasswordModal()
},
}
private handleError (err: any) {
- if (err.message.indexOf('credentials are invalid') !== -1) this.error = this.i18n('Incorrect username or password.')
- else if (err.message.indexOf('blocked') !== -1) this.error = this.i18n('Your account is blocked.')
+ if (err.message.indexOf('credentials are invalid') !== -1) this.error = $localize`Incorrect username or password.`
+ else if (err.message.indexOf('blocked') !== -1) this.error = $localize`Your account is blocked.`
else this.error = err.message
}
}
import { AuthService, Notifier } from '@app/core'
import { FormValidatorService, VideoChannelValidatorsService } from '@app/shared/shared-forms'
import { VideoChannelService } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoChannelCreate } from '@shared/models'
import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit'
private videoChannelValidatorsService: VideoChannelValidatorsService,
private notifier: Notifier,
private router: Router,
- private videoChannelService: VideoChannelService,
- private i18n: I18n
- ) {
+ private videoChannelService: VideoChannelService
+ ) {
super()
}
() => {
this.authService.refreshUserInformation()
- this.notifier.success(
- this.i18n('Video channel {{videoChannelName}} created.', { videoChannelName: videoChannelCreate.displayName })
- )
+ this.notifier.success($localize`Video channel ${videoChannelCreate.displayName} created.`)
this.router.navigate([ '/my-account', 'video-channels' ])
},
err => {
if (err.status === 409) {
- this.error = this.i18n('This name already exists on this instance.')
+ this.error = $localize`This name already exists on this instance.`
return
}
}
getFormButtonTitle () {
- return this.i18n('Create')
+ return $localize`Create`
}
}
import { AuthService, Notifier, ServerService } from '@app/core'
import { FormValidatorService, VideoChannelValidatorsService } from '@app/shared/shared-forms'
import { VideoChannel, VideoChannelService } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig, VideoChannelUpdate } from '@shared/models'
import { MyAccountVideoChannelEdit } from './my-account-video-channel-edit'
private router: Router,
private route: ActivatedRoute,
private videoChannelService: VideoChannelService,
- private i18n: I18n,
private serverService: ServerService
) {
super()
() => {
this.authService.refreshUserInformation()
- this.notifier.success(
- this.i18n('Video channel {{videoChannelName}} updated.', { videoChannelName: videoChannelUpdate.displayName })
- )
+ this.notifier.success($localize`Video channel ${videoChannelUpdate.displayName} updated.`)
this.router.navigate([ '/my-account', 'video-channels' ])
},
this.videoChannelService.changeVideoChannelAvatar(this.videoChannelToUpdate.name, formData)
.subscribe(
data => {
- this.notifier.success(this.i18n('Avatar changed.'))
+ this.notifier.success($localize`Avatar changed.`)
this.videoChannelToUpdate.updateAvatar(data.avatar)
},
}
getFormButtonTitle () {
- return this.i18n('Update')
+ return $localize`Update`
}
isBulkUpdateVideosDisplayed () {
import { ChartData } from 'chart.js'
import { max, maxBy, min, minBy } from 'lodash-es'
-import { flatMap, debounceTime } from 'rxjs/operators'
+import { Subject } from 'rxjs'
+import { debounceTime, mergeMap } from 'rxjs/operators'
import { Component, OnInit } from '@angular/core'
import { AuthService, ConfirmService, Notifier, ScreenService, User } from '@app/core'
import { VideoChannel, VideoChannelService } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { Subject } from 'rxjs'
@Component({
selector: 'my-account-video-channels',
private notifier: Notifier,
private confirmService: ConfirmService,
private videoChannelService: VideoChannelService,
- private screenService: ScreenService,
- private i18n: I18n
- ) {}
+ private screenService: ScreenService
+ ) {}
ngOnInit () {
this.user = this.authService.getUser()
async deleteVideoChannel (videoChannel: VideoChannel) {
const res = await this.confirmService.confirmWithInput(
- this.i18n(
- // tslint:disable
- 'Do you really want to delete {{channelDisplayName}}? It will delete {{videosCount}} videos uploaded in this channel, and you will not be able to create another channel with the same name ({{channelName}})!',
- { channelDisplayName: videoChannel.displayName, videosCount: videoChannel.videosCount, channelName: videoChannel.name }
- ),
- this.i18n(
- 'Please type the display name of the video channel ({{displayName}}) to confirm',
- { displayName: videoChannel.displayName }
- ),
- videoChannel.displayName,
- this.i18n('Delete')
+ $localize`Do you really want to delete ${videoChannel.displayName}?
+It will delete ${videoChannel.videosCount} videos uploaded in this channel, and you will not be able to create another
+channel with the same name (${videoChannel.name})!`,
+
+ $localize`Please type the display name of the video channel (${videoChannel.displayName}) to confirm`,
+
+ $localize`Delete`
)
if (res === false) return
.subscribe(
() => {
this.loadVideoChannels()
- this.notifier.success(
- this.i18n('Video channel {{videoChannelName}} deleted.', { videoChannelName: videoChannel.displayName })
- )
+ this.notifier.success($localize`Video channel ${videoChannel.displayName} deleted.`)
},
error => this.notifier.error(error.message)
private loadVideoChannels () {
this.authService.userInformationLoaded
- .pipe(flatMap(() => this.videoChannelService.listAccountVideoChannels(this.user.account, null, true, this.channelsSearch)))
+ .pipe(mergeMap(() => this.videoChannelService.listAccountVideoChannels(this.user.account, null, true, this.channelsSearch)))
.subscribe(res => {
this.videoChannels = res.data
this.totalItems = res.total
labels: v.viewsPerDay.map(day => day.date.toLocaleDateString()),
datasets: [
{
- label: this.i18n('Views for the day'),
- data: v.viewsPerDay.map(day => day.views),
- fill: false,
- borderColor: "#c6c6c6"
+ label: $localize`Views for the day`,
+ data: v.viewsPerDay.map(day => day.views),
+ fill: false,
+ borderColor: '#c6c6c6'
}
]
} as ChartData))
// chart options that depend on chart data:
// we don't want to skew values and have min at 0, so we define what the floor/ceiling is here
this.videoChannelsMinimumDailyViews = min(
- this.videoChannels.map(v => minBy( // compute local minimum daily views for each channel, by their "views" attribute
+ // compute local minimum daily views for each channel, by their "views" attribute
+ this.videoChannels.map(v => minBy(
v.viewsPerDay,
day => day.views
).views) // the object returned is a ViewPerDate, so we still need to get the views attribute
)
this.videoChannelsMaximumDailyViews = max(
- this.videoChannels.map(v => maxBy( // compute local maximum daily views for each channel, by their "views" attribute
+ // compute local maximum daily views for each channel, by their "views" attribute
+ this.videoChannels.map(v => maxBy(
v.viewsPerDay,
day => day.views
).views) // the object returned is a ViewPerDate, so we still need to get the views attribute
import { immutableAssign } from '@app/helpers'
import { UserHistoryService } from '@app/shared/shared-main'
import { AbstractVideoList } from '@app/shared/shared-video-miniature'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-account-history',
videosHistoryEnabled: boolean
constructor (
- protected i18n: I18n,
protected router: Router,
protected serverService: ServerService,
protected route: ActivatedRoute,
) {
super()
- this.titlePage = this.i18n('My videos history')
+ this.titlePage = $localize`My videos history`
}
ngOnInit () {
.subscribe(
() => {
const message = this.videosHistoryEnabled === true ?
- this.i18n('Videos history is enabled') :
- this.i18n('Videos history is disabled')
+ $localize`Videos history is enabled` :
+ $localize`Videos history is disabled`
this.notifier.success(message)
}
async deleteHistory () {
- const title = this.i18n('Delete videos history')
- const message = this.i18n('Are you sure you want to delete all your videos history?')
+ const title = $localize`Delete videos history`
+ const message = $localize`Are you sure you want to delete all your videos history?`
const res = await this.confirmService.confirm(message, title)
if (res !== true) return
this.userHistoryService.deleteUserVideosHistory()
.subscribe(
() => {
- this.notifier.success(this.i18n('Videos history deleted'))
+ this.notifier.success($localize`Videos history deleted`)
this.reloadVideos()
},
import { FormReactive, FormValidatorService, VideoAcceptOwnershipValidatorsService } from '@app/shared/shared-forms'
import { VideoChannelService, VideoOwnershipService } from '@app/shared/shared-main'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoChangeOwnership, VideoChannel } from '@shared/models'
@Component({
private notifier: Notifier,
private authService: AuthService,
private videoChannelService: VideoChannelService,
- private modalService: NgbModal,
- private i18n: I18n
- ) {
+ private modalService: NgbModal
+ ) {
super()
}
.acceptOwnership(videoChangeOwnership.id, { channelId: channel })
.subscribe(
() => {
- this.notifier.success(this.i18n('Ownership accepted'))
+ this.notifier.success($localize`Ownership accepted`)
if (this.accepted) this.accepted.emit()
this.videoChangeOwnership = undefined
},
import { Component, OnInit } from '@angular/core'
import { AuthService, ServerService, UserService } from '@app/core'
import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { User } from '@shared/models'
@Component({
private userValidatorsService: UserValidatorsService,
private authService: AuthService,
private userService: UserService,
- private serverService: ServerService,
- private i18n: I18n
- ) {
+ private serverService: ServerService
+ ) {
super()
}
this.form.reset()
if (config.signup.requiresEmailVerification) {
- this.success = this.i18n('Please check your emails to verify your new email.')
+ this.success = $localize`Please check your emails to verify your new email.`
} else {
- this.success = this.i18n('Email updated.')
+ this.success = $localize`Email updated.`
}
},
err => {
if (err.status === 401) {
- this.error = this.i18n('You current password is invalid.')
+ this.error = $localize`You current password is invalid.`
return
}
import { Component, OnInit } from '@angular/core'
import { AuthService, Notifier, UserService } from '@app/core'
import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { User } from '@shared/models'
@Component({
private userValidatorsService: UserValidatorsService,
private notifier: Notifier,
private authService: AuthService,
- private userService: UserService,
- private i18n: I18n
- ) {
+ private userService: UserService
+ ) {
super()
}
this.userService.changePassword(currentPassword, newPassword).subscribe(
() => {
- this.notifier.success(this.i18n('Password updated.'))
+ this.notifier.success($localize`Password updated.`)
this.form.reset()
this.error = null
err => {
if (err.status === 401) {
- this.error = this.i18n('You current password is invalid.')
+ this.error = $localize`You current password is invalid.`
return
}
import { Component, Input } from '@angular/core'
import { AuthService, ConfirmService, Notifier, RedirectService, User, UserService } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-account-danger-zone',
private notifier: Notifier,
private userService: UserService,
private confirmService: ConfirmService,
- private redirectService: RedirectService,
- private i18n: I18n
- ) { }
+ private redirectService: RedirectService
+ ) { }
async deleteMe () {
const res = await this.confirmService.confirmWithInput(
- this.i18n('Are you sure you want to delete your account? This will delete all your data, including channels, videos and comments. Content cached by other servers and other third-parties might make longer to be deleted.'),
- this.i18n('Type your username to confirm'),
+ $localize`Are you sure you want to delete your account? This will delete all your data, including channels, videos and comments. Content cached by other servers and other third-parties might make longer to be deleted.`,
+ $localize`Type your username to confirm`,
this.user.username,
- this.i18n('Delete your account'),
- this.i18n('Delete my account')
+ $localize`Delete your account`,
+ $localize`Delete my account`
)
if (res === false) return
this.userService.deleteMe().subscribe(
() => {
- this.notifier.success(this.i18n('Your account is deleted.'))
+ this.notifier.success($localize`Your account is deleted.`)
this.authService.logout()
this.redirectService.redirectToHomepage()
import { Component, Input, OnInit } from '@angular/core'
import { Notifier, ServerService, User } from '@app/core'
import { UserNotificationService } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { UserNotificationSetting, UserNotificationSettingValue, UserRight } from '@shared/models'
@Component({
private savePreferences = debounce(this.savePreferencesImpl.bind(this), 500)
constructor (
- private i18n: I18n,
private userNotificationService: UserNotificationService,
private serverService: ServerService,
private notifier: Notifier
) {
this.labelNotifications = {
- newVideoFromSubscription: this.i18n('New video from your subscriptions'),
- newCommentOnMyVideo: this.i18n('New comment on your video'),
- abuseAsModerator: this.i18n('New abuse'),
- videoAutoBlacklistAsModerator: this.i18n('Video blocked automatically waiting review'),
- blacklistOnMyVideo: this.i18n('One of your video is blocked/unblocked'),
- myVideoPublished: this.i18n('Video published (after transcoding/scheduled update)'),
- myVideoImportFinished: this.i18n('Video import finished'),
- newUserRegistration: this.i18n('A new user registered on your instance'),
- newFollow: this.i18n('You or your channel(s) has a new follower'),
- commentMention: this.i18n('Someone mentioned you in video comments'),
- newInstanceFollower: this.i18n('Your instance has a new follower'),
- autoInstanceFollowing: this.i18n('Your instance automatically followed another instance'),
- abuseNewMessage: this.i18n('An abuse report received a new message'),
- abuseStateChange: this.i18n('One of your abuse reports has been accepted or rejected by moderators')
+ newVideoFromSubscription: $localize`New video from your subscriptions`,
+ newCommentOnMyVideo: $localize`New comment on your video`,
+ abuseAsModerator: $localize`New abuse`,
+ videoAutoBlacklistAsModerator: $localize`Video blocked automatically waiting review`,
+ blacklistOnMyVideo: $localize`One of your video is blocked/unblocked`,
+ myVideoPublished: $localize`Video published (after transcoding/scheduled update)`,
+ myVideoImportFinished: $localize`Video import finished`,
+ newUserRegistration: $localize`A new user registered on your instance`,
+ newFollow: $localize`You or your channel(s) has a new follower`,
+ commentMention: $localize`Someone mentioned you in video comments`,
+ newInstanceFollower: $localize`Your instance has a new follower`,
+ autoInstanceFollowing: $localize`Your instance automatically followed another instance`,
+ abuseNewMessage: $localize`An abuse report received a new message`,
+ abuseStateChange: $localize`One of your abuse reports has been accepted or rejected by moderators`
}
this.notificationSettingKeys = Object.keys(this.labelNotifications) as (keyof UserNotificationSetting)[]
this.userNotificationService.updateNotificationSettings(this.user, this.user.notificationSettings)
.subscribe(
() => {
- this.notifier.success(this.i18n('Preferences saved'), undefined, 2000)
+ this.notifier.success($localize`Preferences saved`, undefined, 2000)
},
err => this.notifier.error(err.message)
import { Component, Input, OnInit } from '@angular/core'
import { Notifier, User, UserService } from '@app/core'
import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-account-profile',
protected formValidatorService: FormValidatorService,
private userValidatorsService: UserValidatorsService,
private notifier: Notifier,
- private userService: UserService,
- private i18n: I18n
- ) {
+ private userService: UserService
+ ) {
super()
}
this.user.account.displayName = displayName
this.user.account.description = description
- this.notifier.success(this.i18n('Profile updated.'))
+ this.notifier.success($localize`Profile updated.`)
},
err => this.error = err.message
import { ViewportScroller } from '@angular/common'
import { AfterViewChecked, Component, OnInit } from '@angular/core'
import { AuthService, Notifier, User, UserService } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-account-settings',
private viewportScroller: ViewportScroller,
private userService: UserService,
private authService: AuthService,
- private notifier: Notifier,
- private i18n: I18n
- ) {}
+ private notifier: Notifier
+ ) {}
get userInformationLoaded () {
return this.authService.userInformationLoaded
this.userService.changeAvatar(formData)
.subscribe(
data => {
- this.notifier.success(this.i18n('Avatar changed.'))
+ this.notifier.success($localize`Avatar changed.`)
this.user.updateAccountAvatar(data.avatar)
},
import { Component, OnInit } from '@angular/core'
import { Router } from '@angular/router'
import { AuthService, Notifier, ServerService } from '@app/core'
+import { populateAsyncUserVideoChannels } from '@app/helpers'
import { FormValidatorService, VideoPlaylistValidatorsService } from '@app/shared/shared-forms'
import { VideoPlaylistService } from '@app/shared/shared-video-playlist'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoPlaylistCreate } from '@shared/models/videos/playlist/video-playlist-create.model'
import { VideoPlaylistPrivacy } from '@shared/models/videos/playlist/video-playlist-privacy.model'
import { MyAccountVideoPlaylistEdit } from './my-account-video-playlist-edit'
-import { populateAsyncUserVideoChannels } from '@app/helpers'
@Component({
selector: 'my-account-video-playlist-create',
private notifier: Notifier,
private router: Router,
private videoPlaylistService: VideoPlaylistService,
- private serverService: ServerService,
- private i18n: I18n
- ) {
+ private serverService: ServerService
+ ) {
super()
}
this.videoPlaylistService.createVideoPlaylist(videoPlaylistCreate).subscribe(
() => {
- this.notifier.success(
- this.i18n('Playlist {{playlistName}} created.', { playlistName: videoPlaylistCreate.displayName })
- )
+ this.notifier.success($localize`Playlist ${videoPlaylistCreate.displayName} created.`)
this.router.navigate([ '/my-account', 'video-playlists' ])
},
}
getFormButtonTitle () {
- return this.i18n('Create')
+ return $localize`Create`
}
}
import { DropdownAction } from '@app/shared/shared-main'
import { VideoShareComponent } from '@app/shared/shared-share-modal'
import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoPlaylistType } from '@shared/models'
@Component({
constructor (
private notifier: Notifier,
- private i18n: I18n,
private router: Router,
private confirmService: ConfirmService,
private route: ActivatedRoute,
this.playlistActions = [
[
{
- label: this.i18n('Update playlist'),
+ label: $localize`Update playlist`,
iconName: 'edit',
linkBuilder: playlist => [ '/my-account', 'video-playlists', 'update', playlist.uuid ]
},
{
- label: this.i18n('Delete playlist'),
+ label: $localize`Delete playlist`,
iconName: 'delete',
handler: playlist => this.deleteVideoPlaylist(playlist)
}
async deleteVideoPlaylist (videoPlaylist: VideoPlaylist) {
const res = await this.confirmService.confirm(
- this.i18n(
- 'Do you really want to delete {{playlistDisplayName}}?',
- { playlistDisplayName: videoPlaylist.displayName }
- ),
- this.i18n('Delete')
+ $localize`Do you really want to delete ${videoPlaylist.displayName}?`,
+ $localize`Delete`
)
if (res === false) return
.subscribe(
() => {
this.router.navigate([ '/my-account', 'video-playlists' ])
-
- this.notifier.success(
- this.i18n('Playlist {{playlistDisplayName}} deleted.', { playlistDisplayName: videoPlaylist.displayName })
- )
+ this.notifier.success($localize`Playlist ${videoPlaylist.displayName} deleted.`)
},
error => this.notifier.error(error.message)
import { populateAsyncUserVideoChannels } from '@app/helpers'
import { FormValidatorService, VideoPlaylistValidatorsService } from '@app/shared/shared-forms'
import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoPlaylistUpdate } from '@shared/models'
import { MyAccountVideoPlaylistEdit } from './my-account-video-playlist-edit'
private router: Router,
private route: ActivatedRoute,
private videoPlaylistService: VideoPlaylistService,
- private i18n: I18n,
private serverService: ServerService
) {
super()
this.videoPlaylistService.updateVideoPlaylist(this.videoPlaylistToUpdate, videoPlaylistUpdate).subscribe(
() => {
- this.notifier.success(
- this.i18n('Playlist {{videoPlaylistName}} updated.', { videoPlaylistName: videoPlaylistUpdate.displayName })
- )
-
+ this.notifier.success($localize`Playlist ${videoPlaylistUpdate.displayName} updated.`)
this.router.navigate([ '/my-account', 'video-playlists' ])
},
}
getFormButtonTitle () {
- return this.i18n('Update')
+ return $localize`Update`
}
private hydrateFormFromPlaylist () {
import { Component, OnInit } from '@angular/core'
import { AuthService, ComponentPagination, ConfirmService, Notifier, User } from '@app/core'
import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoPlaylistType } from '@shared/models'
@Component({
private authService: AuthService,
private notifier: Notifier,
private confirmService: ConfirmService,
- private videoPlaylistService: VideoPlaylistService,
- private i18n: I18n
- ) {}
+ private videoPlaylistService: VideoPlaylistService
+ ) {}
ngOnInit () {
this.user = this.authService.getUser()
async deleteVideoPlaylist (videoPlaylist: VideoPlaylist) {
const res = await this.confirmService.confirm(
- this.i18n(
- 'Do you really want to delete {{playlistDisplayName}}?',
- { playlistDisplayName: videoPlaylist.displayName }
- ),
- this.i18n('Delete')
+ $localize`Do you really want to delete ${videoPlaylist.displayName}?`,
+ $localize`Delete`
)
if (res === false) return
this.videoPlaylists = this.videoPlaylists
.filter(p => p.id !== videoPlaylist.id)
- this.notifier.success(
- this.i18n('Playlist {{playlistDisplayName}} deleted.', { playlistDisplayName: videoPlaylist.displayName })
- )
+ this.notifier.success($localize`Playlist ${videoPlaylist.displayName}} deleted.`)
},
error => this.notifier.error(error.message)
import { immutableAssign } from '@app/helpers'
import { Video, VideoService } from '@app/shared/shared-main'
import { MiniatureDisplayOptions, OwnerDisplayType, SelectionType, VideosSelectionComponent } from '@app/shared/shared-video-miniature'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoSortField } from '@shared/models'
import { VideoChangeOwnershipComponent } from './video-change-ownership/video-change-ownership.component'
protected authService: AuthService,
protected notifier: Notifier,
protected screenService: ScreenService,
- private i18n: I18n,
private confirmService: ConfirmService,
private videoService: VideoService
) {
- this.titlePage = this.i18n('My videos')
+ this.titlePage = $localize`My videos`
}
ngOnInit () {
.map(k => parseInt(k, 10))
const res = await this.confirmService.confirm(
- this.i18n('Do you really want to delete {{deleteLength}} videos?', { deleteLength: toDeleteVideosIds.length }),
- this.i18n('Delete')
+ $localize`Do you really want to delete ${toDeleteVideosIds.length} videos?`,
+ $localize`Delete`
)
if (res === false) return
.pipe(toArray())
.subscribe(
() => {
- this.notifier.success(this.i18n('{{deleteLength}} videos deleted.', { deleteLength: toDeleteVideosIds.length }))
-
+ this.notifier.success($localize`${toDeleteVideosIds.length} videos deleted.`)
this.selection = {}
},
async deleteVideo (video: Video) {
const res = await this.confirmService.confirm(
- this.i18n('Do you really want to delete {{videoName}}?', { videoName: video.name }),
- this.i18n('Delete')
+ $localize`Do you really want to delete ${video.name}?`,
+ $localize`Delete`
)
if (res === false) return
this.videoService.removeVideo(video.id)
.subscribe(
() => {
- this.notifier.success(this.i18n('Video {{videoName}} deleted.', { videoName: video.name }))
+ this.notifier.success($localize`Video ${video.name} deleted.`)
this.removeVideoFromArray(video.id)
},
import { FormReactive, FormValidatorService, VideoChangeOwnershipValidatorsService } from '@app/shared/shared-forms'
import { Video, VideoOwnershipService } from '@app/shared/shared-main'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-video-change-ownership',
private videoOwnershipService: VideoOwnershipService,
private notifier: Notifier,
private userService: UserService,
- private modalService: NgbModal,
- private i18n: I18n
- ) {
+ private modalService: NgbModal
+ ) {
super()
}
this.videoOwnershipService
.changeOwnership(this.video.id, username)
.subscribe(
- () => this.notifier.success(this.i18n('Ownership change request sent.')),
+ () => this.notifier.success($localize`Ownership change request sent.`),
err => this.notifier.error(err.message)
)
import { Component, OnInit } from '@angular/core'
-import { AuthService, ScreenService, ServerService, AuthUser } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
+import { AuthService, AuthUser, ScreenService, ServerService } from '@app/core'
import { ServerConfig } from '@shared/models'
import { TopMenuDropdownParam } from '../shared/shared-main/misc/top-menu-dropdown.component'
constructor (
private serverService: ServerService,
private authService: AuthService,
- private screenService: ScreenService,
- private i18n: I18n
- ) { }
+ private screenService: ScreenService
+ ) { }
get isBroadcastMessageDisplayed () {
return this.screenService.isBroadcastMessageDisplayed
private buildMenu () {
const libraryEntries: TopMenuDropdownParam = {
- label: this.i18n('My library'),
+ label: $localize`My library`,
children: [
{
- label: this.i18n('My channels'),
+ label: $localize`My channels`,
routerLink: '/my-account/video-channels',
iconName: 'channel'
},
{
- label: this.i18n('My videos'),
+ label: $localize`My videos`,
routerLink: '/my-account/videos',
iconName: 'videos',
isDisplayed: () => this.user.canSeeVideosLink
},
{
- label: this.i18n('My playlists'),
+ label: $localize`My playlists`,
routerLink: '/my-account/video-playlists',
iconName: 'playlists'
},
{
- label: this.i18n('My subscriptions'),
+ label: $localize`My subscriptions`,
routerLink: '/my-account/subscriptions',
iconName: 'subscriptions'
},
{
- label: this.i18n('My history'),
+ label: $localize`My history`,
routerLink: '/my-account/history/videos',
iconName: 'history'
}
}
const miscEntries: TopMenuDropdownParam = {
- label: this.i18n('Misc'),
+ label: $localize`Misc`,
children: [
{
- label: this.i18n('Muted accounts'),
+ label: $localize`Muted accounts`,
routerLink: '/my-account/blocklist/accounts',
iconName: 'user-x'
},
{
- label: this.i18n('Muted servers'),
+ label: $localize`Muted servers`,
routerLink: '/my-account/blocklist/servers',
iconName: 'peertube-x'
},
{
- label: this.i18n('My abuse reports'),
+ label: $localize`My abuse reports`,
routerLink: '/my-account/abuses',
iconName: 'flag'
},
{
- label: this.i18n('Ownership changes'),
+ label: $localize`Ownership changes`,
routerLink: '/my-account/ownership',
iconName: 'download'
}
this.menuEntries = [
{
- label: this.i18n('My settings'),
+ label: $localize`My settings`,
routerLink: '/my-account/settings'
},
{
- label: this.i18n('My notifications'),
+ label: $localize`My notifications`,
routerLink: '/my-account/notifications'
},
libraryEntries,
import { ActivatedRoute, Router } from '@angular/router'
import { Notifier, UserService } from '@app/core'
import { FormReactive, FormValidatorService, ResetPasswordValidatorsService, UserValidatorsService } from '@app/shared/shared-forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-login',
private userService: UserService,
private notifier: Notifier,
private router: Router,
- private route: ActivatedRoute,
- private i18n: I18n
- ) {
+ private route: ActivatedRoute
+ ) {
super()
}
this.verificationString = this.route.snapshot.queryParams['verificationString']
if (!this.userId || !this.verificationString) {
- this.notifier.error(this.i18n('Unable to find user id or verification string.'))
+ this.notifier.error($localize`Unable to find user id or verification string.`)
this.router.navigate([ '/' ])
}
}
this.userService.resetPassword(this.userId, this.verificationString, this.form.value.password)
.subscribe(
() => {
- this.notifier.success(this.i18n('Your password has been successfully reset!'))
+ this.notifier.success($localize`Your password has been successfully reset!`)
this.router.navigate([ '/login' ])
},
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'
import { ServerService } from '@app/core'
-import { VideoValidatorsService } from '@app/shared/shared-forms'
import { AdvancedSearch } from '@app/shared/shared-search'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig, VideoConstant } from '@shared/models'
@Component({
private serverConfig: ServerConfig
constructor (
- private i18n: I18n,
- private videoValidatorsService: VideoValidatorsService,
private serverService: ServerService
) {
this.publishedDateRanges = [
{
id: 'any_published_date',
- label: this.i18n('Any')
+ label: $localize`Any`
},
{
id: 'today',
- label: this.i18n('Today')
+ label: $localize`Today`
},
{
id: 'last_7days',
- label: this.i18n('Last 7 days')
+ label: $localize`Last 7 days`
},
{
id: 'last_30days',
- label: this.i18n('Last 30 days')
+ label: $localize`Last 30 days`
},
{
id: 'last_365days',
- label: this.i18n('Last 365 days')
+ label: $localize`Last 365 days`
}
]
this.durationRanges = [
{
id: 'any_duration',
- label: this.i18n('Any')
+ label: $localize`Any`
},
{
id: 'short',
- label: this.i18n('Short (< 4 min)')
+ label: $localize`Short (< 4 min)`
},
{
id: 'medium',
- label: this.i18n('Medium (4-10 min)')
+ label: $localize`Medium (4-10 min)`
},
{
id: 'long',
- label: this.i18n('Long (> 10 min)')
+ label: $localize`Long (> 10 min)`
}
]
this.sorts = [
{
id: '-match',
- label: this.i18n('Relevance')
+ label: $localize`Relevance`
},
{
id: '-publishedAt',
- label: this.i18n('Publish date')
+ label: $localize`Publish date`
},
{
id: '-views',
- label: this.i18n('Views')
+ label: $localize`Views`
}
]
}
import { AdvancedSearch, SearchService } from '@app/shared/shared-search'
import { MiniatureDisplayOptions, VideoLinkType } from '@app/shared/shared-video-miniature'
import { MetaService } from '@ngx-meta/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { SearchTargetType, ServerConfig } from '@shared/models'
@Component({
private lastSearchTarget: SearchTargetType
constructor (
- private i18n: I18n,
private route: ActivatedRoute,
private router: Router,
private metaService: MetaService,
}
this.notifier.error(
- this.i18n('Search index is unavailable. Retrying with instance results instead.'),
- this.i18n('Search error')
+ $localize`Search index is unavailable. Retrying with instance results instead.`,
+ $localize`Search error`
)
this.advancedSearch.searchTarget = 'local'
this.search()
private updateTitle () {
const suffix = this.currentSearch ? ' ' + this.currentSearch : ''
- this.metaService.setTitle(this.i18n('Search') + suffix)
+ this.metaService.setTitle($localize`Search` + suffix)
}
private updateUrlFromAdvancedSearch () {
import { HooksService } from '@app/core/plugins/hooks.service'
import { InstanceService } from '@app/shared/shared-instance'
import { NgbAccordion } from '@ng-bootstrap/ng-bootstrap'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { UserRegister } from '@shared/models'
import { About, ServerConfig } from '@shared/models/server'
private notifier: Notifier,
private userService: UserService,
private instanceService: InstanceService,
- private hooks: HooksService,
- private i18n: I18n
- ) {
+ private hooks: HooksService
+ ) {
}
get requiresEmailVerification () {
this.signupDone = true
if (this.requiresEmailVerification) {
- this.info = this.i18n('Now please check your emails to verify your account and complete signup.')
+ this.info = $localize`Now please check your emails to verify your account and complete signup.`
return
}
this.authService.login(body.username, body.password)
.subscribe(
() => {
- this.success = this.i18n('You are now logged in as {{username}}!', { username: body.username })
+ this.success = $localize`You are now logged in as ${body.username}!`
},
err => this.error = err.message
import { Component, OnInit } from '@angular/core'
import { Notifier, RedirectService, ServerService, UserService } from '@app/core'
import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig } from '@shared/models'
@Component({
private userService: UserService,
private serverService: ServerService,
private notifier: Notifier,
- private redirectService: RedirectService,
- private i18n: I18n
- ) {
+ private redirectService: RedirectService
+ ) {
super()
}
this.userService.askSendVerifyEmail(email)
.subscribe(
() => {
- const message = this.i18n(
- 'An email with verification link will be sent to {{email}}.',
- { email }
- )
- this.notifier.success(message)
+ this.notifier.success($localize`An email with verification link will be sent to ${email}.`)
this.redirectService.redirectToHomepage()
},
import { Component, OnInit } from '@angular/core'
import { ActivatedRoute } from '@angular/router'
import { AuthService, Notifier, UserService } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-verify-account-email',
private userService: UserService,
private authService: AuthService,
private notifier: Notifier,
- private route: ActivatedRoute,
- private i18n: I18n
- ) {
+ private route: ActivatedRoute
+ ) {
}
ngOnInit () {
this.isPendingEmail = queryParams['isPendingEmail'] === 'true'
if (!this.userId || !this.verificationString) {
- this.notifier.error(this.i18n('Unable to find user id or verification string.'))
+ this.notifier.error($localize`Unable to find user id or verification string.`)
} else {
this.verifyEmail()
}
import { Component, OnDestroy, OnInit } from '@angular/core'
import { MarkdownService } from '@app/core'
import { VideoChannel, VideoChannelService } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-video-channel-about',
private videoChannelSub: Subscription
constructor (
- private i18n: I18n,
private videoChannelService: VideoChannelService,
private markdownService: MarkdownService
) { }
getVideoChannelDescription () {
if (this.descriptionHTML) return this.descriptionHTML
- return this.i18n('No description')
+ return $localize`No description`
}
}
import { immutableAssign } from '@app/helpers'
import { VideoChannel, VideoChannelService, VideoService } from '@app/shared/shared-main'
import { AbstractVideoList } from '@app/shared/shared-video-miniature'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-video-channel-videos',
private videoChannelSub: Subscription
constructor (
- protected i18n: I18n,
protected router: Router,
protected serverService: ServerService,
protected route: ActivatedRoute,
) {
super()
- this.titlePage = this.i18n('Published videos')
+ this.titlePage = $localize`Published videos`
this.displayOptions = {
...this.displayOptions,
avatar: false
.getVideoChannelVideos(this.videoChannel, newPagination, this.sort, this.nsfwPolicy)
.pipe(
tap(({ total }) => {
- this.titlePage = this.i18n(`{total, plural, =1 {Published 1 video} other {Published {{total}} videos}}`, { total })
+ this.titlePage = total === 1
+ ? $localize`Published 1 video`
+ : $localize`Published ${total} videos`
})
)
}
import { AuthService, Notifier, RestExtractor, ScreenService } from '@app/core'
import { ListOverflowItem, VideoChannel, VideoChannelService } from '@app/shared/shared-main'
import { SubscribeButtonComponent } from '@app/shared/shared-user-subscription'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
templateUrl: './video-channels.component.html',
private routeSub: Subscription
constructor (
- private i18n: I18n,
private route: ActivatedRoute,
private notifier: Notifier,
private authService: AuthService,
this.subscribeButton.unsubscribe() :
this.subscribeButton.subscribe()
return false
- }, undefined, this.i18n('Subscribe to the account'))
+ }, undefined, $localize`Subscribe to the account`)
]
if (this.isUserLoggedIn()) this.hotkeysService.add(this.hotkeys)
this.links = [
- { label: this.i18n('VIDEOS'), routerLink: 'videos' },
- { label: this.i18n('VIDEO PLAYLISTS'), routerLink: 'video-playlists' },
- { label: this.i18n('ABOUT'), routerLink: 'about' }
+ { label: $localize`VIDEOS`, routerLink: 'videos' },
+ { label: $localize`VIDEO PLAYLISTS`, routerLink: 'video-playlists' },
+ { label: $localize`ABOUT`, routerLink: 'about' }
]
}
}
activateCopiedMessage () {
- this.notifier.success(this.i18n('Username copied'))
+ this.notifier.success($localize`Username copied`)
}
}
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { Injectable } from '@angular/core'
@Injectable()
export class I18nPrimengCalendarService {
private readonly calendarLocale: any = {}
- constructor (private i18n: I18n) {
+ constructor () {
this.calendarLocale = {
firstDayOfWeek: 0,
dayNames: [
- this.i18n('Sunday'),
- this.i18n('Monday'),
- this.i18n('Tuesday'),
- this.i18n('Wednesday'),
- this.i18n('Thursday'),
- this.i18n('Friday'),
- this.i18n('Saturday')
+ $localize`Sunday`,
+ $localize`Monday`,
+ $localize`Tuesday`,
+ $localize`Wednesday`,
+ $localize`Thursday`,
+ $localize`Friday`,
+ $localize`Saturday`
],
dayNamesShort: [
- this.i18n({ value: 'Sun', description: 'Day name short' }),
- this.i18n({ value: 'Mon', description: 'Day name short' }),
- this.i18n({ value: 'Tue', description: 'Day name short' }),
- this.i18n({ value: 'Wed', description: 'Day name short' }),
- this.i18n({ value: 'Thu', description: 'Day name short' }),
- this.i18n({ value: 'Fri', description: 'Day name short' }),
- this.i18n({ value: 'Sat', description: 'Day name short' })
+ $localize`:Day name short:Sun`,
+ $localize`:Day name short:Mon`,
+ $localize`:Day name short:Tue`,
+ $localize`:Day name short:Wed`,
+ $localize`:Day name short:Thu`,
+ $localize`:Day name short:Fri`,
+ $localize`:Day name short:Sat`
],
dayNamesMin: [
- this.i18n({ value: 'Su', description: 'Day name min' }),
- this.i18n({ value: 'Mo', description: 'Day name min' }),
- this.i18n({ value: 'Tu', description: 'Day name min' }),
- this.i18n({ value: 'We', description: 'Day name min' }),
- this.i18n({ value: 'Th', description: 'Day name min' }),
- this.i18n({ value: 'Fr', description: 'Day name min' }),
- this.i18n({ value: 'Sa', description: 'Day name min' })
+ $localize`:Day name min:Su`,
+ $localize`:Day name min:Mo`,
+ $localize`:Day name min:Tu`,
+ $localize`:Day name min:We`,
+ $localize`:Day name min:Th`,
+ $localize`:Day name min:Fr`,
+ $localize`:Day name min:Sa`
],
monthNames: [
- this.i18n('January'),
- this.i18n('February'),
- this.i18n('March'),
- this.i18n('April'),
- this.i18n('May'),
- this.i18n('June'),
- this.i18n('July'),
- this.i18n('August'),
- this.i18n('September'),
- this.i18n('October'),
- this.i18n('November'),
- this.i18n('December')
+ $localize`January`,
+ $localize`February`,
+ $localize`March`,
+ $localize`April`,
+ $localize`May`,
+ $localize`June`,
+ $localize`July`,
+ $localize`August`,
+ $localize`September`,
+ $localize`October`,
+ $localize`November`,
+ $localize`December`
],
monthNamesShort: [
- this.i18n({ value: 'Jan', description: 'Month name short' }),
- this.i18n({ value: 'Feb', description: 'Month name short' }),
- this.i18n({ value: 'Mar', description: 'Month name short' }),
- this.i18n({ value: 'Apr', description: 'Month name short' }),
- this.i18n({ value: 'May', description: 'Month name short' }),
- this.i18n({ value: 'Jun', description: 'Month name short' }),
- this.i18n({ value: 'Jul', description: 'Month name short' }),
- this.i18n({ value: 'Aug', description: 'Month name short' }),
- this.i18n({ value: 'Sep', description: 'Month name short' }),
- this.i18n({ value: 'Oct', description: 'Month name short' }),
- this.i18n({ value: 'Nov', description: 'Month name short' }),
- this.i18n({ value: 'Dec', description: 'Month name short' })
+ $localize`:Month name short:Jan`,
+ $localize`:Month name short:Feb`,
+ $localize`:Month name short:Mar`,
+ $localize`:Month name short:Apr`,
+ $localize`:Month name short:May`,
+ $localize`:Month name short:Jun`,
+ $localize`:Month name short:Jul`,
+ $localize`:Month name short:Aug`,
+ $localize`:Month name short:Sep`,
+ $localize`:Month name short:Oct`,
+ $localize`:Month name short:Nov`,
+ $localize`:Month name short:Dec`
],
- today: this.i18n('Today'),
+ today: $localize`Today`,
- clear: this.i18n('Clear')
+ clear: $localize`Clear`
}
}
}
getDateFormat () {
- return this.i18n({
- value: 'yy-mm-dd ',
- description: 'Date format in this locale.'
- })
+ return $localize`:Date format in this locale.:yy-mm-dd`
}
}
import { FormReactiveValidationMessages, FormValidatorService, SelectChannelItem, VideoValidatorsService } from '@app/shared/shared-forms'
import { InstanceService } from '@app/shared/shared-instance'
import { VideoCaptionEdit, VideoEdit, VideoService } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig, VideoConstant, VideoPrivacy } from '@shared/models'
import { I18nPrimengCalendarService } from './i18n-primeng-calendar.service'
import { VideoCaptionAddModalComponent } from './video-caption-add-modal.component'
private serverService: ServerService,
private instanceService: InstanceService,
private i18nPrimengCalendarService: I18nPrimengCalendarService,
- private i18n: I18n,
private ngZone: NgZone
) {
this.calendarLocale = this.i18nPrimengCalendarService.getCalendarLocale()
.subscribe(res => {
this.videoLanguages = res.languages
.map(l => res.about.instance.languages.includes(l.id)
- ? { ...l, group: this.i18n('Instance languages'), groupOrder: 0 }
- : { ...l, group: this.i18n('All languages'), groupOrder: 1 })
+ ? { ...l, group: $localize`Instance languages`, groupOrder: 0 }
+ : { ...l, group: $localize`All languages`, groupOrder: 1 })
.sort((a, b) => a.groupOrder - b.groupOrder)
})
if (this.schedulePublicationPossible) {
this.videoPrivacies.push({
id: this.SPECIAL_SCHEDULED_PRIVACY,
- label: this.i18n('Scheduled'),
- description: this.i18n('Hide the video until a specific date')
+ label: $localize`Scheduled`,
+ description: $localize`Hide the video until a specific date`
})
}
})
import { scrollToTop } from '@app/helpers'
import { FormValidatorService } from '@app/shared/shared-forms'
import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
-import { VideoSend } from './video-send'
import { LoadingBarService } from '@ngx-loading-bar/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoPrivacy, VideoUpdate } from '@shared/models'
+import { VideoSend } from './video-send'
@Component({
selector: 'my-video-import-torrent',
protected videoService: VideoService,
protected videoCaptionService: VideoCaptionService,
private router: Router,
- private videoImportService: VideoImportService,
- private i18n: I18n
- ) {
+ private videoImportService: VideoImportService
+ ) {
super()
}
.subscribe(
() => {
this.isUpdatingVideo = false
- this.notifier.success(this.i18n('Video to import updated.'))
+ this.notifier.success($localize`Video to import updated.`)
this.router.navigate([ '/my-account', 'video-imports' ])
},
import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers'
import { FormValidatorService } from '@app/shared/shared-forms'
import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main'
-import { VideoSend } from './video-send'
import { LoadingBarService } from '@ngx-loading-bar/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoPrivacy, VideoUpdate } from '@shared/models'
+import { VideoSend } from './video-send'
@Component({
selector: 'my-video-import-url',
protected videoService: VideoService,
protected videoCaptionService: VideoCaptionService,
private router: Router,
- private videoImportService: VideoImportService,
- private i18n: I18n
- ) {
+ private videoImportService: VideoImportService
+ ) {
super()
}
.subscribe(
() => {
this.isUpdatingVideo = false
- this.notifier.success(this.i18n('Video to import updated.'))
+ this.notifier.success($localize`Video to import updated.`)
this.router.navigate([ '/my-account', 'video-imports' ])
},
import { FormValidatorService } from '@app/shared/shared-forms'
import { BytesPipe, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main'
import { LoadingBarService } from '@ngx-loading-bar/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoPrivacy } from '@shared/models'
import { VideoSend } from './video-send'
protected videoService: VideoService,
protected videoCaptionService: VideoCaptionService,
private userService: UserService,
- private router: Router,
- private i18n: I18n
- ) {
+ private router: Router
+ ) {
super()
}
if (this.videoUploaded === true) {
// FIXME: cannot concatenate strings inside i18n service :/
- text = this.i18n('Your video was uploaded to your account and is private.') + ' ' +
- this.i18n('But associated data (tags, description...) will be lost, are you sure you want to leave this page?')
+ text = $localize`Your video was uploaded to your account and is private.` + ' ' +
+ $localize`But associated data (tags, description...) will be lost, are you sure you want to leave this page?`
} else {
- text = this.i18n('Your video is not uploaded yet, are you sure you want to leave this page?')
+ text = $localize`Your video is not uploaded yet, are you sure you want to leave this page?`
}
return {
getAudioUploadLabel () {
const videofile = this.getVideoFile()
- if (!videofile) return this.i18n('Upload')
+ if (!videofile) return $localize`Upload`
- return this.i18n('Upload {{videofileName}}', { videofileName: videofile.name })
+ return $localize`Upload ${videofile.name}`
}
fileChange () {
this.firstStepError.emit()
- this.notifier.info(this.i18n('Upload cancelled'))
+ this.notifier.info($localize`Upload cancelled`)
}
}
this.isUpdatingVideo = false
this.isUploadingVideo = false
- this.notifier.success(this.i18n('Video published.'))
+ this.notifier.success($localize`Video published.`)
this.router.navigate([ '/videos/watch', video.uuid ])
},
// Check global user quota
const videoQuota = this.authService.getUser().videoQuota
if (videoQuota !== -1 && (this.userVideoQuotaUsed + videofile.size) > videoQuota) {
- const msg = this.i18n(
- 'Your video quota is exceeded with this video (video size: {{videoSize}}, used: {{videoQuotaUsed}}, quota: {{videoQuota}})',
- {
- videoSize: bytePipes.transform(videofile.size, 0),
- videoQuotaUsed: bytePipes.transform(this.userVideoQuotaUsed, 0),
- videoQuota: bytePipes.transform(videoQuota, 0)
- }
- )
+ const videoSizeBytes = bytePipes.transform(videofile.size, 0)
+ const videoQuotaUsedBytes = bytePipes.transform(this.userVideoQuotaUsed, 0)
+ const videoQuotaBytes = bytePipes.transform(videoQuota, 0)
+
+ const msg = $localize`Your video quota is exceeded with this video (
+video size: ${videoSizeBytes}, used: ${videoQuotaUsedBytes}, quota: ${videoQuotaBytes})`
this.notifier.error(msg)
return false
// Check daily user quota
const videoQuotaDaily = this.authService.getUser().videoQuotaDaily
if (videoQuotaDaily !== -1 && (this.userVideoQuotaUsedDaily + videofile.size) > videoQuotaDaily) {
- const msg = this.i18n(
- 'Your daily video quota is exceeded with this video (video size: {{videoSize}}, used: {{quotaUsedDaily}}, quota: {{quotaDaily}})',
- {
- videoSize: bytePipes.transform(videofile.size, 0),
- quotaUsedDaily: bytePipes.transform(this.userVideoQuotaUsedDaily, 0),
- quotaDaily: bytePipes.transform(videoQuotaDaily, 0)
- }
- )
+ const videoSizeBytes = bytePipes.transform(videofile.size, 0)
+ const quotaUsedDailyBytes = bytePipes.transform(this.userVideoQuotaUsedDaily, 0)
+ const quotaDailyBytes = bytePipes.transform(videoQuotaDaily, 0)
+
+ const msg = $localize`Your daily video quota is exceeded with this video (
+video size: ${videoSizeBytes}, used: ${quotaUsedDailyBytes}, quota: ${quotaDailyBytes})`
this.notifier.error(msg)
return false
import { FormReactive, FormValidatorService, SelectChannelItem } from '@app/shared/shared-forms'
import { VideoCaptionEdit, VideoCaptionService, VideoDetails, VideoEdit, VideoService } from '@app/shared/shared-main'
import { LoadingBarService } from '@ngx-loading-bar/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoPrivacy } from '@shared/models'
@Component({
private notifier: Notifier,
private videoService: VideoService,
private loadingBar: LoadingBarService,
- private videoCaptionService: VideoCaptionService,
- private i18n: I18n
- ) {
+ private videoCaptionService: VideoCaptionService
+ ) {
super()
}
canDeactivate (): { canDeactivate: boolean, text?: string } {
if (this.updateDone === true) return { canDeactivate: true }
- const text = this.i18n('You have unsaved changes! If you leave, your changes will be lost.')
+ const text = $localize`You have unsaved changes! If you leave, your changes will be lost.`
for (const caption of this.videoCaptions) {
if (caption.action) return { canDeactivate: false, text }
this.updateDone = true
this.isUpdatingVideo = false
this.loadingBar.useRef().complete()
- this.notifier.success(this.i18n('Video updated.'))
+ this.notifier.success($localize`Video updated.`)
this.router.navigate([ '/videos/watch', this.video.uuid ])
},
import { Account, Actor, DropdownAction, Video } from '@app/shared/shared-main'
import { CommentReportComponent } from '@app/shared/shared-moderation/report-modals/comment-report.component'
import { VideoComment, VideoCommentThreadTree } from '@app/shared/shared-video-comment'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { User, UserRight } from '@shared/models'
@Component({
commentUser: User
constructor (
- private i18n: I18n,
private markdownService: MarkdownService,
private authService: AuthService,
private userService: UserService,
if (this.isUserLoggedIn() && this.comment.isDeleted === false && this.authService.getUser().account.id !== this.comment.account.id) {
this.prependModerationActions = [
{
- label: this.i18n('Report comment'),
+ label: $localize`Report comment`,
handler: () => this.showReportModal()
}
]
import { HooksService } from '@app/core/plugins/hooks.service'
import { Syndication, VideoDetails } from '@app/shared/shared-main'
import { VideoComment, VideoCommentService, VideoCommentThreadTree } from '@app/shared/shared-video-comment'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-video-comments',
private confirmService: ConfirmService,
private videoCommentService: VideoCommentService,
private activatedRoute: ActivatedRoute,
- private i18n: I18n,
private hooks: HooksService
) {}
let message = 'Do you really want to delete this comment?'
if (commentToDelete.isLocal || this.video.isLocal) {
- message += this.i18n(' The deletion will be sent to remote instances so they can reflect the change.')
+ message += $localize` The deletion will be sent to remote instances so they can reflect the change.`
} else {
- message += this.i18n(' It is a remote comment, so the deletion will only be effective on your instance.')
+ message += $localize` It is a remote comment, so the deletion will only be effective on your instance.`
}
- const res = await this.confirmService.confirm(message, this.i18n('Delete'))
+ const res = await this.confirmService.confirm(message, $localize`Delete`)
if (res === false) return
this.videoCommentService.deleteVideoComment(commentToDelete.videoId, commentToDelete.id)
import { Video } from '@app/shared/shared-main'
import { MiniatureDisplayOptions } from '@app/shared/shared-video-miniature'
import { VideoPlaylist } from '@app/shared/shared-video-playlist'
-import { I18n } from '@ngx-translate/i18n-polyfill'
+import { UserLocalStorageKeys } from '@root-helpers/users'
import { RecommendationInfo } from './recommendation-info.model'
import { RecommendedVideosStore } from './recommended-videos.store'
-import { UserLocalStorageKeys } from '@root-helpers/users'
@Component({
selector: 'my-recommended-videos',
private userService: UserService,
private authService: AuthService,
private notifier: Notifier,
- private i18n: I18n,
private store: RecommendedVideosStore,
private sessionStorageService: SessionStorageService
) {
)
}
- this.autoPlayNextVideoTooltip = this.i18n('When active, the next video is automatically played after the current one.')
+ this.autoPlayNextVideoTooltip = $localize`When active, the next video is automatically played after the current one.`
}
ngOnInit () {
import { Pipe, PipeTransform } from '@angular/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Pipe({
name: 'myVideoDurationFormatter'
})
export class VideoDurationPipe implements PipeTransform {
- constructor (private i18n: I18n) {
-
- }
-
transform (value: number): string {
const hours = Math.floor(value / 3600)
const minutes = Math.floor((value % 3600) / 60)
const seconds = value % 60
if (hours > 0) {
- return this.i18n('{{hours}} h {{minutes}} min {{seconds}} sec', { hours, minutes, seconds })
+ return $localize`${hours} h ${minutes} min ${seconds} sec`
}
if (minutes > 0) {
- return this.i18n('{{minutes}} min {{seconds}} sec', { minutes, seconds })
+ return $localize`${minutes} min ${seconds} sec`
}
- return this.i18n('{{seconds}} sec', { seconds })
+ return $localize`${seconds} sec`
}
}
import { Component, Input } from '@angular/core'
import { Router } from '@angular/router'
import { AuthService, ComponentPagination, LocalStorageService, Notifier, SessionStorageService, UserService } from '@app/core'
-import { peertubeLocalStorage, peertubeSessionStorage } from '@root-helpers/peertube-web-storage'
import { VideoPlaylist, VideoPlaylistElement, VideoPlaylistService } from '@app/shared/shared-video-playlist'
-import { I18n } from '@ngx-translate/i18n-polyfill'
+import { peertubeLocalStorage, peertubeSessionStorage } from '@root-helpers/peertube-web-storage'
import { VideoDetails, VideoPlaylistPrivacy } from '@shared/models'
@Component({
private userService: UserService,
private auth: AuthService,
private notifier: Notifier,
- private i18n: I18n,
private videoPlaylist: VideoPlaylistService,
private localStorageService: LocalStorageService,
private sessionStorageService: SessionStorageService,
private setAutoPlayNextVideoPlaylistSwitchText () {
this.autoPlayNextVideoPlaylistSwitchText = this.autoPlayNextVideoPlaylist
- ? this.i18n('Stop autoplaying next video')
- : this.i18n('Autoplay next video')
+ ? $localize`Stop autoplaying next video`
+ : $localize`Autoplay next video`
}
private setLoopPlaylistSwitchText () {
this.loopPlaylistSwitchText = this.loopPlaylist
- ? this.i18n('Stop looping playlist videos')
- : this.i18n('Loop playlist videos')
+ ? $localize`Stop looping playlist videos`
+ : $localize`Loop playlist videos`
}
}
import { VideoDownloadComponent } from '@app/shared/shared-video-miniature'
import { VideoPlaylist, VideoPlaylistService } from '@app/shared/shared-video-playlist'
import { MetaService } from '@ngx-meta/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
import { ServerConfig, UserVideoRateType, VideoCaption, VideoPrivacy, VideoState } from '@shared/models'
import { getStoredP2PEnabled, getStoredTheater } from '../../../assets/player/peertube-player-local-storage'
private zone: NgZone,
private redirectService: RedirectService,
private videoCaptionService: VideoCaptionService,
- private i18n: I18n,
private hotkeysService: HotkeysService,
private hooks: HooksService,
private location: PlatformLocation,
@Inject(LOCALE_ID) private localeId: string
) {
- this.tooltipLike = this.i18n('Like this video')
- this.tooltipDislike = this.i18n('Dislike this video')
- this.tooltipSupport = this.i18n('Support options for this video')
- this.tooltipSaveToPlaylist = this.i18n('Save to playlist')
+ this.tooltipLike = $localize`Like this video`
+ this.tooltipDislike = $localize`Dislike this video`
+ this.tooltipSupport = $localize`Support options for this video`
+ this.tooltipSaveToPlaylist = $localize`Save to playlist`
}
get user () {
getRatePopoverText () {
if (this.isUserLoggedIn()) return undefined
- return this.i18n('You need to be connected to rate this content.')
+ return $localize`You need to be connected to rate this content.`
}
showMoreDescription () {
}
private setVideoLikesBarTooltipText () {
- this.likesBarTooltipText = this.i18n('{{likesNumber}} likes / {{dislikesNumber}} dislikes', {
- likesNumber: this.video.likes,
- dislikesNumber: this.video.dislikes
- })
+ this.likesBarTooltipText = `${this.video.likes} likes / ${this.video.dislikes} dislikes`
}
private handleError (err: any) {
if (this.isVideoBlur(this.video)) {
const res = await this.confirmService.confirm(
- this.i18n('This video contains mature or explicit content. Are you sure you want to watch it?'),
- this.i18n('Mature or explicit content')
+ $localize`This video contains mature or explicit content. Are you sure you want to watch it?`,
+ $localize`Mature or explicit content`
)
if (res === false) return this.location.back()
}
*/
this.player.upnext({
timeout: 10000, // 10s
- headText: this.i18n('Up Next'),
- cancelText: this.i18n('Cancel'),
- suspendedText: this.i18n('Autoplay is suspended'),
+ headText: $localize`Up Next`,
+ cancelText: $localize`Cancel`,
+ suspendedText: $localize`Autoplay is suspended`,
getTitle: () => this.nextVideoTitle,
next: () => this.zone.run(() => this.autoplayNext()),
condition: () => {
private initHotkeys () {
this.hotkeys = [
// These hotkeys are managed by the player
- new Hotkey('f', e => e, undefined, this.i18n('Enter/exit fullscreen (requires player focus)')),
- new Hotkey('space', e => e, undefined, this.i18n('Play/Pause the video (requires player focus)')),
- new Hotkey('m', e => e, undefined, this.i18n('Mute/unmute the video (requires player focus)')),
+ new Hotkey('f', e => e, undefined, $localize`Enter/exit fullscreen (requires player focus)`),
+ new Hotkey('space', e => e, undefined, $localize`Play/Pause the video (requires player focus)`),
+ new Hotkey('m', e => e, undefined, $localize`Mute/unmute the video (requires player focus)`),
- new Hotkey('0-9', e => e, undefined, this.i18n('Skip to a percentage of the video: 0 is 0% and 9 is 90% (requires player focus)')),
+ new Hotkey('0-9', e => e, undefined, $localize`Skip to a percentage of the video: 0 is 0% and 9 is 90% (requires player focus)`),
- new Hotkey('up', e => e, undefined, this.i18n('Increase the volume (requires player focus)')),
- new Hotkey('down', e => e, undefined, this.i18n('Decrease the volume (requires player focus)')),
+ new Hotkey('up', e => e, undefined, $localize`Increase the volume (requires player focus)`),
+ new Hotkey('down', e => e, undefined, $localize`Decrease the volume (requires player focus)`),
- new Hotkey('right', e => e, undefined, this.i18n('Seek the video forward (requires player focus)')),
- new Hotkey('left', e => e, undefined, this.i18n('Seek the video backward (requires player focus)')),
+ new Hotkey('right', e => e, undefined, $localize`Seek the video forward (requires player focus)`),
+ new Hotkey('left', e => e, undefined, $localize`Seek the video backward (requires player focus)`),
- new Hotkey('>', e => e, undefined, this.i18n('Increase playback rate (requires player focus)')),
- new Hotkey('<', e => e, undefined, this.i18n('Decrease playback rate (requires player focus)')),
+ new Hotkey('>', e => e, undefined, $localize`Increase playback rate (requires player focus)`),
+ new Hotkey('<', e => e, undefined, $localize`Decrease playback rate (requires player focus)`),
- new Hotkey('.', e => e, undefined, this.i18n('Navigate in the video frame by frame (requires player focus)'))
+ new Hotkey('.', e => e, undefined, $localize`Navigate in the video frame by frame (requires player focus)`)
]
if (this.isUserLoggedIn()) {
new Hotkey('shift+l', () => {
this.setLike()
return false
- }, undefined, this.i18n('Like the video')),
+ }, undefined, $localize`Like the video`),
new Hotkey('shift+d', () => {
this.setDislike()
return false
- }, undefined, this.i18n('Dislike the video')),
+ }, undefined, $localize`Dislike the video`),
new Hotkey('shift+s', () => {
this.subscribeButton.subscribed ? this.subscribeButton.unsubscribe() : this.subscribeButton.subscribe()
return false
- }, undefined, this.i18n('Subscribe to the account'))
+ }, undefined, $localize`Subscribe to the account`)
])
}
import { immutableAssign } from '@app/helpers'
import { VideoService } from '@app/shared/shared-main'
import { AbstractVideoList } from '@app/shared/shared-video-miniature'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { UserRight, VideoFilter, VideoSortField } from '@shared/models'
@Component({
useUserVideoPreferences = true
constructor (
- protected i18n: I18n,
protected router: Router,
protected serverService: ServerService,
protected route: ActivatedRoute,
) {
super()
- this.titlePage = i18n('Local videos')
+ this.titlePage = $localize`Local videos`
}
ngOnInit () {
import { immutableAssign } from '@app/helpers'
import { VideoService } from '@app/shared/shared-main'
import { AbstractVideoList } from '@app/shared/shared-video-miniature'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoSortField } from '@shared/models'
@Component({
useUserVideoPreferences = true
constructor (
- protected i18n: I18n,
protected router: Router,
protected serverService: ServerService,
protected route: ActivatedRoute,
this.generateSyndicationList()
- this.titlePage = this.i18n('Most liked videos')
- this.titleTooltip = this.i18n('Videos that have the higher number of likes.')
+ this.titlePage = $localize`Most liked videos`
+ this.titleTooltip = $localize`Videos that have the higher number of likes.`
}
getVideosObservable (page: number) {
import { immutableAssign } from '@app/helpers'
import { VideoService } from '@app/shared/shared-main'
import { AbstractVideoList } from '@app/shared/shared-video-miniature'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoSortField } from '@shared/models'
@Component({
useUserVideoPreferences = true
constructor (
- protected i18n: I18n,
protected route: ActivatedRoute,
protected serverService: ServerService,
protected router: Router,
) {
super()
- this.titlePage = i18n('Recently added')
+ this.titlePage = $localize`Recently added`
}
ngOnInit () {
import { immutableAssign } from '@app/helpers'
import { VideoService } from '@app/shared/shared-main'
import { AbstractVideoList } from '@app/shared/shared-video-miniature'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoSortField } from '@shared/models'
@Component({
useUserVideoPreferences = true
constructor (
- protected i18n: I18n,
protected router: Router,
protected serverService: ServerService,
protected route: ActivatedRoute,
const trendingDays = config.trending.videos.intervalDays
if (trendingDays === 1) {
- this.titlePage = this.i18n('Trending for the last 24 hours')
- this.titleTooltip = this.i18n('Trending videos are those totalizing the greatest number of views during the last 24 hours')
+ this.titlePage = $localize`Trending for the last 24 hours`
+ this.titleTooltip = $localize`Trending videos are those totalizing the greatest number of views during the last 24 hours`
} else {
- this.titlePage = this.i18n('Trending for the last {{days}} days', { days: trendingDays })
- this.titleTooltip = this.i18n(
- 'Trending videos are those totalizing the greatest number of views during the last {{days}} days',
- { days: trendingDays }
- )
+ this.titlePage = `Trending for the last ${trendingDays} days`
+ this.titleTooltip = `Trending videos are those totalizing the greatest number of views during the last ${trendingDays} days`
}
})
}
import { AuthService, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core'
import { HooksService } from '@app/core/plugins/hooks.service'
import { immutableAssign } from '@app/helpers'
-import { VideoService } from '@app/shared/shared-main'
import { UserSubscriptionService } from '@app/shared/shared-user-subscription'
import { AbstractVideoList, OwnerDisplayType } from '@app/shared/shared-video-miniature'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoSortField } from '@shared/models'
@Component({
groupByDate = true
constructor (
- protected i18n: I18n,
protected router: Router,
protected serverService: ServerService,
protected route: ActivatedRoute,
protected screenService: ScreenService,
protected storageService: LocalStorageService,
private userSubscription: UserSubscriptionService,
- private videoService: VideoService,
private hooks: HooksService
) {
super()
- this.titlePage = i18n('Videos from your subscriptions')
+ this.titlePage = $localize`Videos from your subscriptions`
this.actions.push({
routerLink: '/my-account/subscriptions',
- label: i18n('Subscriptions'),
+ label: $localize`Subscriptions`,
iconName: 'cog'
})
}
import { InstanceConfigWarningModalComponent } from '@app/modal/instance-config-warning-modal.component'
import { WelcomeModalComponent } from '@app/modal/welcome-modal.component'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
-import { I18n } from '@ngx-translate/i18n-polyfill'
+import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
import { getShortLocale, is18nPath } from '@shared/core-utils/i18n'
import { BroadcastMessageLevel, ServerConfig, UserRole } from '@shared/models'
import { MenuService } from './core/menu/menu.service'
import { POP_STATE_MODAL_DISMISS } from './helpers'
-import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
import { InstanceService } from './shared/shared-instance'
@Component({
constructor (
@Inject(DOCUMENT) private document: Document,
@Inject(LOCALE_ID) private localeId: string,
- private i18n: I18n,
private viewportScroller: ViewportScroller,
private router: Router,
private authService: AuthService,
new Hotkey(['/', 's'], (event: KeyboardEvent): boolean => {
document.getElementById('search-video').focus()
return false
- }, undefined, this.i18n('Focus the search bar')),
+ }, undefined, $localize`Focus the search bar`),
new Hotkey('b', (event: KeyboardEvent): boolean => {
this.menu.toggleMenu()
return false
- }, undefined, this.i18n('Toggle the left menu')),
+ }, undefined, $localize`Toggle the left menu`),
new Hotkey('g o', (event: KeyboardEvent): boolean => {
this.router.navigate([ '/videos/overview' ])
return false
- }, undefined, this.i18n('Go to the discover videos page')),
+ }, undefined, $localize`Go to the discover videos page`),
new Hotkey('g t', (event: KeyboardEvent): boolean => {
this.router.navigate([ '/videos/trending' ])
return false
- }, undefined, this.i18n('Go to the trending videos page')),
+ }, undefined, $localize`Go to the trending videos page`),
new Hotkey('g r', (event: KeyboardEvent): boolean => {
this.router.navigate([ '/videos/recently-added' ])
return false
- }, undefined, this.i18n('Go to the recently added videos page')),
+ }, undefined, $localize`Go to the recently added videos page`),
new Hotkey('g l', (event: KeyboardEvent): boolean => {
this.router.navigate([ '/videos/local' ])
return false
- }, undefined, this.i18n('Go to the local videos page')),
+ }, undefined, $localize`Go to the local videos page`),
new Hotkey('g u', (event: KeyboardEvent): boolean => {
this.router.navigate([ '/videos/upload' ])
return false
- }, undefined, this.i18n('Go to the videos upload page'))
+ }, undefined, $localize`Go to the videos upload page`)
])
}
}
{
provide: APP_BASE_HREF,
useValue: '/'
- },
-
- {
- provide: TRANSLATIONS,
- useFactory: (locale: string) => {
- // Default locale, nothing to translate
- const completeLocale = getCompleteLocale(locale)
- if (isDefaultLocale(completeLocale)) return ''
-
- const fileLocale = buildFileLocale(locale)
- return require(`raw-loader!../locale/angular.${fileLocale}.xlf`).default
- },
- deps: [ LOCALE_ID ]
- },
- { provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }
+ }
]
})
export class AppModule {}
import { Router } from '@angular/router'
import { Notifier } from '@app/core/notification/notifier.service'
import { objectToUrlEncoded, peertubeLocalStorage } from '@root-helpers/index'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { MyUser as UserServerModel, OAuthClientLocal, User, UserLogin, UserRefreshToken } from '@shared/models'
import { environment } from '../../../environments/environment'
import { RestExtractor } from '../rest/rest-extractor.service'
private notifier: Notifier,
private hotkeysService: HotkeysService,
private restExtractor: RestExtractor,
- private router: Router,
- private i18n: I18n
- ) {
+ private router: Router
+ ) {
this.loginChanged = new Subject<AuthStatus>()
this.loginChangedSource = this.loginChanged.asObservable()
new Hotkey('m s', (event: KeyboardEvent): boolean => {
this.router.navigate([ '/videos/subscriptions' ])
return false
- }, undefined, this.i18n('Go to my subscriptions')),
+ }, undefined, $localize`Go to my subscriptions`),
new Hotkey('m v', (event: KeyboardEvent): boolean => {
this.router.navigate([ '/my-account/videos' ])
return false
- }, undefined, this.i18n('Go to my videos')),
+ }, undefined, $localize`Go to my videos`),
new Hotkey('m i', (event: KeyboardEvent): boolean => {
this.router.navigate([ '/my-account/video-imports' ])
return false
- }, undefined, this.i18n('Go to my imports')),
+ }, undefined, $localize`Go to my imports`),
new Hotkey('m c', (event: KeyboardEvent): boolean => {
this.router.navigate([ '/my-account/video-channels' ])
return false
- }, undefined, this.i18n('Go to my channels'))
+ }, undefined, $localize`Go to my channels`)
]
}
let errorMessage = error.message
if (error.status === 403) {
- errorMessage = this.i18n('Cannot retrieve OAuth Client credentials: {{errorText}}.\n', { errorText: error.text })
- errorMessage += this.i18n(
- 'Ensure you have correctly configured PeerTube (config/ directory), in particular the "webserver" section.'
- )
+ errorMessage = $localize`Cannot retrieve OAuth Client credentials: ${error.text}.
+Ensure you have correctly configured PeerTube (config/ directory), in particular the "webserver" section.`
}
// We put a bigger timeout: this is an important message
- this.notifier.error(errorMessage, this.i18n('Error'), 7000)
+ this.notifier.error(errorMessage, $localize`Error`, 7000)
}
)
}
this.router.navigate([ '/login' ])
return observableThrowError({
- error: this.i18n('You need to reconnect.')
+ error: $localize`You need to reconnect.`
})
}),
share()
-import { Component, OnInit, OnDestroy, Input } from '@angular/core'
+import { Hotkey, HotkeysService } from 'angular2-hotkeys'
import { Subscription } from 'rxjs'
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { HotkeysService, Hotkey } from 'angular2-hotkeys'
+import { Component, Input, OnDestroy, OnInit } from '@angular/core'
@Component({
selector : 'my-hotkeys-cheatsheet',
styleUrls: [ './hotkeys.component.scss' ]
})
export class CheatSheetComponent implements OnInit, OnDestroy {
- @Input() title = this.i18n('Keyboard Shortcuts:')
+ @Input() title = $localize`Keyboard Shortcuts:`
helpVisible = false
subscription: Subscription
hotkeys: Hotkey[]
constructor (
- private hotkeysService: HotkeysService,
- private i18n: I18n
- ) {}
+ private hotkeysService: HotkeysService
+ ) {}
public ngOnInit (): void {
this.subscription = this.hotkeysService.cheatSheetToggle.subscribe((isOpen) => {
-import { Injectable } from '@angular/core'
import { MessageService } from 'primeng/api'
-import { I18n } from '@ngx-translate/i18n-polyfill'
+import { Injectable } from '@angular/core'
@Injectable()
export class Notifier {
readonly TIMEOUT = 5000
- constructor (
- private i18n: I18n,
- private messageService: MessageService) {
- }
+ constructor (private messageService: MessageService) { }
info (text: string, title?: string, timeout?: number) {
- if (!title) title = this.i18n('Info')
+ if (!title) title = $localize`Info`
return this.notify('info', text, title, timeout)
}
error (text: string, title?: string, timeout?: number) {
- if (!title) title = this.i18n('Error')
+ if (!title) title = $localize`Error`
return this.notify('error', text, title, timeout)
}
success (text: string, title?: string, timeout?: number) {
- if (!title) title = this.i18n('Success')
+ if (!title) title = $localize`Success`
return this.notify('success', text, title, timeout)
}
import { Injectable } from '@angular/core'
import { Router } from '@angular/router'
import { dateToHuman } from '@app/helpers'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ResultList } from '@shared/models'
@Injectable()
export class RestExtractor {
- constructor (
- private router: Router,
- private i18n: I18n
- ) { }
+ constructor (private router: Router) { }
extractDataBool () {
return true
} else if (err.error && err.error.error) {
errorMessage = err.error.error
} else if (err.status === 413) {
- errorMessage = this.i18n(
- 'Request is too large for the server. Please contact you administrator if you want to increase the limit size.'
- )
+ errorMessage = $localize`Request is too large for the server.
+ Please contact you administrator if you want to increase the limit size.`
} else if (err.status === 429) {
const secondsLeft = err.headers.get('retry-after')
if (secondsLeft) {
const minutesLeft = Math.floor(parseInt(secondsLeft, 10) / 60)
- errorMessage = this.i18n('Too many attempts, please try again after {{minutesLeft}} minutes.', { minutesLeft })
+ errorMessage = $localize`Too many attempts, please try again after ${minutesLeft} minutes.`
} else {
- errorMessage = this.i18n('Too many attempts, please try again later.')
+ errorMessage = $localize`Too many attempts, please try again later.`
}
} else if (err.status === 500) {
- errorMessage = this.i18n('Server error. Please retry later.')
+ errorMessage = $localize`Server error. Please retry later.`
}
errorMessage = errorMessage ? errorMessage : 'Unknown error.'
import { Injectable } from '@angular/core'
import { CanDeactivate } from '@angular/router'
import { ConfirmService } from '@app/core/confirm'
-import { I18n } from '@ngx-translate/i18n-polyfill'
export type CanComponentDeactivateResult = { text?: string, canDeactivate: Observable<boolean> | boolean }
@Injectable()
export class CanDeactivateGuard implements CanDeactivate<CanComponentDeactivate> {
- constructor (
- private confirmService: ConfirmService,
- private i18n: I18n
- ) { }
+
+ constructor (private confirmService: ConfirmService) { }
canDeactivate (component: CanComponentDeactivate) {
const result = component.canDeactivate()
- const text = result.text || this.i18n('All unsaved data will be lost, are you sure you want to leave this page?')
+ const text = result.text || $localize`All unsaved data will be lost, are you sure you want to leave this page?`
return result.canDeactivate || this.confirmService.confirm(
text,
- this.i18n('Warning')
+ $localize`Warning`
)
}
import { Injectable } from '@angular/core'
import { AuthService } from '@app/core/auth'
import { BytesPipe } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { UserLocalStorageKeys } from '@root-helpers/users'
import {
Avatar,
private restExtractor: RestExtractor,
private restService: RestService,
private localStorageService: LocalStorageService,
- private sessionStorageService: SessionStorageService,
- private i18n: I18n
- ) { }
+ private sessionStorageService: SessionStorageService
+ ) { }
changePassword (currentPassword: string, newPassword: string) {
const url = UserService.BASE_USERS_URL + 'me'
}
const roleLabels: { [ id in UserRole ]: string } = {
- [UserRole.USER]: this.i18n('User'),
- [UserRole.ADMINISTRATOR]: this.i18n('Administrator'),
- [UserRole.MODERATOR]: this.i18n('Moderator')
+ [UserRole.USER]: $localize`User`,
+ [UserRole.ADMINISTRATOR]: $localize`Administrator`,
+ [UserRole.MODERATOR]: $localize`Moderator`
}
return Object.assign(user, {
import { AuthService, AuthStatus, AuthUser, RedirectService, ScreenService, ServerService, UserService } from '@app/core'
import { LanguageChooserComponent } from '@app/menu/language-chooser.component'
import { QuickSettingsModalComponent } from '@app/modal/quick-settings-modal.component'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig, UserRight, VideoConstant } from '@shared/models'
const logger = debug('peertube:menu:MenuComponent')
private serverService: ServerService,
private redirectService: RedirectService,
private hotkeysService: HotkeysService,
- private screenService: ScreenService,
- private i18n: I18n
- ) { }
+ private screenService: ScreenService
+ ) { }
get isInMobileView () {
return this.screenService.isInMobileView()
switch (this.user.nsfwPolicy) {
case 'do_not_list':
- return this.i18n('hide')
+ return $localize`hide`
case 'blur':
- return this.i18n('blur')
+ return $localize`blur`
case 'display':
- return this.i18n('display')
+ return $localize`display`
}
}
}
langForLocale (localeId: string) {
- if (localeId === '_unknown') return this.i18n('Unknown')
+ if (localeId === '_unknown') return $localize`Unknown`
return this.languages.find(lang => lang.id === localeId).label
}
}
if (!this.user.videoLanguages) {
- this.videoLanguages = [this.i18n('any language')]
+ this.videoLanguages = [$localize`any language`]
return
}
import { POP_STATE_MODAL_DISMISS } from '@app/helpers'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-confirm',
constructor (
private modalService: NgbModal,
- private confirmService: ConfirmService,
- private i18n: I18n
+ private confirmService: ConfirmService
) { }
ngOnInit () {
this.inputLabel = inputLabel
this.expectedInputValue = expectedInputValue
- this.confirmButtonText = confirmButtonText || this.i18n('Confirm')
+ this.confirmButtonText = confirmButtonText || $localize`Confirm`
this.showModal()
}
import { Component, Input } from '@angular/core'
import { durationToString } from '@app/helpers'
import { Actor } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { AbusePredefinedReasonsString } from '@shared/models'
import { ProcessedAbuse } from './processed-abuse.model'
private predefinedReasonsTranslations: { [key in AbusePredefinedReasonsString]: string }
- constructor (
- private i18n: I18n
- ) {
+ constructor () {
this.predefinedReasonsTranslations = {
- violentOrRepulsive: this.i18n('Violent or Repulsive'),
- hatefulOrAbusive: this.i18n('Hateful or Abusive'),
- spamOrMisleading: this.i18n('Spam or Misleading'),
- privacy: this.i18n('Privacy'),
- rights: this.i18n('Copyright'),
- serverRules: this.i18n('Server rules'),
- thumbnails: this.i18n('Thumbnails'),
- captions: this.i18n('Captions')
+ violentOrRepulsive: $localize`Violent or Repulsive`,
+ hatefulOrAbusive: $localize`Hateful or Abusive`,
+ spamOrMisleading: $localize`Spam or Misleading`,
+ privacy: $localize`Privacy`,
+ rights: $localize`Copyright`,
+ serverRules: $localize`Server rules`,
+ thumbnails: $localize`Thumbnails`,
+ captions: $localize`Captions`
}
}
import * as debug from 'debug'
import truncate from 'lodash-es/truncate'
import { SortMeta } from 'primeng/api'
-import { buildVideoOrPlaylistEmbed, buildVideoLink } from 'src/assets/player/utils'
+import { buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/utils'
import { environment } from 'src/environments/environment'
-import { AfterViewInit, Component, OnInit, ViewChild, Input } from '@angular/core'
+import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core'
import { DomSanitizer } from '@angular/platform-browser'
import { ActivatedRoute, Params, Router } from '@angular/router'
import { ConfirmService, MarkdownService, Notifier, RestPagination, RestTable } from '@app/core'
import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main'
import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation'
import { VideoCommentService } from '@app/shared/shared-video-comment'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { AbuseState, AdminAbuse } from '@shared/models'
import { AbuseMessageModalComponent } from './abuse-message-modal.component'
import { ModerationCommentModalComponent } from './moderation-comment-modal.component'
private videoService: VideoService,
private videoBlocklistService: VideoBlockService,
private confirmService: ConfirmService,
- private i18n: I18n,
private markdownRenderer: MarkdownService,
private sanitizer: DomSanitizer,
private route: ActivatedRoute,
}
async removeAbuse (abuse: AdminAbuse) {
- const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this abuse report?'), this.i18n('Delete'))
+ const res = await this.confirmService.confirm($localize`Do you really want to delete this abuse report?`, $localize`Delete`)
if (res === false) return
this.abuseService.removeAbuse(abuse).subscribe(
() => {
- this.notifier.success(this.i18n('Abuse deleted.'))
+ this.notifier.success($localize`Abuse deleted.`)
this.loadData()
},
if (abuse.comment) {
if (abuse.comment.deleted) {
- abuse.truncatedCommentHtml = abuse.commentHtml = this.i18n('Deleted comment')
+ abuse.truncatedCommentHtml = abuse.commentHtml = $localize`Deleted comment`
} else {
const truncated = truncate(abuse.comment.text, { length: 100 })
abuse.truncatedCommentHtml = await this.markdownRenderer.textMarkdownToHTML(truncated, true)
private buildInternalActions (): DropdownAction<ProcessedAbuse>[] {
return [
{
- label: this.i18n('Internal actions'),
+ label: $localize`Internal actions`,
isHeader: true
},
{
label: this.isAdminView()
- ? this.i18n('Messages with reporter')
- : this.i18n('Messages with moderators'),
+ ? $localize`Messages with reporter`
+ : $localize`Messages with moderators`,
handler: abuse => this.openAbuseMessagesModal(abuse),
isDisplayed: abuse => this.isLocalAbuse(abuse)
},
{
- label: this.i18n('Update internal note'),
+ label: $localize`Update internal note`,
handler: abuse => this.openModerationCommentModal(abuse),
isDisplayed: abuse => this.isAdminView() && !!abuse.moderationComment
},
{
- label: this.i18n('Mark as accepted'),
+ label: $localize`Mark as accepted`,
handler: abuse => this.updateAbuseState(abuse, AbuseState.ACCEPTED),
isDisplayed: abuse => this.isAdminView() && !this.isAbuseAccepted(abuse)
},
{
- label: this.i18n('Mark as rejected'),
+ label: $localize`Mark as rejected`,
handler: abuse => this.updateAbuseState(abuse, AbuseState.REJECTED),
isDisplayed: abuse => this.isAdminView() && !this.isAbuseRejected(abuse)
},
{
- label: this.i18n('Add internal note'),
+ label: $localize`Add internal note`,
handler: abuse => this.openModerationCommentModal(abuse),
isDisplayed: abuse => this.isAdminView() && !abuse.moderationComment
},
{
- label: this.i18n('Delete report'),
+ label: $localize`Delete report`,
handler: abuse => this.isAdminView() && this.removeAbuse(abuse)
}
]
return [
{
- label: this.i18n('Actions for the flagged account'),
+ label: $localize`Actions for the flagged account`,
isHeader: true,
isDisplayed: abuse => abuse.flaggedAccount && !abuse.comment && !abuse.video
},
{
- label: this.i18n('Mute account'),
+ label: $localize`Mute account`,
isDisplayed: abuse => abuse.flaggedAccount && !abuse.comment && !abuse.video,
handler: abuse => this.muteAccountHelper(abuse.flaggedAccount)
},
{
- label: this.i18n('Mute server account'),
+ label: $localize`Mute server account`,
isDisplayed: abuse => abuse.flaggedAccount && !abuse.comment && !abuse.video,
handler: abuse => this.muteServerHelper(abuse.flaggedAccount.host)
}
return [
{
- label: this.i18n('Actions for the reporter'),
+ label: $localize`Actions for the reporter`,
isHeader: true,
isDisplayed: abuse => !!abuse.reporterAccount
},
{
- label: this.i18n('Mute reporter'),
+ label: $localize`Mute reporter`,
isDisplayed: abuse => !!abuse.reporterAccount,
handler: abuse => this.muteAccountHelper(abuse.reporterAccount)
},
{
- label: this.i18n('Mute server'),
+ label: $localize`Mute server`,
isDisplayed: abuse => abuse.reporterAccount && !abuse.reporterAccount.userId,
handler: abuse => this.muteServerHelper(abuse.reporterAccount.host)
}
return [
{
- label: this.i18n('Actions for the video'),
+ label: $localize`Actions for the video`,
isHeader: true,
isDisplayed: abuse => abuse.video && !abuse.video.deleted
},
{
- label: this.i18n('Block video'),
+ label: $localize`Block video`,
isDisplayed: abuse => abuse.video && !abuse.video.deleted && !abuse.video.blacklisted,
handler: abuse => {
this.videoBlocklistService.blockVideo(abuse.video.id, undefined, true)
.subscribe(
() => {
- this.notifier.success(this.i18n('Video blocked.'))
+ this.notifier.success($localize`Video blocked.`)
this.updateAbuseState(abuse, AbuseState.ACCEPTED)
},
}
},
{
- label: this.i18n('Unblock video'),
+ label: $localize`Unblock video`,
isDisplayed: abuse => abuse.video && !abuse.video.deleted && abuse.video.blacklisted,
handler: abuse => {
this.videoBlocklistService.unblockVideo(abuse.video.id)
.subscribe(
() => {
- this.notifier.success(this.i18n('Video unblocked.'))
+ this.notifier.success($localize`Video unblocked.`)
this.updateAbuseState(abuse, AbuseState.ACCEPTED)
},
}
},
{
- label: this.i18n('Delete video'),
+ label: $localize`Delete video`,
isDisplayed: abuse => abuse.video && !abuse.video.deleted,
handler: async abuse => {
const res = await this.confirmService.confirm(
- this.i18n('Do you really want to delete this video?'),
- this.i18n('Delete')
+ $localize`Do you really want to delete this video?`,
+ $localize`Delete`
)
if (res === false) return
this.videoService.removeVideo(abuse.video.id)
.subscribe(
() => {
- this.notifier.success(this.i18n('Video deleted.'))
+ this.notifier.success($localize`Video deleted.`)
this.updateAbuseState(abuse, AbuseState.ACCEPTED)
},
return [
{
- label: this.i18n('Actions for the comment'),
+ label: $localize`Actions for the comment`,
isHeader: true,
isDisplayed: abuse => abuse.comment && !abuse.comment.deleted
},
{
- label: this.i18n('Delete comment'),
+ label: $localize`Delete comment`,
isDisplayed: abuse => abuse.comment && !abuse.comment.deleted,
handler: async abuse => {
const res = await this.confirmService.confirm(
- this.i18n('Do you really want to delete this comment?'),
- this.i18n('Delete')
+ $localize`Do you really want to delete this comment?`,
+ $localize`Delete`
)
if (res === false) return
this.commentService.deleteVideoComment(abuse.comment.video.id, abuse.comment.id)
.subscribe(
() => {
- this.notifier.success(this.i18n('Comment deleted.'))
+ this.notifier.success($localize`Comment deleted.`)
this.updateAbuseState(abuse, AbuseState.ACCEPTED)
},
this.blocklistService.blockAccountByInstance(account)
.subscribe(
() => {
- this.notifier.success(
- this.i18n('Account {{nameWithHost}} muted by the instance.', { nameWithHost: account.nameWithHost })
- )
-
+ this.notifier.success($localize`Account ${account.nameWithHost} muted by the instance.`)
account.mutedByInstance = true
},
this.blocklistService.blockServerByInstance(host)
.subscribe(
() => {
- this.notifier.success(
- this.i18n('Server {{host}} muted by the instance.', { host: host })
- )
+ this.notifier.success($localize`Server ${host} muted by the instance.`)
},
err => this.notifier.error(err.message)
-import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
-import { AuthService, Notifier, HtmlRendererService } from '@app/core'
+import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
+import { AuthService, HtmlRendererService, Notifier } from '@app/core'
import { AbuseValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { AbuseMessage, UserAbuse } from '@shared/models'
import { AbuseService } from '../shared-moderation'
protected formValidatorService: FormValidatorService,
private abuseValidatorsService: AbuseValidatorsService,
private modalService: NgbModal,
- private i18n: I18n,
private htmlRenderer: HtmlRendererService,
private auth: AuthService,
private notifier: Notifier,
getPlaceholderMessage () {
if (this.isAdminView) {
- return this.i18n('Add a message to communicate with the reporter')
+ return $localize`Add a message to communicate with the reporter`
}
- return this.i18n('Add a message to communicate with the moderation team')
+ return $localize`Add a message to communicate with the moderation team`
}
private loadMessages () {
import { Component, EventEmitter, OnInit, Output, ViewChild } from '@angular/core'
import { Notifier } from '@app/core'
-import { FormReactive, FormValidatorService, AbuseValidatorsService } from '@app/shared/shared-forms'
+import { AbuseValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms'
import { AbuseService } from '@app/shared/shared-moderation'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { AdminAbuse } from '@shared/models'
@Component({
private modalService: NgbModal,
private notifier: Notifier,
private abuseService: AbuseService,
- private abuseValidatorsService: AbuseValidatorsService,
- private i18n: I18n
+ private abuseValidatorsService: AbuseValidatorsService
) {
super()
}
this.abuseService.updateAbuse(this.abuseToComment, { moderationComment })
.subscribe(
() => {
- this.notifier.success(this.i18n('Comment updated.'))
+ this.notifier.success($localize`Comment updated.`)
this.commentUpdated.emit(moderationComment)
this.hide()
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { Validators } from '@angular/forms'
import { Injectable } from '@angular/core'
+import { Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.service'
@Injectable()
readonly ABUSE_MODERATION_COMMENT: BuildFormValidator
readonly ABUSE_MESSAGE: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.ABUSE_REASON = {
VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ],
MESSAGES: {
- 'required': this.i18n('Report reason is required.'),
- 'minlength': this.i18n('Report reason must be at least 2 characters long.'),
- 'maxlength': this.i18n('Report reason cannot be more than 3000 characters long.')
+ 'required': $localize`Report reason is required.`,
+ 'minlength': $localize`Report reason must be at least 2 characters long.`,
+ 'maxlength': $localize`Report reason cannot be more than 3000 characters long.`
}
}
this.ABUSE_MODERATION_COMMENT = {
VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ],
MESSAGES: {
- 'required': this.i18n('Moderation comment is required.'),
- 'minlength': this.i18n('Moderation comment must be at least 2 characters long.'),
- 'maxlength': this.i18n('Moderation comment cannot be more than 3000 characters long.')
+ 'required': $localize`Moderation comment is required.`,
+ 'minlength': $localize`Moderation comment must be at least 2 characters long.`,
+ 'maxlength': $localize`Moderation comment cannot be more than 3000 characters long.`
}
}
this.ABUSE_MESSAGE = {
VALIDATORS: [ Validators.required, Validators.minLength(2), Validators.maxLength(3000) ],
MESSAGES: {
- 'required': this.i18n('Abuse message is required.'),
- 'minlength': this.i18n('Abuse message must be at least 2 characters long.'),
- 'maxlength': this.i18n('Abuse message cannot be more than 3000 characters long.')
+ 'required': $localize`Abuse message is required.`,
+ 'minlength': $localize`Abuse message must be at least 2 characters long.`,
+ 'maxlength': $localize`Abuse message cannot be more than 3000 characters long.`
}
}
}
import { Injectable } from '@angular/core'
import { ValidatorFn, Validators } from '@angular/forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { BuildFormValidator } from './form-validator.service'
import { validateHost } from './host'
export class BatchDomainsValidatorsService {
readonly DOMAINS: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.DOMAINS = {
VALIDATORS: [ Validators.required, this.validDomains, this.isHostsUnique ],
MESSAGES: {
- 'required': this.i18n('Domain is required.'),
- 'validDomains': this.i18n('Domains entered are invalid.'),
- 'uniqueDomains': this.i18n('Domains entered contain duplicates.')
+ 'required': $localize`Domain is required.`,
+ 'validDomains': $localize`Domains entered are invalid.`,
+ 'uniqueDomains': $localize`Domains entered contain duplicates.`
}
}
}
for (const host of hosts) {
if (validateHost(host) === false) {
- newHostsErrors.push(this.i18n('{{host}} is not valid', { host }))
+ newHostsErrors.push($localize`${host} is not valid`)
}
}
+import { Injectable } from '@angular/core'
import { Validators } from '@angular/forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { BuildFormValidator } from './form-validator.service'
-import { Injectable } from '@angular/core'
@Injectable()
export class CustomConfigValidatorsService {
readonly INDEX_URL: BuildFormValidator
readonly SEARCH_INDEX_URL: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.INSTANCE_NAME = {
VALIDATORS: [ Validators.required ],
MESSAGES: {
- 'required': this.i18n('Instance name is required.')
+ 'required': $localize`Instance name is required.`
}
}
this.INSTANCE_SHORT_DESCRIPTION = {
VALIDATORS: [ Validators.max(250) ],
MESSAGES: {
- 'max': this.i18n('Short description should not be longer than 250 characters.')
+ 'max': $localize`Short description should not be longer than 250 characters.`
}
}
this.SERVICES_TWITTER_USERNAME = {
VALIDATORS: [ Validators.required ],
MESSAGES: {
- 'required': this.i18n('Twitter username is required.')
+ 'required': $localize`Twitter username is required.`
}
}
this.CACHE_PREVIEWS_SIZE = {
VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
MESSAGES: {
- 'required': this.i18n('Previews cache size is required.'),
- 'min': this.i18n('Previews cache size must be greater than 1.'),
- 'pattern': this.i18n('Previews cache size must be a number.')
+ 'required': $localize`Previews cache size is required.`,
+ 'min': $localize`Previews cache size must be greater than 1.`,
+ 'pattern': $localize`Previews cache size must be a number.`
}
}
this.CACHE_CAPTIONS_SIZE = {
VALIDATORS: [ Validators.required, Validators.min(1), Validators.pattern('[0-9]+') ],
MESSAGES: {
- 'required': this.i18n('Captions cache size is required.'),
- 'min': this.i18n('Captions cache size must be greater than 1.'),
- 'pattern': this.i18n('Captions cache size must be a number.')
+ 'required': $localize`Captions cache size is required.`,
+ 'min': $localize`Captions cache size must be greater than 1.`,
+ 'pattern': $localize`Captions cache size must be a number.`
}
}
this.SIGNUP_LIMIT = {
VALIDATORS: [ Validators.required, Validators.min(-1), Validators.pattern('-?[0-9]+') ],
MESSAGES: {
- 'required': this.i18n('Signup limit is required.'),
- 'min': this.i18n('Signup limit must be greater than 1.'),
- 'pattern': this.i18n('Signup limit must be a number.')
+ 'required': $localize`Signup limit is required.`,
+ 'min': $localize`Signup limit must be greater than 1.`,
+ 'pattern': $localize`Signup limit must be a number.`
}
}
this.ADMIN_EMAIL = {
VALIDATORS: [ Validators.required, Validators.email ],
MESSAGES: {
- 'required': this.i18n('Admin email is required.'),
- 'email': this.i18n('Admin email must be valid.')
+ 'required': $localize`Admin email is required.`,
+ 'email': $localize`Admin email must be valid.`
}
}
this.TRANSCODING_THREADS = {
VALIDATORS: [ Validators.required, Validators.min(0) ],
MESSAGES: {
- 'required': this.i18n('Transcoding threads is required.'),
- 'min': this.i18n('Transcoding threads must be greater or equal to 0.')
+ 'required': $localize`Transcoding threads is required.`,
+ 'min': $localize`Transcoding threads must be greater or equal to 0.`
}
}
this.INDEX_URL = {
VALIDATORS: [ Validators.pattern(/^https:\/\//) ],
MESSAGES: {
- 'pattern': this.i18n('Index URL should be a URL')
+ 'pattern': $localize`Index URL should be a URL`
}
}
this.SEARCH_INDEX_URL = {
VALIDATORS: [ Validators.pattern(/^https?:\/\//) ],
MESSAGES: {
- 'pattern': this.i18n('Search index URL should be a URL')
+ 'pattern': $localize`Search index URL should be a URL`
}
}
}
-import { I18n } from '@ngx-translate/i18n-polyfill'
+import { Injectable } from '@angular/core'
import { Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.service'
-import { Injectable } from '@angular/core'
@Injectable()
export class InstanceValidatorsService {
readonly SUBJECT: BuildFormValidator
readonly BODY: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.FROM_EMAIL = {
VALIDATORS: [ Validators.required, Validators.email ],
MESSAGES: {
- 'required': this.i18n('Email is required.'),
- 'email': this.i18n('Email must be valid.')
+ 'required': $localize`Email is required.`,
+ 'email': $localize`Email must be valid.`
}
}
Validators.maxLength(120)
],
MESSAGES: {
- 'required': this.i18n('Your name is required.'),
- 'minlength': this.i18n('Your name must be at least 1 character long.'),
- 'maxlength': this.i18n('Your name cannot be more than 120 characters long.')
+ 'required': $localize`Your name is required.`,
+ 'minlength': $localize`Your name must be at least 1 character long.`,
+ 'maxlength': $localize`Your name cannot be more than 120 characters long.`
}
}
Validators.maxLength(120)
],
MESSAGES: {
- 'required': this.i18n('A subject is required.'),
- 'minlength': this.i18n('The subject must be at least 1 character long.'),
- 'maxlength': this.i18n('The subject cannot be more than 120 characters long.')
+ 'required': $localize`A subject is required.`,
+ 'minlength': $localize`The subject must be at least 1 character long.`,
+ 'maxlength': $localize`The subject cannot be more than 120 characters long.`
}
}
Validators.maxLength(5000)
],
MESSAGES: {
- 'required': this.i18n('A message is required.'),
- 'minlength': this.i18n('The message must be at least 3 characters long.'),
- 'maxlength': this.i18n('The message cannot be more than 5000 characters long.')
+ 'required': $localize`A message is required.`,
+ 'minlength': $localize`The message must be at least 3 characters long.`,
+ 'maxlength': $localize`The message cannot be more than 5000 characters long.`
}
}
}
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { Validators } from '@angular/forms'
import { Injectable } from '@angular/core'
+import { Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.service'
@Injectable()
readonly LOGIN_USERNAME: BuildFormValidator
readonly LOGIN_PASSWORD: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.LOGIN_USERNAME = {
VALIDATORS: [
Validators.required
],
MESSAGES: {
- 'required': this.i18n('Username is required.')
+ 'required': $localize`Username is required.`
}
}
Validators.required
],
MESSAGES: {
- 'required': this.i18n('Password is required.')
+ 'required': $localize`Password is required.`
}
}
}
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { Validators } from '@angular/forms'
import { Injectable } from '@angular/core'
+import { Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.service'
@Injectable()
export class ResetPasswordValidatorsService {
readonly RESET_PASSWORD_CONFIRM: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.RESET_PASSWORD_CONFIRM = {
VALIDATORS: [
Validators.required
],
MESSAGES: {
- 'required': this.i18n('Confirmation of the password is required.')
+ 'required': $localize`Confirmation of the password is required.`
}
}
}
-import { I18n } from '@ngx-translate/i18n-polyfill'
+import { Injectable } from '@angular/core'
import { Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.service'
-import { Injectable } from '@angular/core'
@Injectable()
export class UserValidatorsService {
readonly USER_BAN_REASON: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.USER_USERNAME = {
VALIDATORS: [
Validators.pattern(/^[a-z0-9][a-z0-9._]*$/)
],
MESSAGES: {
- 'required': this.i18n('Username is required.'),
- 'minlength': this.i18n('Username must be at least 1 character long.'),
- 'maxlength': this.i18n('Username cannot be more than 50 characters long.'),
- 'pattern': this.i18n('Username should be lowercase alphanumeric; dots and underscores are allowed.')
+ 'required': $localize`Username is required.`,
+ 'minlength': $localize`Username must be at least 1 character long.`,
+ 'maxlength': $localize`Username cannot be more than 50 characters long.`,
+ 'pattern': $localize`Username should be lowercase alphanumeric; dots and underscores are allowed.`
}
}
Validators.pattern(/^[a-z0-9][a-z0-9._]*$/)
],
MESSAGES: {
- 'required': this.i18n('Channel name is required.'),
- 'minlength': this.i18n('Channel name must be at least 1 character long.'),
- 'maxlength': this.i18n('Channel name cannot be more than 50 characters long.'),
- 'pattern': this.i18n('Channel name should be lowercase alphanumeric; dots and underscores are allowed.')
+ 'required': $localize`Channel name is required.`,
+ 'minlength': $localize`Channel name must be at least 1 character long.`,
+ 'maxlength': $localize`Channel name cannot be more than 50 characters long.`,
+ 'pattern': $localize`Channel name should be lowercase alphanumeric; dots and underscores are allowed.`
}
}
this.USER_EMAIL = {
VALIDATORS: [ Validators.required, Validators.email ],
MESSAGES: {
- 'required': this.i18n('Email is required.'),
- 'email': this.i18n('Email must be valid.')
+ 'required': $localize`Email is required.`,
+ 'email': $localize`Email must be valid.`
}
}
Validators.maxLength(255)
],
MESSAGES: {
- 'required': this.i18n('Password is required.'),
- 'minlength': this.i18n('Password must be at least 6 characters long.'),
- 'maxlength': this.i18n('Password cannot be more than 255 characters long.')
+ 'required': $localize`Password is required.`,
+ 'minlength': $localize`Password must be at least 6 characters long.`,
+ 'maxlength': $localize`Password cannot be more than 255 characters long.`
}
}
Validators.maxLength(255)
],
MESSAGES: {
- 'minlength': this.i18n('Password must be at least 6 characters long.'),
- 'maxlength': this.i18n('Password cannot be more than 255 characters long.')
+ 'minlength': $localize`Password must be at least 6 characters long.`,
+ 'maxlength': $localize`Password cannot be more than 255 characters long.`
}
}
this.USER_CONFIRM_PASSWORD = {
VALIDATORS: [],
MESSAGES: {
- 'matchPassword': this.i18n('The new password and the confirmed password do not correspond.')
+ 'matchPassword': $localize`The new password and the confirmed password do not correspond.`
}
}
this.USER_VIDEO_QUOTA = {
VALIDATORS: [ Validators.required, Validators.min(-1) ],
MESSAGES: {
- 'required': this.i18n('Video quota is required.'),
- 'min': this.i18n('Quota must be greater than -1.')
+ 'required': $localize`Video quota is required.`,
+ 'min': $localize`Quota must be greater than -1.`
}
}
this.USER_VIDEO_QUOTA_DAILY = {
VALIDATORS: [ Validators.required, Validators.min(-1) ],
MESSAGES: {
- 'required': this.i18n('Daily upload limit is required.'),
- 'min': this.i18n('Daily upload limit must be greater than -1.')
+ 'required': $localize`Daily upload limit is required.`,
+ 'min': $localize`Daily upload limit must be greater than -1.`
}
}
this.USER_ROLE = {
VALIDATORS: [ Validators.required ],
MESSAGES: {
- 'required': this.i18n('User role is required.')
+ 'required': $localize`User role is required.`
}
}
Validators.maxLength(1000)
],
MESSAGES: {
- 'minlength': this.i18n('Description must be at least 3 characters long.'),
- 'maxlength': this.i18n('Description cannot be more than 1000 characters long.')
+ 'minlength': $localize`Description must be at least 3 characters long.`,
+ 'maxlength': $localize`Description cannot be more than 1000 characters long.`
}
}
Validators.requiredTrue
],
MESSAGES: {
- 'required': this.i18n('You must agree with the instance terms in order to register on it.')
+ 'required': $localize`You must agree with the instance terms in order to register on it.`
}
}
Validators.maxLength(250)
],
MESSAGES: {
- 'minlength': this.i18n('Ban reason must be at least 3 characters long.'),
- 'maxlength': this.i18n('Ban reason cannot be more than 250 characters long.')
+ 'minlength': $localize`Ban reason must be at least 3 characters long.`,
+ 'maxlength': $localize`Ban reason cannot be more than 250 characters long.`
}
}
}
Validators.maxLength(120)
],
MESSAGES: {
- 'required': this.i18n('Display name is required.'),
- 'minlength': this.i18n('Display name must be at least 1 character long.'),
- 'maxlength': this.i18n('Display name cannot be more than 50 characters long.')
+ 'required': $localize`Display name is required.`,
+ 'minlength': $localize`Display name must be at least 1 character long.`,
+ 'maxlength': $localize`Display name cannot be more than 50 characters long.`
}
}
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { Validators } from '@angular/forms'
import { Injectable } from '@angular/core'
+import { Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.service'
@Injectable()
export class VideoAcceptOwnershipValidatorsService {
readonly CHANNEL: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.CHANNEL = {
VALIDATORS: [ Validators.required ],
MESSAGES: {
- 'required': this.i18n('The channel is required.')
+ 'required': $localize`The channel is required.`
}
}
}
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { Validators } from '@angular/forms'
import { Injectable } from '@angular/core'
+import { Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.service'
@Injectable()
export class VideoBlockValidatorsService {
readonly VIDEO_BLOCK_REASON: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.VIDEO_BLOCK_REASON = {
VALIDATORS: [ Validators.minLength(2), Validators.maxLength(300) ],
MESSAGES: {
- 'minlength': this.i18n('Block reason must be at least 2 characters long.'),
- 'maxlength': this.i18n('Block reason cannot be more than 300 characters long.')
+ 'minlength': $localize`Block reason must be at least 2 characters long.`,
+ 'maxlength': $localize`Block reason cannot be more than 300 characters long.`
}
}
}
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { Validators } from '@angular/forms'
import { Injectable } from '@angular/core'
+import { Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.service'
@Injectable()
readonly VIDEO_CAPTION_LANGUAGE: BuildFormValidator
readonly VIDEO_CAPTION_FILE: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.VIDEO_CAPTION_LANGUAGE = {
VALIDATORS: [ Validators.required ],
MESSAGES: {
- 'required': this.i18n('Video caption language is required.')
+ 'required': $localize`Video caption language is required.`
}
}
this.VIDEO_CAPTION_FILE = {
VALIDATORS: [ Validators.required ],
MESSAGES: {
- 'required': this.i18n('Video caption file is required.')
+ 'required': $localize`Video caption file is required.`
}
}
}
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { AbstractControl, ValidationErrors, Validators } from '@angular/forms'
import { Injectable } from '@angular/core'
+import { AbstractControl, ValidationErrors, Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.service'
@Injectable()
export class VideoChangeOwnershipValidatorsService {
readonly USERNAME: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.USERNAME = {
VALIDATORS: [ Validators.required, this.localAccountValidator ],
MESSAGES: {
- 'required': this.i18n('The username is required.'),
- 'localAccountOnly': this.i18n('You can only transfer ownership to a local account')
+ 'required': $localize`The username is required.`,
+ 'localAccountOnly': $localize`You can only transfer ownership to a local account`
}
}
}
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { Validators } from '@angular/forms'
import { Injectable } from '@angular/core'
+import { Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.service'
@Injectable()
readonly VIDEO_CHANNEL_DESCRIPTION: BuildFormValidator
readonly VIDEO_CHANNEL_SUPPORT: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.VIDEO_CHANNEL_NAME = {
VALIDATORS: [
Validators.required,
Validators.pattern(/^[a-z0-9][a-z0-9._]*$/)
],
MESSAGES: {
- 'required': this.i18n('Name is required.'),
- 'minlength': this.i18n('Name must be at least 1 character long.'),
- 'maxlength': this.i18n('Name cannot be more than 50 characters long.'),
- 'pattern': this.i18n('Name should be lowercase alphanumeric; dots and underscores are allowed.')
+ 'required': $localize`Name is required.`,
+ 'minlength': $localize`Name must be at least 1 character long.`,
+ 'maxlength': $localize`Name cannot be more than 50 characters long.`,
+ 'pattern': $localize`Name should be lowercase alphanumeric; dots and underscores are allowed.`
}
}
Validators.maxLength(50)
],
MESSAGES: {
- 'required': i18n('Display name is required.'),
- 'minlength': i18n('Display name must be at least 1 character long.'),
- 'maxlength': i18n('Display name cannot be more than 50 characters long.')
+ 'required': $localize`Display name is required.`,
+ 'minlength': $localize`Display name must be at least 1 character long.`,
+ 'maxlength': $localize`Display name cannot be more than 50 characters long.`
}
}
Validators.maxLength(1000)
],
MESSAGES: {
- 'minlength': i18n('Description must be at least 3 characters long.'),
- 'maxlength': i18n('Description cannot be more than 1000 characters long.')
+ 'minlength': $localize`Description must be at least 3 characters long.`,
+ 'maxlength': $localize`Description cannot be more than 1000 characters long.`
}
}
Validators.maxLength(1000)
],
MESSAGES: {
- 'minlength': i18n('Support text must be at least 3 characters long.'),
- 'maxlength': i18n('Support text cannot be more than 1000 characters long.')
+ 'minlength': $localize`Support text must be at least 3 characters long.`,
+ 'maxlength': $localize`Support text cannot be more than 1000 characters long`
}
}
}
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { Validators } from '@angular/forms'
import { Injectable } from '@angular/core'
+import { Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.service'
@Injectable()
export class VideoCommentValidatorsService {
readonly VIDEO_COMMENT_TEXT: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.VIDEO_COMMENT_TEXT = {
VALIDATORS: [ Validators.required, Validators.minLength(1), Validators.maxLength(3000) ],
MESSAGES: {
- 'required': this.i18n('Comment is required.'),
- 'minlength': this.i18n('Comment must be at least 2 characters long.'),
- 'maxlength': this.i18n('Comment cannot be more than 3000 characters long.')
+ 'required': $localize`Comment is required.`,
+ 'minlength': $localize`Comment must be at least 2 characters long.`,
+ 'maxlength': $localize`Comment cannot be more than 3000 characters long.`
}
}
}
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { AbstractControl, FormControl, Validators } from '@angular/forms'
import { Injectable } from '@angular/core'
-import { BuildFormValidator } from './form-validator.service'
+import { AbstractControl, Validators } from '@angular/forms'
import { VideoPlaylistPrivacy } from '@shared/models'
+import { BuildFormValidator } from './form-validator.service'
@Injectable()
export class VideoPlaylistValidatorsService {
readonly VIDEO_PLAYLIST_DESCRIPTION: BuildFormValidator
readonly VIDEO_PLAYLIST_CHANNEL_ID: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.VIDEO_PLAYLIST_DISPLAY_NAME = {
VALIDATORS: [
Validators.required,
Validators.maxLength(120)
],
MESSAGES: {
- 'required': this.i18n('Display name is required.'),
- 'minlength': this.i18n('Display name must be at least 1 character long.'),
- 'maxlength': this.i18n('Display name cannot be more than 120 characters long.')
+ 'required': $localize`Display name is required.`,
+ 'minlength': $localize`Display name must be at least 1 character long.`,
+ 'maxlength': $localize`Display name cannot be more than 120 characters long.`
}
}
Validators.required
],
MESSAGES: {
- 'required': this.i18n('Privacy is required.')
+ 'required': $localize`Privacy is required.`
}
}
Validators.maxLength(1000)
],
MESSAGES: {
- 'minlength': i18n('Description must be at least 3 characters long.'),
- 'maxlength': i18n('Description cannot be more than 1000 characters long.')
+ 'minlength': $localize`Description must be at least 3 characters long.`,
+ 'maxlength': $localize`Description cannot be more than 1000 characters long.`
}
}
this.VIDEO_PLAYLIST_CHANNEL_ID = {
VALIDATORS: [ ],
MESSAGES: {
- 'required': this.i18n('The channel is required when the playlist is public.')
+ 'required': $localize`The channel is required when the playlist is public.`
}
}
}
-import { I18n } from '@ngx-translate/i18n-polyfill'
-import { Validators, ValidatorFn, ValidationErrors, AbstractControl } from '@angular/forms'
import { Injectable } from '@angular/core'
+import { AbstractControl, ValidationErrors, ValidatorFn, Validators } from '@angular/forms'
import { BuildFormValidator } from './form-validator.service'
@Injectable()
readonly VIDEO_SCHEDULE_PUBLICATION_AT: BuildFormValidator
readonly VIDEO_ORIGINALLY_PUBLISHED_AT: BuildFormValidator
- constructor (private i18n: I18n) {
+ constructor () {
this.VIDEO_NAME = {
VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(120) ],
MESSAGES: {
- 'required': this.i18n('Video name is required.'),
- 'minlength': this.i18n('Video name must be at least 3 characters long.'),
- 'maxlength': this.i18n('Video name cannot be more than 120 characters long.')
+ 'required': $localize`Video name is required.`,
+ 'minlength': $localize`Video name must be at least 3 characters long.`,
+ 'maxlength': $localize`Video name cannot be more than 120 characters long.`
}
}
this.VIDEO_PRIVACY = {
VALIDATORS: [ Validators.required ],
MESSAGES: {
- 'required': this.i18n('Video privacy is required.')
+ 'required': $localize`Video privacy is required.`
}
}
this.VIDEO_CHANNEL = {
VALIDATORS: [ Validators.required ],
MESSAGES: {
- 'required': this.i18n('Video channel is required.')
+ 'required': $localize`Video channel is required.`
}
}
this.VIDEO_DESCRIPTION = {
VALIDATORS: [ Validators.minLength(3), Validators.maxLength(10000) ],
MESSAGES: {
- 'minlength': this.i18n('Video description must be at least 3 characters long.'),
- 'maxlength': this.i18n('Video description cannot be more than 10000 characters long.')
+ 'minlength': $localize`Video description must be at least 3 characters long.`,
+ 'maxlength': $localize`Video description cannot be more than 10000 characters long.`
}
}
this.VIDEO_TAG = {
VALIDATORS: [ Validators.minLength(2), Validators.maxLength(30) ],
MESSAGES: {
- 'minlength': this.i18n('A tag should be more than 2 characters long.'),
- 'maxlength': this.i18n('A tag should be less than 30 characters long.')
+ 'minlength': $localize`A tag should be more than 2 characters long.`,
+ 'maxlength': $localize`A tag should be less than 30 characters long.`
}
}
this.VIDEO_TAGS_ARRAY = {
VALIDATORS: [ Validators.maxLength(5), this.arrayTagLengthValidator() ],
MESSAGES: {
- 'maxlength': this.i18n('A maximum of 5 tags can be used on a video.'),
- 'arrayTagLength': this.i18n('A tag should be more than 2, and less than 30 characters long.')
+ 'maxlength': $localize`A maximum of 5 tags can be used on a video.`,
+ 'arrayTagLength': $localize`A tag should be more than 2, and less than 30 characters long.`
}
}
this.VIDEO_SUPPORT = {
VALIDATORS: [ Validators.minLength(3), Validators.maxLength(1000) ],
MESSAGES: {
- 'minlength': this.i18n('Video support must be at least 3 characters long.'),
- 'maxlength': this.i18n('Video support cannot be more than 1000 characters long.')
+ 'minlength': $localize`Video support must be at least 3 characters long.`,
+ 'maxlength': $localize`Video support cannot be more than 1000 characters long.`
}
}
this.VIDEO_SCHEDULE_PUBLICATION_AT = {
VALIDATORS: [ ],
MESSAGES: {
- 'required': this.i18n('A date is required to schedule video update.')
+ 'required': $localize`A date is required to schedule video update.`
}
}
import { Component, Input } from '@angular/core'
import { Notifier } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-input-readonly-copy',
export class InputReadonlyCopyComponent {
@Input() value = ''
- constructor (
- private notifier: Notifier,
- private i18n: I18n
- ) { }
+ constructor (private notifier: Notifier) { }
activateCopiedMessage () {
- this.notifier.success(this.i18n('Copied'))
+ this.notifier.success($localize`Copied`)
}
}
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'
import { ServerService } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig } from '@shared/models'
import { BytesPipe } from '../shared-main'
constructor (
private sanitizer: DomSanitizer,
- private serverService: ServerService,
- private i18n: I18n
+ private serverService: ServerService
) {
this.bytesPipe = new BytesPipe()
- this.maxSizeText = this.i18n('max size')
+ this.maxSizeText = $localize`max size`
}
get videoImageExtensions () {
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
import { Notifier } from '@app/core'
import { GlobalIconName } from '@app/shared/shared-icons'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-reactive-file',
private file: File
- constructor (
- private notifier: Notifier,
- private i18n: I18n
- ) {}
+ constructor (private notifier: Notifier) { }
get filename () {
if (!this.file) return ''
const [ file ] = event.target.files
if (file.size > this.maxFileSize) {
- this.notifier.error(this.i18n('This file is too large.'))
+ this.notifier.error($localize`This file is too large.`)
return
}
const extension = '.' + file.name.split('.').pop()
if (this.extensions.includes(extension) === false) {
- const message = this.i18n(
- 'PeerTube cannot handle this kind of file. Accepted extensions are {{extensions}}.',
- { extensions: this.allowedExtensionsMessage }
- )
+ const message = $localize`PeerTube cannot handle this kind of file. Accepted extensions are ${this.allowedExtensionsMessage}}.`
this.notifier.error(message)
return
-import { Component, Input, forwardRef, OnInit } from '@angular/core'
-import { NG_VALUE_ACCESSOR, ControlValueAccessor } from '@angular/forms'
+import { Component, forwardRef, Input, OnInit } from '@angular/core'
+import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
import { SelectOptionsItem } from './select-options.component'
-import { I18n } from '@ngx-translate/i18n-polyfill'
export type ItemSelectCheckboxValue = { id?: string | number, group?: string } | string
@Input() maxSelectedItems: number
@Input() placeholder: string
- constructor (
- private i18n: I18n
- ) {}
-
ngOnInit () {
- if (!this.placeholder) this.placeholder = this.i18n('Add a new option')
+ if (!this.placeholder) this.placeholder = $localize`Add a new option`
}
propagateChange = (_: any) => { /* empty */ }
import { Component, OnInit } from '@angular/core'
import { ServerService } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig } from '@shared/models'
@Component({
quotaHelpIndication = ''
serverConfig: ServerConfig
- constructor (
- private i18n: I18n,
- private serverService: ServerService
- ) {
- }
+ constructor (private serverService: ServerService) { }
get initialUserVideoQuota () {
return this.serverConfig.user.videoQuota
buildNSFWLabel () {
const policy = this.serverConfig.instance.defaultNSFWPolicy
- if (policy === 'do_not_list') return this.i18n('Hidden')
- if (policy === 'blur') return this.i18n('Blurred with confirmation request')
- if (policy === 'display') return this.i18n('Displayed')
+ if (policy === 'do_not_list') return $localize`Hidden`
+ if (policy === 'blur') return $localize`Blurred with confirmation request`
+ if (policy === 'display') return $localize`Displayed`
}
getServerVersionAndCommit () {
const minutes = Math.floor(seconds % 3600 / 60)
- return this.i18n('~ {{minutes}} {minutes, plural, =1 {minute} other {minutes}}', { minutes })
+ if (minutes === 1) return $localize`~ 1 minute`
+
+ return $localize`~ ${minutes} minutes`
}
private buildQuotaHelpIndication () {
const normalSeconds = initialUserVideoQuotaBit / (1.5 * 1000 * 1000)
const lines = [
- this.i18n('{{seconds}} of full HD videos', { seconds: this.getApproximateTime(fullHdSeconds) }),
- this.i18n('{{seconds}} of HD videos', { seconds: this.getApproximateTime(hdSeconds) }),
- this.i18n('{{seconds}} of average quality videos', { seconds: this.getApproximateTime(normalSeconds) })
+ $localize`${this.getApproximateTime(fullHdSeconds)} of full HD videos`,
+ $localize`${this.getApproximateTime(hdSeconds)} of HD videos`,
+ $localize`${this.getApproximateTime(normalSeconds)} of average quality videos`
]
this.quotaHelpIndication = lines.join('<br />')
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core'
import { Notifier, ServerService } from '@app/core'
import { Account, BytesPipe, VideoChannel } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig } from '@shared/models'
@Component({
constructor (
private serverService: ServerService,
- private notifier: Notifier,
- private i18n: I18n
+ private notifier: Notifier
) {
this.bytesPipe = new BytesPipe()
- this.maxSizeText = this.i18n('max size')
+ this.maxSizeText = $localize`max size`
}
ngOnInit (): void {
import { Component, Input, OnInit } from '@angular/core'
import { Video } from '../video/video.model'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'avatar-channel',
channelLinkTitle = ''
accountLinkTitle = ''
- constructor (
- private i18n: I18n
- ) {}
-
ngOnInit () {
- this.channelLinkTitle = this.i18n(
- '{{name}} (channel page)',
- { name: this.video.channel.name, handle: this.video.byVideoChannel }
- )
- this.accountLinkTitle = this.i18n(
- '{{name}} (account page)',
- { name: this.video.account.name, handle: this.video.byAccount }
- )
+ this.channelLinkTitle = $localize`${this.video.account.name} (channel page)`
+ this.accountLinkTitle = $localize`${this.video.byAccount} (account page)`
}
isChannelAvatarNull () {
import { Pipe, PipeTransform } from '@angular/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
// Thanks: https://stackoverflow.com/questions/3177836/how-to-format-time-since-xxx-e-g-4-minutes-ago-similar-to-stack-exchange-site
@Pipe({ name: 'myFromNow' })
export class FromNowPipe implements PipeTransform {
- constructor (private i18n: I18n) { }
-
transform (arg: number | Date | string) {
const argDate = new Date(arg)
const seconds = Math.floor((Date.now() - argDate.getTime()) / 1000)
let interval = Math.floor(seconds / 31536000)
- if (interval > 1) return this.i18n('{{interval}} years ago', { interval })
- if (interval === 1) return this.i18n('{{interval}} year ago', { interval })
+ if (interval > 1) return $localize`${interval} years ago`
+ if (interval === 1) return $localize`${interval} year ago`
interval = Math.floor(seconds / 2592000)
- if (interval > 1) return this.i18n('{{interval}} months ago', { interval })
- if (interval === 1) return this.i18n('{{interval}} month ago', { interval })
+ if (interval > 1) return $localize`${interval} months ago`
+ if (interval === 1) return $localize`${interval} month ago`
interval = Math.floor(seconds / 604800)
- if (interval > 1) return this.i18n('{{interval}} weeks ago', { interval })
- if (interval === 1) return this.i18n('{{interval}} week ago', { interval })
+ if (interval > 1) return $localize`${interval} weeks ago`
+ if (interval === 1) return $localize`${interval} week ago`
interval = Math.floor(seconds / 86400)
- if (interval > 1) return this.i18n('{{interval}} days ago', { interval })
- if (interval === 1) return this.i18n('{{interval}} day ago', { interval })
+ if (interval > 1) return $localize`${interval} days ago`
+ if (interval === 1) return $localize`${interval} day ago`
interval = Math.floor(seconds / 3600)
- if (interval > 1) return this.i18n('{{interval}} hours ago', { interval })
- if (interval === 1) return this.i18n('{{interval}} hour ago', { interval })
+ if (interval > 1) return $localize`${interval} hours ago`
+ if (interval === 1) return $localize`${interval} hour ago`
interval = Math.floor(seconds / 60)
- if (interval >= 1) return this.i18n('{{interval}} min ago', { interval })
+ if (interval >= 1) return $localize`${interval} min ago`
- return this.i18n('just now')
+ return $localize`just now`
}
}
import { Component, Input, OnInit } from '@angular/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-delete-button',
@Input() label: string
@Input() title: string
- constructor (private i18n: I18n) { }
-
ngOnInit () {
// <my-delete-button /> No label
if (this.label === undefined && !this.title) {
- this.title = this.i18n('Delete')
+ this.title = $localize`Delete`
}
// <my-delete-button label /> Use default label
if (this.label === '') {
- this.label = this.i18n('Delete')
+ this.label = $localize`Delete`
if (!this.title) {
this.title = this.label
import { Component, Input, OnInit } from '@angular/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-edit-button',
@Input() title: string
@Input() routerLink: string[] | string = []
- constructor (private i18n: I18n) { }
-
ngOnInit () {
// <my-edit-button /> No label
if (this.label === undefined && !this.title) {
- this.title = this.i18n('Update')
+ this.title = $localize`Update`
}
// <my-edit-button label /> Use default label
if (this.label === '') {
- this.label = this.i18n('Update')
+ this.label = $localize`Update`
if (!this.title) {
this.title = this.label
import { AfterContentInit, Component, ContentChildren, Input, OnChanges, OnInit, QueryList, TemplateRef } from '@angular/core'
import { MarkdownService } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { PeerTubeTemplateDirective } from '../angular'
@Component({
customHtmlTemplate: TemplateRef<any>
postHtmlTemplate: TemplateRef<any>
- constructor (private i18n: I18n) { }
-
ngOnInit () {
this.init()
}
private formatMarkdownSupport (rules: string[]) {
// tslint:disable:max-line-length
- return this.i18n('<a href="https://en.wikipedia.org/wiki/Markdown#Example" target="_blank" rel="noopener noreferrer">Markdown</a> compatible that supports:') +
+ return $localize`<a href="https://en.wikipedia.org/wiki/Markdown#Example" target="_blank" rel="noopener noreferrer">Markdown</a> compatible that supports:` +
this.createMarkdownList(rules)
}
private createMarkdownList (rules: string[]) {
const rulesToText = {
- 'emphasis': this.i18n('Emphasis'),
- 'link': this.i18n('Links'),
- 'newline': this.i18n('New lines'),
- 'list': this.i18n('Lists'),
- 'image': this.i18n('Images')
+ 'emphasis': $localize`Emphasis`,
+ 'link': $localize`Links`,
+ 'newline': $localize`New lines`,
+ 'list': $localize`Lists`,
+ 'image': $localize`Images`
}
const bullets = rules.map(r => rulesToText[r])
NgbPopoverModule,
NgbTooltipModule
} from '@ng-bootstrap/ng-bootstrap'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { SharedGlobalIconModule } from '../shared-icons'
import { AccountService, ActorAvatarInfoComponent, AvatarComponent } from './account'
import { FromNowPipe, InfiniteScrollerDirective, NumberFormatterPipe, PeerTubeTemplateDirective, BytesPipe } from './angular'
],
providers: [
- I18n,
-
DatePipe,
FromNowPipe,
import { Subject } from 'rxjs'
import { Component, Input, OnInit } from '@angular/core'
import { User, UserService } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { BytesPipe } from '../angular'
@Component({
userVideoQuotaUsedDaily = 0
userVideoQuotaDailyPercentage = 15
- constructor (
- private userService: UserService,
- private i18n: I18n
- ) { }
+ constructor (private userService: UserService) { }
ngOnInit () {
this.userInformationLoaded.subscribe(
if (this.user.videoQuota !== -1) {
this.userVideoQuota = new BytesPipe().transform(this.user.videoQuota, 0).toString()
} else {
- this.userVideoQuota = this.i18n('Unlimited')
+ this.userVideoQuota = $localize`Unlimited`
}
if (this.user.videoQuotaDaily !== -1) {
this.userVideoQuotaDaily = new BytesPipe().transform(this.user.videoQuotaDaily, 0).toString()
} else {
- this.userVideoQuotaDaily = this.i18n('Unlimited')
+ this.userVideoQuotaDaily = $localize`Unlimited`
}
}
)
import { Injectable } from '@angular/core'
import { ComponentPaginationLight, RestExtractor, RestService, ServerService, UserService } from '@app/core'
import { objectToFormData } from '@app/helpers'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import {
FeedFormat,
NSFWPolicyType,
Video as VideoServerModel,
VideoConstant,
VideoDetails as VideoDetailsServerModel,
+ VideoFileMetadata,
VideoFilter,
VideoPrivacy,
VideoSortField,
- VideoUpdate,
- VideoFileMetadata
+ VideoUpdate
} from '@shared/models'
import { environment } from '../../../../environments/environment'
import { Account, AccountService } from '../account'
private authHttp: HttpClient,
private restExtractor: RestExtractor,
private restService: RestService,
- private serverService: ServerService,
- private i18n: I18n
+ private serverService: ServerService
) {}
getVideoViewUrl (uuid: string) {
const base = [
{
id: VideoPrivacy.PRIVATE,
- description: this.i18n('Only I can see this video')
+ description: $localize`Only I can see this video`
},
{
id: VideoPrivacy.UNLISTED,
- description: this.i18n('Only shareable via a private link')
+ description: $localize`Only shareable via a private link`
},
{
id: VideoPrivacy.PUBLIC,
- description: this.i18n('Anyone can see this video')
+ description: $localize`Anyone can see this video`
},
{
id: VideoPrivacy.INTERNAL,
- description: this.i18n('Only users of this instance can see this video')
+ description: $localize`Only users of this instance can see this video`
}
]
import { HttpClient, HttpParams } from '@angular/common/http'
import { Injectable } from '@angular/core'
import { RestExtractor, RestPagination, RestService } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import {
AbuseCreate,
AbuseFilter,
private static BASE_MY_ABUSE_URL = environment.apiUrl + '/api/v1/users/me/abuses'
constructor (
- private i18n: I18n,
private authHttp: HttpClient,
private restService: RestService,
private restExtractor: RestExtractor
let reasons: { id: AbusePredefinedReasonsString, label: string, description?: string, help?: string }[] = [
{
id: 'violentOrRepulsive',
- label: this.i18n('Violent or repulsive'),
- help: this.i18n('Contains offensive, violent, or coarse language or iconography.')
+ label: $localize`Violent or repulsive`,
+ help: $localize`Contains offensive, violent, or coarse language or iconography.`
},
{
id: 'hatefulOrAbusive',
- label: this.i18n('Hateful or abusive'),
- help: this.i18n('Contains abusive, racist or sexist language or iconography.')
+ label: $localize`Hateful or abusive`,
+ help: $localize`Contains abusive, racist or sexist language or iconography.`
},
{
id: 'spamOrMisleading',
- label: this.i18n('Spam, ad or false news'),
- help: this.i18n('Contains marketing, spam, purposefully deceitful news, or otherwise misleading thumbnail/text/tags. Please provide reputable sources to report hoaxes.')
+ label: $localize`Spam, ad or false news`,
+ help: $localize`Contains marketing, spam, purposefully deceitful news, or otherwise misleading thumbnail/text/tags. Please provide reputable sources to report hoaxes.`
},
{
id: 'privacy',
- label: this.i18n('Privacy breach or doxxing'),
- help: this.i18n('Contains personal information that could be used to track, identify, contact or impersonate someone (e.g. name, address, phone number, email, or credit card details).')
+ label: $localize`Privacy breach or doxxing`,
+ help: $localize`Contains personal information that could be used to track, identify, contact or impersonate someone (e.g. name, address, phone number, email, or credit card details).`
},
{
id: 'rights',
- label: this.i18n('Copyright'),
- help: this.i18n('Infringes your copyright wrt. the regional laws with which the server must comply.')
+ label: $localize`Copyright`,
+ help: $localize`Infringes your copyright wrt. the regional laws with which the server must comply.`
},
{
id: 'serverRules',
- label: this.i18n('Breaks server rules'),
- description: this.i18n('Anything not included in the above that breaks the terms of service, code of conduct, or general rules in place on the server.')
+ label: $localize`Breaks server rules`,
+ description: $localize`Anything not included in the above that breaks the terms of service, code of conduct, or general rules in place on the server.`
}
]
reasons = reasons.concat([
{
id: 'thumbnails',
- label: this.i18n('Thumbnails'),
- help: this.i18n('The above can only be seen in thumbnails.')
+ label: $localize`Thumbnails`,
+ help: $localize`The above can only be seen in thumbnails.`
},
{
id: 'captions',
- label: this.i18n('Captions'),
- help: this.i18n('The above can only be seen in captions (please describe which).')
+ label: $localize`Captions`,
+ help: $localize`The above can only be seen in captions (please describe which).`
}
])
}
import { SortMeta } from 'primeng/api'
-import { OnInit, Directive } from '@angular/core'
+import { Directive, OnInit } from '@angular/core'
import { Notifier, RestPagination, RestTable } from '@app/core'
import { Actor } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { AccountBlock } from './account-block.model'
import { BlocklistComponentType, BlocklistService } from './blocklist.service'
constructor (
private notifier: Notifier,
- private blocklistService: BlocklistService,
- private i18n: I18n
+ private blocklistService: BlocklistService
) {
super()
}
() => {
this.notifier.success(
this.mode === BlocklistComponentType.Account
- ? this.i18n('Account {{nameWithHost}} unmuted.', { nameWithHost: blockedAccount.nameWithHost })
- : this.i18n('Account {{nameWithHost}} unmuted by your instance.', { nameWithHost: blockedAccount.nameWithHost })
+ ? $localize`Account ${blockedAccount.nameWithHost} unmuted.`
+ : $localize`Account ${blockedAccount.nameWithHost} unmuted by your instance.`
)
this.loadData()
import { BatchDomainsValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
-import { I18n } from '@ngx-translate/i18n-polyfill'
@Component({
selector: 'my-batch-domains-modal',
constructor (
protected formValidatorService: FormValidatorService,
private modalService: NgbModal,
- private batchDomainsValidatorsService: BatchDomainsValidatorsService,
- private i18n: I18n
+ private batchDomainsValidatorsService: BatchDomainsValidatorsService
) {
super()
}
ngOnInit () {
- if (!this.action) this.action = this.i18n('Process domains')
+ if (!this.action) this.action = $localize`Process domains`
this.buildForm({
domains: this.batchDomainsValidatorsService.DOMAINS
import { Account } from '@app/shared/shared-main'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
import { AbusePredefinedReasonsString } from '@shared/models'
import { AbuseService } from '../abuse.service'
private modalService: NgbModal,
private abuseValidatorsService: AbuseValidatorsService,
private abuseService: AbuseService,
- private notifier: Notifier,
- private i18n: I18n
+ private notifier: Notifier
) {
super()
}
}
ngOnInit () {
- this.modalTitle = this.i18n('Report {{displayName}}', { displayName: this.account.displayName })
+ this.modalTitle = $localize`Report ${this.account.displayName}`
this.buildForm({
reason: this.abuseValidatorsService.ABUSE_REASON,
}
}).subscribe(
() => {
- this.notifier.success(this.i18n('Account reported.'))
+ this.notifier.success($localize`Account reported.`)
this.hide()
},
import { VideoComment } from '@app/shared/shared-video-comment'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
import { AbusePredefinedReasonsString } from '@shared/models'
import { AbuseService } from '../abuse.service'
private modalService: NgbModal,
private abuseValidatorsService: AbuseValidatorsService,
private abuseService: AbuseService,
- private notifier: Notifier,
- private i18n: I18n
+ private notifier: Notifier
) {
super()
}
}
ngOnInit () {
- this.modalTitle = this.i18n('Report comment')
+ this.modalTitle = $localize`Report comment`
this.buildForm({
reason: this.abuseValidatorsService.ABUSE_REASON,
}
}).subscribe(
() => {
- this.notifier.success(this.i18n('Comment reported.'))
+ this.notifier.success($localize`Comment reported.`)
this.hide()
},
import { mapValues, pickBy } from 'lodash-es'
-import { buildVideoOrPlaylistEmbed, buildVideoLink } from 'src/assets/player/utils'
+import { buildVideoLink, buildVideoOrPlaylistEmbed } from 'src/assets/player/utils'
import { Component, Input, OnInit, ViewChild } from '@angular/core'
import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
import { Notifier } from '@app/core'
import { AbuseValidatorsService, FormReactive, FormValidatorService } from '@app/shared/shared-forms'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse'
import { AbusePredefinedReasonsString } from '@shared/models'
import { Video } from '../../shared-main'
private abuseValidatorsService: AbuseValidatorsService,
private abuseService: AbuseService,
private notifier: Notifier,
- private sanitizer: DomSanitizer,
- private i18n: I18n
+ private sanitizer: DomSanitizer
) {
super()
}
}
}).subscribe(
() => {
- this.notifier.success(this.i18n('Video reported.'))
+ this.notifier.success($localize`Video reported.`)
this.hide()
},
import { Directive, OnInit, ViewChild } from '@angular/core'
import { Notifier, RestPagination, RestTable } from '@app/core'
import { BatchDomainsModalComponent } from '@app/shared/shared-moderation/batch-domains-modal.component'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerBlock } from '@shared/models'
import { BlocklistComponentType, BlocklistService } from './blocklist.service'
constructor (
protected notifier: Notifier,
- protected blocklistService: BlocklistService,
- protected i18n: I18n
+ protected blocklistService: BlocklistService
) {
super()
}
() => {
this.notifier.success(
this.mode === BlocklistComponentType.Account
- ? this.i18n('Instance {{host}} unmuted.', { host })
- : this.i18n('Instance {{host}} unmuted by your instance.', { host })
+ ? $localize`Instance ${host} unmuted.`
+ : $localize`Instance ${host} unmuted by your instance.`
)
this.loadData()
() => {
this.notifier.success(
this.mode === BlocklistComponentType.Account
- ? this.i18n('Instance {{domain}} muted.', { domain })
- : this.i18n('Instance {{domain}} muted by your instance.', { domain })
+ ? $localize`Instance ${domain} muted.`
+ : $localize`Instance ${domain} muted by your instance.`
)
this.loadData()
import { FormReactive, FormValidatorService, UserValidatorsService } from '@app/shared/shared-forms'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { User } from '@shared/models'
@Component({
private modalService: NgbModal,
private notifier: Notifier,
private userService: UserService,
- private userValidatorsService: UserValidatorsService,
- private i18n: I18n
+ private userValidatorsService: UserValidatorsService
) {
super()
}
.subscribe(
() => {
const message = Array.isArray(this.usersToBan)
- ? this.i18n('{{num}} users banned.', { num: this.usersToBan.length })
- : this.i18n('User {{username}} banned.', { username: this.usersToBan.username })
+ ? $localize`${this.usersToBan.length} users banned.`
+ : $localize`User ${this.usersToBan.username} banned.`
this.notifier.success(message)
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewChild } from '@angular/core'
import { AuthService, ConfirmService, Notifier, ServerService, UserService } from '@app/core'
import { Account, DropdownAction } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { BulkRemoveCommentsOfBody, ServerConfig, User, UserRight } from '@shared/models'
import { BlocklistService } from './blocklist.service'
import { BulkService } from './bulk.service'
private serverService: ServerService,
private userService: UserService,
private blocklistService: BlocklistService,
- private bulkService: BulkService,
- private i18n: I18n
+ private bulkService: BulkService
) { }
get requiresEmailVerification () {
openBanUserModal (user: User) {
if (user.username === 'root') {
- this.notifier.error(this.i18n('You cannot ban root.'))
+ this.notifier.error($localize`You cannot ban root.`)
return
}
}
async unbanUser (user: User) {
- const message = this.i18n('Do you really want to unban {{username}}?', { username: user.username })
- const res = await this.confirmService.confirm(message, this.i18n('Unban'))
+ const res = await this.confirmService.confirm($localize`Do you really want to unban ${user.username}?`, $localize`Unban`)
if (res === false) return
this.userService.unbanUsers(user)
.subscribe(
() => {
- this.notifier.success(this.i18n('User {{username}} unbanned.', { username: user.username }))
-
+ this.notifier.success($localize`User ${user.username} unbanned.`)
this.userChanged.emit()
},
async removeUser (user: User) {
if (user.username === 'root') {
- this.notifier.error(this.i18n('You cannot delete root.'))
+ this.notifier.error($localize`You cannot delete root.`)
return
}
- const message = this.i18n('If you remove this user, you will not be able to create another with the same username!')
- const res = await this.confirmService.confirm(message, this.i18n('Delete'))
+ const message = $localize`If you remove this user, you will not be able to create another with the same username!`
+ const res = await this.confirmService.confirm(message, $localize`Delete`)
if (res === false) return
this.userService.removeUser(user).subscribe(
() => {
- this.notifier.success(this.i18n('User {{username}} deleted.', { username: user.username }))
+ this.notifier.success($localize`User ${user.username} deleted.`)
this.userDeleted.emit()
},
setEmailAsVerified (user: User) {
this.userService.updateUser(user.id, { emailVerified: true }).subscribe(
() => {
- this.notifier.success(this.i18n('User {{username}} email set as verified', { username: user.username }))
-
+ this.notifier.success($localize`User ${user.username} email set as verified`)
this.userChanged.emit()
},
this.blocklistService.blockAccountByUser(account)
.subscribe(
() => {
- this.notifier.success(this.i18n('Account {{nameWithHost}} muted.', { nameWithHost: account.nameWithHost }))
+ this.notifier.success($localize`Account ${account.nameWithHost} muted.`)
this.account.mutedByUser = true
this.userChanged.emit()
this.blocklistService.unblockAccountByUser(account)
.subscribe(
() => {
- this.notifier.success(this.i18n('Account {{nameWithHost}} unmuted.', { nameWithHost: account.nameWithHost }))
+ this.notifier.success($localize`Account ${account.nameWithHost} unmuted.`)
this.account.mutedByUser = false
this.userChanged.emit()
this.blocklistService.blockServerByUser(host)
.subscribe(
() => {
- this.notifier.success(this.i18n('Instance {{host}} muted.', { host }))
+ this.notifier.success($localize`Instance ${host} muted.`)
this.account.mutedServerByUser = true
this.userChanged.emit()
this.blocklistService.unblockServerByUser(host)
.subscribe(
() => {
- this.notifier.success(this.i18n('Instance {{host}} unmuted.', { host }))
+ this.notifier.success($localize`Instance ${host} unmuted.`)
this.account.mutedServerByUser = false
this.userChanged.emit()
this.blocklistService.blockAccountByInstance(account)
.subscribe(
() => {
- this.notifier.success(this.i18n('Account {{nameWithHost}} muted by the instance.', { nameWithHost: account.nameWithHost }))
+ this.notifier.success($localize`Account ${account.nameWithHost} muted by the instance.`)
this.account.mutedByInstance = true
this.userChanged.emit()
this.blocklistService.unblockAccountByInstance(account)
.subscribe(
() => {
- this.notifier.success(this.i18n('Account {{nameWithHost}} unmuted by the instance.', { nameWithHost: account.nameWithHost }))
+ this.notifier.success($localize`Account ${account.nameWithHost} unmuted by the instance.`)
this.account.mutedByInstance = false
this.userChanged.emit()
this.blocklistService.blockServerByInstance(host)
.subscribe(
() => {
- this.notifier.success(this.i18n('Instance {{host}} muted by the instance.', { host }))
+ this.notifier.success($localize`Instance ${host} muted by the instance.`)
this.account.mutedServerByInstance = true
this.userChanged.emit()
this.blocklistService.unblockServerByInstance(host)
.subscribe(
() => {
- this.notifier.success(this.i18n('Instance {{host}} unmuted by the instance.', { host }))
+ this.notifier.success($localize`Instance ${host} unmuted by the instance.`)
this.account.mutedServerByInstance = false
this.userChanged.emit()
}
async bulkRemoveCommentsOf (body: BulkRemoveCommentsOfBody) {
- const message = this.i18n('Are you sure you want to remove all the comments of this account?')
- const res = await this.confirmService.confirm(message, this.i18n('Delete account comments'))
+ const message = $localize`Are you sure you want to remove all the comments of this account?`
+ const res = await this.confirmService.confirm(message, $localize`Delete account comments`)
if (res === false) return
this.bulkService.removeCommentsOf(body)
.subscribe(
() => {
- this.notifier.success(this.i18n('Will remove comments of this account (may take several minutes).'))
+ this.notifier.success($localize`Will remove comments of this account (may take several minutes).`)
},
err => this.notifier.error(err.message)
if (this.user && authUser.hasRight(UserRight.MANAGE_USERS) && authUser.canManage(this.user)) {
this.userActions.push([
{
- label: this.i18n('Edit user'),
- description: this.i18n('Change quota, role, and more.'),
+ label: $localize`Edit user`,
+ description: $localize`Change quota, role, and more.`,
linkBuilder: ({ user }) => this.getRouterUserEditLink(user)
},
{
- label: this.i18n('Delete user'),
- description: this.i18n('Videos will be deleted, comments will be tombstoned.'),
+ label: $localize`Delete user`,
+ description: $localize`Videos will be deleted, comments will be tombstoned.`,
handler: ({ user }) => this.removeUser(user)
},
{
- label: this.i18n('Ban'),
- description: this.i18n('User won\'t be able to login anymore, but videos and comments will be kept as is.'),
+ label: $localize`Ban`,
+ description: $localize`User won't be able to login anymore, but videos and comments will be kept as is.`,
handler: ({ user }) => this.openBanUserModal(user),
isDisplayed: ({ user }) => !user.blocked
},
{
- label: this.i18n('Unban user'),
- description: this.i18n('Allow the user to login and create videos/comments again'),
+ label: $localize`Unban user`,
+ description: $localize`Allow the user to login and create videos/comments again`,
handler: ({ user }) => this.unbanUser(user),
isDisplayed: ({ user }) => user.blocked
},
{
- label: this.i18n('Set Email as Verified'),
+ label: $localize`Set Email as Verified`,
handler: ({ user }) => this.setEmailAsVerified(user),
isDisplayed: ({ user }) => this.requiresEmailVerification && !user.blocked && user.emailVerified === false
}
// User actions
this.userActions.push([
{
- label: this.i18n('Mute this account'),
- description: this.i18n('Hide any content from that user for you.'),
+ label: $localize`Mute this account`,
+ description: $localize`Hide any content from that user for you.`,
isDisplayed: ({ account }) => account.mutedByUser === false,
handler: ({ account }) => this.blockAccountByUser(account)
},
{
- label: this.i18n('Unmute this account'),
- description: this.i18n('Show back content from that user for you.'),
+ label: $localize`Unmute this account`,
+ description: $localize`Show back content from that user for you.`,
isDisplayed: ({ account }) => account.mutedByUser === true,
handler: ({ account }) => this.unblockAccountByUser(account)
},
{
- label: this.i18n('Mute the instance'),
- description: this.i18n('Hide any content from that instance for you.'),
+ label: $localize`Mute the instance`,
+ description: $localize`Hide any content from that instance for you.`,
isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === false,
handler: ({ account }) => this.blockServerByUser(account.host)
},
{
- label: this.i18n('Unmute the instance'),
- description: this.i18n('Show back content from that instance for you.'),
+ label: $localize`Unmute the instance`,
+ description: $localize`Show back content from that instance for you.`,
isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === true,
handler: ({ account }) => this.unblockServerByUser(account.host)
},
{
- label: this.i18n('Remove comments from your videos'),
- description: this.i18n('Remove comments of this account from your videos.'),
+ label: $localize`Remove comments from your videos`,
+ description: $localize`Remove comments of this account from your videos.`,
handler: ({ account }) => this.bulkRemoveCommentsOf({ accountName: account.nameWithHost, scope: 'my-videos' })
}
])
if (authUser.hasRight(UserRight.MANAGE_ACCOUNTS_BLOCKLIST)) {
instanceActions = instanceActions.concat([
{
- label: this.i18n('Mute this account by your instance'),
- description: this.i18n('Hide any content from that user for you, your instance and its users.'),
+ label: $localize`Mute this account by your instance`,
+ description: $localize`Hide any content from that user for you, your instance and its users.`,
isDisplayed: ({ account }) => account.mutedByInstance === false,
handler: ({ account }) => this.blockAccountByInstance(account)
},
{
- label: this.i18n('Unmute this account by your instance'),
- description: this.i18n('Show back content from that user for you, your instance and its users.'),
+ label: $localize`Unmute this account by your instance`,
+ description: $localize`Show back content from that user for you, your instance and its users.`,
isDisplayed: ({ account }) => account.mutedByInstance === true,
handler: ({ account }) => this.unblockAccountByInstance(account)
}
if (authUser.hasRight(UserRight.MANAGE_SERVERS_BLOCKLIST)) {
instanceActions = instanceActions.concat([
{
- label: this.i18n('Mute the instance by your instance'),
- description: this.i18n('Hide any content from that instance for you, your instance and its users.'),
+ label: $localize`Mute the instance by your instance`,
+ description: $localize`Hide any content from that instance for you, your instance and its users.`,
isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === false,
handler: ({ account }) => this.blockServerByInstance(account.host)
},
{
- label: this.i18n('Unmute the instance by your instance'),
- description: this.i18n('Show back content from that instance for you, your instance and its users.'),
+ label: $localize`Unmute the instance by your instance`,
+ description: $localize`Show back content from that instance for you, your instance and its users.`,
isDisplayed: ({ account }) => !account.userId && account.mutedServerByInstance === true,
handler: ({ account }) => this.unblockServerByInstance(account.host)
}
if (authUser.hasRight(UserRight.REMOVE_ANY_VIDEO_COMMENT)) {
instanceActions = instanceActions.concat([
{
- label: this.i18n('Remove comments from your instance'),
- description: this.i18n('Remove comments of this account from your instance.'),
+ label: $localize`Remove comments from your instance`,
+ description: $localize`Remove comments of this account from your instance.`,
handler: ({ account }) => this.bulkRemoveCommentsOf({ accountName: account.nameWithHost, scope: 'instance' })
}
])
import { Video } from '@app/shared/shared-main'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoBlockService } from './video-block.service'
@Component({
private modalService: NgbModal,
private videoBlockValidatorsService: VideoBlockValidatorsService,
private videoBlocklistService: VideoBlockService,
- private notifier: Notifier,
- private i18n: I18n
+ private notifier: Notifier
) {
super()
}
this.videoBlocklistService.blockVideo(this.video.id, reason, unfederate)
.subscribe(
() => {
- this.notifier.success(this.i18n('Video blocked.'))
+ this.notifier.success($localize`Video blocked.`)
this.hide()
this.video.blacklisted = true
import { Component, EventEmitter, Input, Output } from '@angular/core'
import { ScreenService } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { Video } from '../shared-main'
@Component({
addToWatchLaterText: string
addedToWatchLaterText: string
- constructor (
- private screenService: ScreenService,
- private i18n: I18n
- ) {
- this.addToWatchLaterText = this.i18n('Add to watch later')
- this.addedToWatchLaterText = this.i18n('Remove from watch later')
+ constructor (private screenService: ScreenService) {
+ this.addToWatchLaterText = $localize`Add to watch later`
+ this.addedToWatchLaterText = $localize`Remove from watch later`
}
getImageUrl () {
import { Component, Input, OnDestroy, OnInit } from '@angular/core'
import { AuthService, Notifier, ServerService, UserService } from '@app/core'
import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig, User, UserUpdateMe } from '@shared/models'
@Component({
private authService: AuthService,
private notifier: Notifier,
private userService: UserService,
- private serverService: ServerService,
- private i18n: I18n
+ private serverService: ServerService
) {
super()
}
() => {
this.authService.refreshUserInformation()
- if (this.notifyOnUpdate) this.notifier.success(this.i18n('Interface settings updated.'))
+ if (this.notifyOnUpdate) this.notifier.success($localize`Interface settings updated.`)
},
err => this.notifier.error(err.message)
)
} else {
this.userService.updateMyAnonymousProfile(details)
- if (this.notifyOnUpdate) this.notifier.success(this.i18n('Interface settings updated.'))
+ if (this.notifyOnUpdate) this.notifier.success($localize`Interface settings updated.`)
}
}
}
import { Component, Input, OnDestroy, OnInit } from '@angular/core'
import { AuthService, Notifier, ServerService, User, UserService } from '@app/core'
import { FormReactive, FormValidatorService, ItemSelectCheckboxValue, SelectOptionsItem } from '@app/shared/shared-forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { UserUpdateMe } from '@shared/models'
import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type'
private authService: AuthService,
private notifier: Notifier,
private userService: UserService,
- private serverService: ServerService,
- private i18n: I18n
+ private serverService: ServerService
) {
super()
}
ngOnInit () {
- this.allLanguagesGroup = this.i18n('All languages')
+ this.allLanguagesGroup = $localize`All languages`
let oldForm: any
]).subscribe(([ languages, config ]) => {
const group = this.allLanguagesGroup
- this.languageItems = [ { label: this.i18n('Unknown language'), id: '_unknown', group } ]
+ this.languageItems = [ { label: $localize`Unknown language`, id: '_unknown', group } ]
this.languageItems = this.languageItems
.concat(languages.map(l => ({ label: l.label, id: l.id, group })))
if (Array.isArray(videoLanguages)) {
if (videoLanguages.length > 20) {
- this.notifier.error(this.i18n('Too many languages are enabled. Please enable them all or stay below 20 enabled languages.'))
+ this.notifier.error($localize`Too many languages are enabled. Please enable them all or stay below 20 enabled languages.`)
return
}
if (videoLanguages.length === 0) {
- this.notifier.error(this.i18n('You need to enable at least 1 video language.'))
+ this.notifier.error($localize`You need to enable at least 1 video language.`)
return
}
() => {
this.authService.refreshUserInformation()
- if (this.notifyOnUpdate) this.notifier.success(this.i18n('Video settings updated.'))
+ if (this.notifyOnUpdate) this.notifier.success($localize`Video settings updated.`)
},
err => this.notifier.error(err.message)
)
} else {
this.userService.updateMyAnonymousProfile(details)
- if (this.notifyOnUpdate) this.notifier.success(this.i18n('Display/Video settings updated.'))
+ if (this.notifyOnUpdate) this.notifier.success($localize`Display/Video settings updated.`)
}
}
-
- getDefaultVideoLanguageLabel () {
- return this.i18n('No language')
- }
-
- getSelectedVideoLanguageLabel () {
- return this.i18n('{{\'{0} languages selected')
- }
}
import { Router } from '@angular/router'
import { AuthService, Notifier } from '@app/core'
import { Account, VideoChannel, VideoService } from '@app/shared/shared-main'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { FeedFormat } from '@shared/models'
import { UserSubscriptionService } from './user-subscription.service'
private router: Router,
private notifier: Notifier,
private userSubscriptionService: UserSubscriptionService,
- private i18n: I18n,
private videoService: VideoService
) { }
() => {
this.notifier.success(
this.account
- ? this.i18n(
- 'Subscribed to all current channels of {{nameWithHost}}. You will be notified of all their new videos.',
- { nameWithHost: this.account.displayName }
- )
- : this.i18n(
- 'Subscribed to {{nameWithHost}}. You will be notified of all their new videos.',
- { nameWithHost: this.videoChannels[0].displayName }
- )
- ,
- this.i18n('Subscribed')
+ ? $localize`Subscribed to all current channels of ${this.account.displayName}. You will be notified of all their new videos.`
+ : $localize`Subscribed to ${this.videoChannels[0].displayName}. You will be notified of all their new videos.`,
+
+ $localize`Subscribed`
)
},
- err => this.notifier.error(err.message)
+ err => this.notifier.error(err.message)
)
}
complete: () => {
this.notifier.success(
this.account
- ? this.i18n('Unsubscribed from all channels of {{nameWithHost}}', { nameWithHost: this.account.nameWithHost })
- : this.i18n('Unsubscribed from {{nameWithHost}}', { nameWithHost: this.videoChannels[ 0 ].nameWithHost })
- ,
- this.i18n('Unsubscribed')
+ ? $localize`Unsubscribed from all channels of ${this.account.nameWithHost}`
+ : $localize`Unsubscribed from ${this.videoChannels[ 0 ].nameWithHost}`,
+
+ $localize`Unsubscribed`
)
},
} from '@app/core'
import { DisableForReuseHook } from '@app/core/routing/disable-for-reuse-hook'
import { GlobalIconName } from '@app/shared/shared-icons'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { isLastMonth, isLastWeek, isToday, isYesterday } from '@shared/core-utils/miscs/date'
import { ServerConfig, VideoSortField } from '@shared/models'
import { NSFWPolicyType } from '@shared/models/videos/nsfw-policy.type'
protected abstract screenService: ScreenService
protected abstract storageService: LocalStorageService
protected abstract router: Router
- protected abstract i18n: I18n
abstract titlePage: string
private resizeSubscription: Subscription
this.groupedDateLabels = {
[GroupDate.UNKNOWN]: null,
- [GroupDate.TODAY]: this.i18n('Today'),
- [GroupDate.YESTERDAY]: this.i18n('Yesterday'),
- [GroupDate.LAST_WEEK]: this.i18n('Last week'),
- [GroupDate.LAST_MONTH]: this.i18n('Last month'),
- [GroupDate.OLDER]: this.i18n('Older')
+ [GroupDate.TODAY]: $localize`Today`,
+ [GroupDate.YESTERDAY]: $localize`Yesterday`,
+ [GroupDate.LAST_WEEK]: $localize`Last week`,
+ [GroupDate.LAST_MONTH]: $localize`Last month`,
+ [GroupDate.OLDER]: $localize`Older`
}
// Subscribe to route changes
},
error => {
- const message = this.i18n('Cannot load more videos. Try again later.')
+ const message = $localize`Cannot load more videos. Try again later.`
console.error(message, { error })
this.notifier.error(message)
import { Component, EventEmitter, Input, OnChanges, Output, ViewChild } from '@angular/core'
import { AuthService, ConfirmService, Notifier, ScreenService } from '@app/core'
-import { VideoBlockComponent, VideoBlockService, VideoReportComponent, BlocklistService } from '@app/shared/shared-moderation'
+import { BlocklistService, VideoBlockComponent, VideoBlockService, VideoReportComponent } from '@app/shared/shared-moderation'
import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoCaption } from '@shared/models'
-import { DropdownAction, DropdownButtonSize, DropdownDirection, RedundancyService, Video, VideoDetails, VideoService, Actor } from '../shared-main'
+import {
+ Actor,
+ DropdownAction,
+ DropdownButtonSize,
+ DropdownDirection,
+ RedundancyService,
+ Video,
+ VideoDetails,
+ VideoService
+} from '../shared-main'
import { VideoAddToPlaylistComponent } from '../shared-video-playlist'
import { VideoDownloadComponent } from './video-download.component'
private videoBlocklistService: VideoBlockService,
private screenService: ScreenService,
private videoService: VideoService,
- private redundancyService: RedundancyService,
- private i18n: I18n
+ private redundancyService: RedundancyService
) { }
get user () {
/* Action handlers */
async unblockVideo () {
- const confirmMessage = this.i18n(
- 'Do you really want to unblock this video? It will be available again in the videos list.'
- )
+ const confirmMessage = $localize`Do you really want to unblock this video? It will be available again in the videos list.`
- const res = await this.confirmService.confirm(confirmMessage, this.i18n('Unblock'))
+ const res = await this.confirmService.confirm(confirmMessage, $localize`Unblock`)
if (res === false) return
this.videoBlocklistService.unblockVideo(this.video.id)
.subscribe(
() => {
- this.notifier.success(this.i18n('Video {{name}} unblocked.', { name: this.video.name }))
+ this.notifier.success($localize`Video ${this.video.name} unblocked.`)
this.video.blacklisted = false
this.video.blockedReason = null
async removeVideo () {
this.modalOpened.emit()
- const res = await this.confirmService.confirm(this.i18n('Do you really want to delete this video?'), this.i18n('Delete'))
+ const res = await this.confirmService.confirm($localize`Do you really want to delete this video?`, $localize`Delete`)
if (res === false) return
this.videoService.removeVideo(this.video.id)
.subscribe(
() => {
- this.notifier.success(this.i18n('Video {{videoName}} deleted.', { videoName: this.video.name }))
-
+ this.notifier.success($localize`Video ${this.video.name} deleted.`)
this.videoRemoved.emit()
},
this.redundancyService.addVideoRedundancy(this.video)
.subscribe(
() => {
- const message = this.i18n('This video will be duplicated by your instance.')
+ const message = $localize`This video will be duplicated by your instance.`
this.notifier.success(message)
},
this.blocklistService.blockAccountByUser(params)
.subscribe(
() => {
- this.notifier.success(this.i18n('Account {{nameWithHost}} muted.', params))
-
+ this.notifier.success($localize`Account ${params.nameWithHost} muted.`)
this.videoAccountMuted.emit()
},
this.videoActions = [
[
{
- label: this.i18n('Save to playlist'),
+ label: $localize`Save to playlist`,
handler: () => this.playlistDropdown.toggle(),
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.playlist,
iconName: 'playlist-add'
],
[ // actions regarding the video
{
- label: this.i18n('Download'),
+ label: $localize`Download`,
handler: () => this.showDownloadModal(),
isDisplayed: () => this.displayOptions.download && this.isVideoDownloadable(),
iconName: 'download'
},
{
- label: this.i18n('Update'),
+ label: $localize`Update`,
linkBuilder: ({ video }) => [ '/videos/update', video.uuid ],
iconName: 'edit',
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.update && this.isVideoUpdatable()
},
{
- label: this.i18n('Block'),
+ label: $localize`Block`,
handler: () => this.showBlockModal(),
iconName: 'no',
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoBlockable()
},
{
- label: this.i18n('Unblock'),
+ label: $localize`Unblock`,
handler: () => this.unblockVideo(),
iconName: 'undo',
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.blacklist && this.isVideoUnblockable()
},
{
- label: this.i18n('Mirror'),
+ label: $localize`Mirror`,
handler: () => this.duplicateVideo(),
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.duplicate && this.canVideoBeDuplicated(),
iconName: 'cloud-download'
},
{
- label: this.i18n('Delete'),
+ label: $localize`Delete`,
handler: () => this.removeVideo(),
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.delete && this.isVideoRemovable(),
iconName: 'delete'
},
{
- label: this.i18n('Report'),
+ label: $localize`Report`,
handler: () => this.showReportModal(),
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.report,
iconName: 'flag'
],
[ // actions regarding the account/its server
{
- label: this.i18n('Mute account'),
+ label: $localize`Mute account`,
handler: () => this.muteVideoAccount(),
isDisplayed: () => this.authService.isLoggedIn() && this.displayOptions.mute && this.isVideoAccountMutable(),
iconName: 'no'
import { Component, ElementRef, ViewChild } from '@angular/core'
import { AuthService, Notifier } from '@app/core'
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { VideoCaption, VideoFile, VideoPrivacy } from '@shared/models'
import { BytesPipe, NumberFormatterPipe, VideoDetails, VideoService } from '../shared-main'
private notifier: Notifier,
private modalService: NgbModal,
private videoService: VideoService,
- private auth: AuthService,
- private i18n: I18n
+ private auth: AuthService
) {
this.bytesPipe = new BytesPipe()
this.numbersPipe = new NumberFormatterPipe()
get typeText () {
return this.type === 'video'
- ? this.i18n('video')
- : this.i18n('subtitles')
+ ? $localize`video`
+ : $localize`subtitles`
}
getVideoFiles () {
}
activateCopiedMessage () {
- this.notifier.success(this.i18n('Copied'))
+ this.notifier.success($localize`Copied`)
}
switchToType (type: DownloadType) {
getMetadataFormat (format: any) {
const keyToTranslateFunction = {
- 'encoder': (value: string) => ({ label: this.i18n('Encoder'), value }),
- 'format_long_name': (value: string) => ({ label: this.i18n('Format name'), value }),
- 'size': (value: number) => ({ label: this.i18n('Size'), value: this.bytesPipe.transform(value, 2) }),
+ 'encoder': (value: string) => ({ label: $localize`Encoder`, value }),
+ 'format_long_name': (value: string) => ({ label: $localize`Format name`, value }),
+ 'size': (value: number) => ({ label: $localize`Size`, value: this.bytesPipe.transform(value, 2) }),
'bit_rate': (value: number) => ({
- label: this.i18n('Bitrate'),
+ label: $localize`Bitrate`,
value: `${this.numbersPipe.transform(value)}bps`
})
}
if (!stream) return undefined
let keyToTranslateFunction = {
- 'codec_long_name': (value: string) => ({ label: this.i18n('Codec'), value }),
- 'profile': (value: string) => ({ label: this.i18n('Profile'), value }),
+ 'codec_long_name': (value: string) => ({ label: $localize`Codec`, value }),
+ 'profile': (value: string) => ({ label: $localize`Profile`, value }),
'bit_rate': (value: number) => ({
- label: this.i18n('Bitrate'),
+ label: $localize`Bitrate`,
value: `${this.numbersPipe.transform(value)}bps`
})
}
if (type === 'video') {
keyToTranslateFunction = Object.assign(keyToTranslateFunction, {
- 'width': (value: number) => ({ label: this.i18n('Resolution'), value: `${value}x${stream.height}` }),
- 'display_aspect_ratio': (value: string) => ({ label: this.i18n('Aspect ratio'), value }),
- 'avg_frame_rate': (value: string) => ({ label: this.i18n('Average frame rate'), value }),
- 'pix_fmt': (value: string) => ({ label: this.i18n('Pixel format'), value })
+ 'width': (value: number) => ({ label: $localize`Resolution`, value: `${value}x${stream.height}` }),
+ 'display_aspect_ratio': (value: string) => ({ label: $localize`Aspect ratio`, value }),
+ 'avg_frame_rate': (value: string) => ({ label: $localize`Average frame rate`, value }),
+ 'pix_fmt': (value: string) => ({ label: $localize`Pixel format`, value })
})
} else {
keyToTranslateFunction = Object.assign(keyToTranslateFunction, {
- 'sample_rate': (value: number) => ({ label: this.i18n('Sample rate'), value }),
- 'channel_layout': (value: number) => ({ label: this.i18n('Channel Layout'), value })
+ 'sample_rate': (value: number) => ({ label: $localize`Sample rate`, value }),
+ 'channel_layout': (value: number) => ({ label: $localize`Channel Layout`, value })
})
}
Output
} from '@angular/core'
import { AuthService, ScreenService, ServerService, User } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig, VideoPlaylistType, VideoPrivacy, VideoState } from '@shared/models'
import { Video } from '../shared-main'
import { VideoPlaylistService } from '../shared-video-playlist'
constructor (
private screenService: ScreenService,
private serverService: ServerService,
- private i18n: I18n,
private authService: AuthService,
private videoPlaylistService: VideoPlaylistService,
private cd: ChangeDetectorRef,
this.setUpBy()
- this.channelLinkTitle = this.i18n(
- '{{name}} (channel page)',
- { name: this.video.channel.name, handle: this.video.byVideoChannel }
- )
+ this.channelLinkTitle = $localize`${this.video.channel.name} (channel page)`
// We rely on mouseenter to lazy load actions
if (this.screenService.isInTouchScreen()) {
if (!video.state) return ''
if (video.privacy.id !== VideoPrivacy.PRIVATE && video.state.id === VideoState.PUBLISHED) {
- return this.i18n('Published')
+ return $localize`Published`
}
if (video.scheduledUpdate) {
const updateAt = new Date(video.scheduledUpdate.updateAt.toString()).toLocaleString(this.localeId)
- return this.i18n('Publication scheduled on ') + updateAt
+ return $localize`Publication scheduled on ` + updateAt
}
if (video.state.id === VideoState.TO_TRANSCODE && video.waitTranscoding === true) {
- return this.i18n('Waiting transcoding')
+ return $localize`Waiting transcoding`
}
if (video.state.id === VideoState.TO_TRANSCODE) {
- return this.i18n('To transcode')
+ return $localize`To transcode`
}
if (video.state.id === VideoState.TO_IMPORT) {
- return this.i18n('To import')
+ return $localize`To import`
}
return ''
} from '@angular/core'
import { ActivatedRoute, Router } from '@angular/router'
import { AuthService, ComponentPagination, LocalStorageService, Notifier, ScreenService, ServerService, UserService } from '@app/core'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ResultList, VideoSortField } from '@shared/models'
import { PeerTubeTemplateDirective, Video } from '../shared-main'
import { AbstractVideoList } from './abstract-video-list'
globalButtonsTemplate: TemplateRef<any>
constructor (
- protected i18n: I18n,
protected router: Router,
protected route: ActivatedRoute,
protected notifier: Notifier,
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'
import { AuthService, DisableForReuseHook, Notifier } from '@app/core'
import { FormReactive, FormValidatorService, VideoPlaylistValidatorsService } from '@app/shared/shared-forms'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { Video, VideoExistInPlaylist, VideoPlaylistCreate, VideoPlaylistElementCreate, VideoPlaylistPrivacy } from '@shared/models'
import { secondsToTime } from '../../../assets/player/utils'
import { CachedPlaylist, VideoPlaylistService } from './video-playlist.service'
protected formValidatorService: FormValidatorService,
private authService: AuthService,
private notifier: Notifier,
- private i18n: I18n,
private videoPlaylistService: VideoPlaylistService,
private videoPlaylistValidatorsService: VideoPlaylistValidatorsService,
private cd: ChangeDetectorRef
this.videoPlaylistService.removeVideoFromPlaylist(playlist.id, playlist.playlistElementId, this.video.id)
.subscribe(
() => {
- this.notifier.success(this.i18n('Video removed from {{name}}', { name: playlist.displayName }))
+ this.notifier.success($localize`Video removed from ${playlist.displayName}`)
},
err => {
.subscribe(
() => {
const message = body.startTimestamp || body.stopTimestamp
- ? this.i18n('Video added in {{n}} at timestamps {{t}}', { n: playlist.displayName, t: this.formatTimestamp(playlist) })
- : this.i18n('Video added in {{n}}', { n: playlist.displayName })
+ ? $localize`Video added in ${playlist.displayName} at timestamps ${this.formatTimestamp(playlist)}`
+ : $localize`Video added in ${playlist.displayName}`
this.notifier.success(message)
},
import { AuthService, Notifier, ServerService } from '@app/core'
import { Video } from '@app/shared/shared-main'
import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'
-import { I18n } from '@ngx-translate/i18n-polyfill'
import { ServerConfig, VideoPlaylistElementType, VideoPlaylistElementUpdate } from '@shared/models'
import { secondsToTime } from '../../../assets/player/utils'
import { VideoPlaylistElement } from './video-playlist-element.model'
private authService: AuthService,
private serverService: ServerService,
private notifier: Notifier,
- private i18n: I18n,
private videoPlaylistService: VideoPlaylistService,
private cdr: ChangeDetectorRef
) {}
this.videoPlaylistService.removeVideoFromPlaylist(this.playlist.id, playlistElement.id, videoId)
.subscribe(
() => {
- this.notifier.success(this.i18n('Video removed from {{name}}', { name: this.playlist.displayName }))
-
+ this.notifier.success($localize`Video removed from ${this.playlist.displayName}`)
this.elementRemoved.emit(playlistElement)
},
this.videoPlaylistService.updateVideoOfPlaylist(this.playlist.id, playlistElement.id, body, this.playlistElement.video.id)
.subscribe(
() => {
- this.notifier.success(this.i18n('Timestamps updated'))
+ this.notifier.success($localize`Timestamps updated`)
playlistElement.startTimestamp = body.startTimestamp
playlistElement.stopTimestamp = body.stopTimestamp
if (start === null && stop === null) return ''
- if (start !== null && stop === null) return this.i18n('Starts at ') + startFormatted
- if (start === null && stop !== null) return this.i18n('Stops at ') + stopFormatted
+ if (start !== null && stop === null) return $localize`Starts at ` + startFormatted
+ if (start === null && stop !== null) return $localize`Stops at ` + stopFormatted
- return this.i18n('Starts at ') + startFormatted + this.i18n(' and stops at ') + stopFormatted
+ return $localize`Starts at ` + startFormatted + $localize` and stops at ` + stopFormatted
}
onDropdownOpenChange () {
ora "4.0.5"
rxjs "6.6.2"
-"@angular/animations@^10.1.0-next.4":
- version "10.1.0-next.4"
- resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-10.1.0-next.4.tgz#e2e46e23f4aa02d6b04b1db795f85d51e2fcc62b"
- integrity sha512-3PWWtORaHjspKFbff+NdB2/DdgsNMNDz02/oCylK5+UAAtRzci885EAuk0oC5wn6pkzU4WrBbUYkVWikbQEy9Q==
+"@angular/animations@^10.1.0-next.5":
+ version "10.1.0-next.5"
+ resolved "https://registry.yarnpkg.com/@angular/animations/-/animations-10.1.0-next.5.tgz#af5c9365ef5473d430797eb1b2f08a8ed4e75b96"
+ integrity sha512-1ssVuf4in1nLqiC7ZOXQyjbk4KMj9g4jTB5LkhPgXmkMr5cdHckIgeSSk0sF0I7F1+Xo0P0Dz4CL7AZY/IlxQw==
dependencies:
tslib "^2.0.0"
universal-analytics "0.4.23"
uuid "8.3.0"
-"@angular/common@^10.1.0-next.4":
- version "10.1.0-next.4"
- resolved "https://registry.yarnpkg.com/@angular/common/-/common-10.1.0-next.4.tgz#712850da191bcd41e9d8fe0da9484d30b3b8e248"
- integrity sha512-iiVUqc+ManJHak3HPhZ9ajp5f3IZmm8f9ev8Bu8bVRDjk/76hSeCRln6fykbZPwpbAOlVgVWjjTf2bgf6QMpQQ==
+"@angular/common@^10.1.0-next.5":
+ version "10.1.0-next.5"
+ resolved "https://registry.yarnpkg.com/@angular/common/-/common-10.1.0-next.5.tgz#9c8e43e6a319e9d65e4d6c8e000ee1ca9775eaf8"
+ integrity sha512-vK7btoMtC3hE6BfNY3QLlDipW9sd8CGdOfHyl8smNtRyw7qAMSxgvIkQSaclN4K7h3uD7QMppqPAjZMgeUxfzw==
dependencies:
tslib "^2.0.0"
-"@angular/compiler-cli@^10.1.0-next.4":
- version "10.1.0-next.4"
- resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-10.1.0-next.4.tgz#b9edfe7c04ef5faeaecdab095e58137fdbe14f3d"
- integrity sha512-yKv0bCr+vdb34uBiv18iHC+V83gWQt4AuEvUF/WYVqnmE7gKa1PO0LjMyWB8lHrur/3k5uBug1NAqOqAQGcyTw==
+"@angular/compiler-cli@^10.1.0-next.5":
+ version "10.1.0-next.5"
+ resolved "https://registry.yarnpkg.com/@angular/compiler-cli/-/compiler-cli-10.1.0-next.5.tgz#4ef0ae92ecee8b1de003a82180c5813f2c507cdb"
+ integrity sha512-+MI4enl5N0xyjzvL9vfqVaDqDm6RkuX/jydvaFr8yTESBRXCu8g4UvTcxnOwLcQehl7ZD45WmOeOnRXdwcI3kA==
dependencies:
canonical-path "1.0.0"
chokidar "^3.0.0"
tslib "^2.0.0"
yargs "15.3.0"
-"@angular/compiler@^10.1.0-next.4":
- version "10.1.0-next.4"
- resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-10.1.0-next.4.tgz#b86b51492e59edcc507d13ef1842bae9b36ae855"
- integrity sha512-TT4kh41AkU4oatHnKwfQ5A10RPg+A7xSBPxSsqKBC8bphel0HL4Lf4hn5shIK4G8aZaieBfntkC9Nf7WoWgqaQ==
+"@angular/compiler@^10.1.0-next.5":
+ version "10.1.0-next.5"
+ resolved "https://registry.yarnpkg.com/@angular/compiler/-/compiler-10.1.0-next.5.tgz#3b638e8708d24310b81003271bee5006ea9c7d9e"
+ integrity sha512-pDUTIerTs6A9yDBGeKiSFzu0CsG3l0ct4UkIWE1PsW9ui63ar+UytGpiLBBJ8pXfktMOZle8NVmlKAzhXG2g/g==
dependencies:
tslib "^2.0.0"
-"@angular/core@^10.1.0-next.4":
- version "10.1.0-next.4"
- resolved "https://registry.yarnpkg.com/@angular/core/-/core-10.1.0-next.4.tgz#622cd9245c178422b896149e9d9aa387109142b3"
- integrity sha512-buAMY+gTeX6jXfXSxnLnwLHeJnQ7obLr27JZo8FNt3JTI6nYAdLEf2Jw2jsqwJ8H6fSNjOHmm+tLRqSVHSyeRg==
+"@angular/core@^10.1.0-next.5":
+ version "10.1.0-next.5"
+ resolved "https://registry.yarnpkg.com/@angular/core/-/core-10.1.0-next.5.tgz#70269efc5ede9553bac231f4d61e2a99bb5b69bb"
+ integrity sha512-bLV1sSaEZqda+cmYwfYKvy4KX0xtoAoLwtNQi6/TGVBj4c+6NsUp5oN2SwSEQKTo7vi0qaP1/Q/XUGSX4ZYHQw==
dependencies:
tslib "^2.0.0"
-"@angular/forms@^10.1.0-next.4":
- version "10.1.0-next.4"
- resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-10.1.0-next.4.tgz#15798595ffb50ad924f4be89d0de38a76a367a6f"
- integrity sha512-6fINEZoxj4vRmgfDUG7ICt381hCizMp6wzYPUd55+fQjNGRy/BwkbmzZI0tf3QoiRjqiTZIq/L+sQxQMfKFZhg==
+"@angular/forms@^10.1.0-next.5":
+ version "10.1.0-next.5"
+ resolved "https://registry.yarnpkg.com/@angular/forms/-/forms-10.1.0-next.5.tgz#02b0a361cda71fbd6ed7c45e707db7ab98abd950"
+ integrity sha512-aE/Q0VT4k1AtUzC/2YL7//mXBZQDENwtFUVnMjv8Krbvlka9EylZHN0MdFNhzW2zuNmELnv2Eud4O+vEF9vJ6Q==
dependencies:
tslib "^2.0.0"
-"@angular/localize@^10.1.0-next.4":
- version "10.1.0-next.4"
- resolved "https://registry.yarnpkg.com/@angular/localize/-/localize-10.1.0-next.4.tgz#a2dbe3c6c4d72421baca87ec1e59f6a4dbc1d547"
- integrity sha512-q/RiyZvMzhXabXVwYqjljS30mKsUL06CZAsrS1EvXC+dcA2qTpVoHUFLr5DHiqcNlxENXtJ/+56O7N+V85nH1w==
+"@angular/localize@^10.1.0-next.5":
+ version "10.1.0-next.5"
+ resolved "https://registry.yarnpkg.com/@angular/localize/-/localize-10.1.0-next.5.tgz#f2722ac407d34ac7f0c6b748f58b8966c08f797b"
+ integrity sha512-EBTsMw66snjNOl1FZJB/bhPJC19E5K5TImS4+Pf1lEbHBLuvfEwZLQnrFoyPWwU98ozFCxYtNZvNJUOHFpM5hQ==
dependencies:
"@babel/core" "7.8.3"
glob "7.1.2"
yargs "15.3.0"
-"@angular/platform-browser-dynamic@^10.1.0-next.4":
- version "10.1.0-next.4"
- resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-10.1.0-next.4.tgz#664f48844152785b1af79a906766661bfbd8e030"
- integrity sha512-amy8aLpE2Hjq5D4cwY8oDPFW963jXJPaMuXWwQsJUqKgmYwUOS4PU86x1BceTb6wOl4Gf4+sJREx3dMjh1AaAQ==
+"@angular/platform-browser-dynamic@^10.1.0-next.5":
+ version "10.1.0-next.5"
+ resolved "https://registry.yarnpkg.com/@angular/platform-browser-dynamic/-/platform-browser-dynamic-10.1.0-next.5.tgz#bc348ed36dc4f97cc90bb6817191e15d3f1b6f23"
+ integrity sha512-dgxGMyz5wwVegFEaE3RS4XSurlrqK1RMvFKpIpb/EbJVP7ZBYMhtX6Wqw0p81MYo0GIssaSaKJd+j4rjjxWR2g==
dependencies:
tslib "^2.0.0"
-"@angular/platform-browser@^10.1.0-next.4":
- version "10.1.0-next.4"
- resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-10.1.0-next.4.tgz#533411a5a2c2fd5ec43198297a032a67c324e59c"
- integrity sha512-DOEL1RDCEd/xttZNyf3VlWC639/3MSlYsDKpdn9FzgLNnu/CXerilSGQQlzaR0b3V8f64csUtuejH9YB/jp0HQ==
+"@angular/platform-browser@^10.1.0-next.5":
+ version "10.1.0-next.5"
+ resolved "https://registry.yarnpkg.com/@angular/platform-browser/-/platform-browser-10.1.0-next.5.tgz#205c99c3edb11b7a83bfa2f967d1e4617a4671ee"
+ integrity sha512-RDgLlDYqWYDdNEPYHJIoG5JsO6m81xxfJNsDVI4DE9z6iCqUxnWappRoDNs/yXFXbdF8p+WbjtL2pru50TWFEA==
dependencies:
tslib "^2.0.0"
-"@angular/router@^10.1.0-next.4":
- version "10.1.0-next.4"
- resolved "https://registry.yarnpkg.com/@angular/router/-/router-10.1.0-next.4.tgz#341951c3db2c206bf85bedfa496c5d75e41ac46c"
- integrity sha512-KjvLIMZcxrDtXVYsWpizq91p50C8JQ4i7wsgxD9O7r0bvMJPn/LngUpaNz+9zKmk4UUwpxZ65sd8sfw+mOR26g==
+"@angular/router@^10.1.0-next.5":
+ version "10.1.0-next.5"
+ resolved "https://registry.yarnpkg.com/@angular/router/-/router-10.1.0-next.5.tgz#3882a2ed1ea5b7f2efca67af4fa3fd28b9e25762"
+ integrity sha512-Jyh62a0zP1gX/R3hV5ILnd/t3AwBLTvRetXfDuOB5c5vImjgwpl84gX3+aJsSvc1cZ0Rs31zqV8JR9M9yEAAbQ==
dependencies:
tslib "^2.0.0"
-"@angular/service-worker@^10.1.0-next.4":
- version "10.1.0-next.4"
- resolved "https://registry.yarnpkg.com/@angular/service-worker/-/service-worker-10.1.0-next.4.tgz#ae240fdc2957b27e71a738fe8a01d31dfbae2ee6"
- integrity sha512-xF9J+bPGRPAxeC07cOKHoXxJ32skNPDj9bEpymrfJaRxzmQ41gN4+IlwmiFJjoHUwYVX3x4OZyb18HTJPhWqXw==
+"@angular/service-worker@^10.1.0-next.5":
+ version "10.1.0-next.5"
+ resolved "https://registry.yarnpkg.com/@angular/service-worker/-/service-worker-10.1.0-next.5.tgz#699bfd88e7b02c9e30fa9103c1fd508b86725e60"
+ integrity sha512-lXne4/88dre8NXY/jHEm+bONdG4EswzBGln2PnaHGZ1i3ALATcSwzrCEAqh29eeP9/OGXRMc7iBdAj2N24WxUw==
dependencies:
tslib "^2.0.0"
resolved "https://registry.yarnpkg.com/@ngx-meta/core/-/core-9.0.0.tgz#2c3b27bd32d41f7aaf0712d4007e0afed8e5dd3f"
integrity sha512-WL/HyKM+4gJPS3TNTO0M+46LlIvGTSyofL//8hxoozAyRPsiMyR0xrwUvPBJkVqFyD6j0iI5FaNcQ9d0JCVJhg==
-"@ngx-translate/i18n-polyfill@^1.0.0":
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/@ngx-translate/i18n-polyfill/-/i18n-polyfill-1.0.0.tgz#145edb28bcfc1332e1bc25279eadf9d4ed0a20f8"
- integrity sha512-+UKmSr6cWBJiMDex6w2FwVjEeVnlEsINDGYvTgRaFRI3/IKZrsSVcfISDcBX2wWr6m4jumfOyCcimIl2TxcaoA==
- dependencies:
- glob "7.1.2"
- tslib "^1.9.0"
- yargs "10.0.3"
-
"@nodelib/fs.scandir@2.1.3":
version "2.1.3"
resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.3.tgz#3a582bdb53804c6ba6d146579c46e52130cf4a3b"
path-exists "^2.0.0"
pinkie-promise "^2.0.0"
-find-up@^2.0.0, find-up@^2.1.0:
+find-up@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7"
integrity sha1-RdG35QbHF93UgndaK3eSCjwMV6c=
dependencies:
camelcase "^4.1.0"
-yargs-parser@^8.0.0:
- version "8.1.0"
- resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-8.1.0.tgz#f1376a33b6629a5d063782944da732631e966950"
- integrity sha512-yP+6QqN8BmrgW2ggLtTbdrOyBNSI7zBa4IykmiV5R1wl1JWNxQvWhMfMdmzIYtKU7oP3OOInY/tl2ov3BDjnJQ==
- dependencies:
- camelcase "^4.1.0"
-
-yargs@10.0.3:
- version "10.0.3"
- resolved "https://registry.yarnpkg.com/yargs/-/yargs-10.0.3.tgz#6542debd9080ad517ec5048fb454efe9e4d4aaae"
- integrity sha512-DqBpQ8NAUX4GyPP/ijDGHsJya4tYqLQrjPr95HNsr1YwL3+daCfvBwg7+gIC6IdJhR2kATh3hb61vjzMWEtjdw==
- dependencies:
- cliui "^3.2.0"
- decamelize "^1.1.1"
- find-up "^2.1.0"
- get-caller-file "^1.0.1"
- os-locale "^2.0.0"
- require-directory "^2.1.1"
- require-main-filename "^1.0.1"
- set-blocking "^2.0.0"
- string-width "^2.0.0"
- which-module "^2.0.0"
- y18n "^3.2.1"
- yargs-parser "^8.0.0"
-
yargs@15.3.0:
version "15.3.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.3.0.tgz#403af6edc75b3ae04bf66c94202228ba119f0976"
set -eu
declare -A languages
+defaultLanguage="en-US"
-pre_build_hook () {
- mkdir "./src/pending_locale" > /dev/null || true
- mv ./src/locale/angular.*.xlf "./src/pending_locale"
-
- if [ ! -z ${1+x} ]; then
- mv "./src/pending_locale/angular.$1.xlf" "./src/locale"
- fi
-}
-
-post_build_hook () {
- mv ./src/pending_locale/* "./src/locale"
- rmdir "./src/pending_locale/"
-}
-
-# Previous build failed
-if [ ! -f "client/src/locale/angular.fr-FR.xlf" ]; then
- git checkout -- client/src/locale/
- rm -r client/src/pending_locale
-fi
+# Supported languages
+languages=(
+ ["ar"]="ar"
+ ["en"]="en-US"
+ ["vi"]="vi-VN"
+ ["hu"]="hu-HU"
+ ["th"]="th-TH"
+ ["fi"]="fi-FI"
+ ["nl"]="nl-NL"
+ ["gd"]="gd"
+ ["el"]="el-GR"
+ ["es"]="es-ES"
+ ["oc"]="oc"
+ ["pt"]="pt-BR"
+ ["pt-PT"]="pt-PT"
+ ["sv"]="sv-SE"
+ ["pl"]="pl-PL"
+ ["ru"]="ru-RU"
+ ["zh-Hans"]="zh-Hans-CN"
+ ["zh-Hant"]="zh-Hant-TW"
+ ["fr"]="fr-FR"
+ ["ja"]="ja-JP"
+ ["eu"]="eu-ES"
+ ["ca"]="ca-ES"
+ ["cs"]="cs-CZ"
+ ["eo"]="eo"
+ ["de"]="de-DE"
+ ["it"]="it-IT"
+ ["kab"]="kab"
+)
cd client
rm -rf ./dist ./compiled
-pre_build_hook
-
-additionalParams=""
-if [ ! -z ${1+x} ] && [ "$1" == "--analyze-bundle" ]; then
- additionalParams="--namedChunks=true --outputHashing=none"
- export ANALYZE_BUNDLE=true
-fi
-
-if [ ! -z ${1+x} ] && [ "$1" == "--i18n" ]; then
- additionalParams="--configuration=i18n"
- export ANALYZE_BUNDLE=true
-fi
-
-defaultLanguage="en-US"
-npm run ng build -- --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json $additionalParams
-mv "./dist/$defaultLanguage/assets" "./dist"
-mv "./dist/$defaultLanguage/manifest.webmanifest" "./dist/manifest.webmanifest"
-
-post_build_hook
-
# Don't build other languages if --light arg is provided
if [ -z ${1+x} ] || ([ "$1" != "--light" ] && [ "$1" != "--analyze-bundle" ] && [ "$1" != "--i18n" ]); then
- if [ ! -z ${1+x} ] && [ "$1" == "--light-hu" ]; then
- languages=(["hu"]="hu-HU")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-ar" ]; then
- languages=(["ar"]="ar")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-vi" ]; then
- languages=(["vi"]="vi-VN")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-kab" ]; then
- languages=(["kab"]="kab")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-th" ]; then
- languages=(["th"]="th-TH")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-fi" ]; then
- languages=(["fi"]="fi-FI")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-nl" ]; then
- languages=(["nl"]="nl-NL")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-gd" ]; then
- languages=(["gd"]="gd")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-el" ]; then
- languages=(["el"]="el-GR")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-es" ]; then
- languages=(["es"]="es-ES")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-oc" ]; then
- languages=(["oc"]="oc")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-pt" ]; then
- languages=(["pt"]="pt-BR")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-pt-PT" ]; then
- languages=(["pt-PT"]="pt-PT")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-sv" ]; then
- languages=(["sv"]="sv-SE")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-pl" ]; then
- languages=(["pl"]="pl-PL")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-ru" ]; then
- languages=(["ru"]="ru-RU")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-zh-Hans" ]; then
- languages=(["zh-Hans"]="zh-Hans-CN")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-zh-Hant" ]; then
- languages=(["zh-Hant"]="zh-Hant-TW")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-fr" ]; then
- languages=(["fr"]="fr-FR")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-ja" ]; then
- languages=(["ja"]="ja-JP")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-eu" ]; then
- languages=(["eu"]="eu-ES")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-ca" ]; then
- languages=(["ca"]="ca-ES")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-cs" ]; then
- languages=(["cs"]="cs-CZ")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-eo" ]; then
- languages=(["eo"]="eo")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-de" ]; then
- languages=(["de"]="de-DE")
- elif [ ! -z ${1+x} ] && [ "$1" == "--light-it" ]; then
- languages=(["it"]="it-IT")
- else
- # Supported languages
- languages=(
- ["ar"]="ar"
- ["vi"]="vi-VN"
- ["hu"]="hu-HU"
- ["th"]="th-TH"
- ["fi"]="fi-FI"
- ["nl"]="nl-NL"
- ["gd"]="gd"
- ["el"]="el-GR"
- ["es"]="es-ES"
- ["oc"]="oc"
- ["pt"]="pt-BR"
- ["pt-PT"]="pt-PT"
- ["sv"]="sv-SE"
- ["pl"]="pl-PL"
- ["ru"]="ru-RU"
- ["zh-Hans"]="zh-Hans-CN"
- ["zh-Hant"]="zh-Hant-TW"
- ["fr"]="fr-FR"
- ["ja"]="ja-JP"
- ["eu"]="eu-ES"
- ["ca"]="ca-ES"
- ["cs"]="cs-CZ"
- ["eo"]="eo"
- ["de"]="de-DE"
- ["it"]="it-IT"
- ["kab"]="kab"
- )
- fi
+ npm run ng build -- --prod --output-path "dist/build"
for key in "${!languages[@]}"; do
lang=${languages[$key]}
- # TODO: remove when the project will use runtime translations
- pre_build_hook "$lang"
+ mv "dist/build/$key" "dist/$lang"
- npm run ng build -- --prod --configuration="$lang" --output-path "dist/build"
+ if [ "$lang" != "en-US" ]; then
+ # Do not duplicate assets
+ rm -r "./dist/$lang/assets"
+ fi
+ done
- # If --localize is not used
- mv "dist/build/$key" "dist/$lang"
- rmdir "dist/build"
+ mv "./dist/$defaultLanguage/assets" "./dist"
+ mv "./dist/$defaultLanguage/manifest.webmanifest" "./dist/manifest.webmanifest"
- # If --localize is used
- # if [ ! "$lang" = "$key" ]; then
- # mv "dist/$key" "dist/$lang"
- # fi
+ rmdir "dist/build"
+else
+ additionalParams=""
+ if [ ! -z ${1+x} ] && [ "$1" == "--analyze-bundle" ]; then
+ additionalParams="--namedChunks=true --outputHashing=none"
+ export ANALYZE_BUNDLE=true
+ fi
- # Do not duplicate assets
- rm -r "./dist/$lang/assets"
+ if [ ! -z ${1+x} ] && [ "$1" == "--i18n" ]; then
+ additionalParams="--configuration=i18n"
+ export ANALYZE_BUNDLE=true
+ fi
- # TODO: remove when the project will use runtime translations
- post_build_hook
- done
+ npm run ng build -- --localize=false --output-path "dist/$defaultLanguage/" --deploy-url "/client/$defaultLanguage/" --prod --stats-json $additionalParams
fi
cd ../ && npm run build:embed && cd client/
set -eu
+npm run build -- --i18n
+
cd client
-npm run ng -- xi18n --i18n-locale "en-US" --output-path src/locale --out-file angular.xlf
-npm run ngx-extractor -- --locale "en-US" -i 'src/**/*.ts' -f xlf -o src/locale/angular.xlf
+./node_modules/.bin/localize-extract -r . -f xliff --locale "en-US" -s 'dist/en-US/*.js' -o src/locale/angular.xlf
+
+# Workaround of https://github.com/angular/angular/issues/38437
+sed -i 's/other {{INTERPOLATION}/other {<x id="INTERPOLATION"\/>/g' src/locale/angular.xlf
# Merge new translations in other language files
npm run ng run -- PeerTube:xliffmerge