mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
trigger chnage detection for localize pipe and round out implementing localize pipe for consistency even though not needed
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
{{ pkg.title }}
|
{{ pkg.title }}
|
||||||
</span>
|
</span>
|
||||||
<span class="detail-description">
|
<span class="detail-description">
|
||||||
{{ pkg.description.short }}
|
{{ pkg.description.short | localize }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { CommonModule } from '@angular/common'
|
import { CommonModule } from '@angular/common'
|
||||||
import { NgModule } from '@angular/core'
|
import { NgModule } from '@angular/core'
|
||||||
import { RouterModule } from '@angular/router'
|
import { RouterModule } from '@angular/router'
|
||||||
import { SharedPipesModule, TickerComponent } from '@start9labs/shared'
|
import { LocalizePipe, SharedPipesModule, TickerComponent } from '@start9labs/shared'
|
||||||
import { ItemComponent } from './item.component'
|
import { ItemComponent } from './item.component'
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [ItemComponent],
|
declarations: [ItemComponent],
|
||||||
exports: [ItemComponent],
|
exports: [ItemComponent],
|
||||||
imports: [CommonModule, RouterModule, SharedPipesModule, TickerComponent],
|
imports: [CommonModule, RouterModule, SharedPipesModule, TickerComponent, LocalizePipe],
|
||||||
})
|
})
|
||||||
export class ItemModule {}
|
export class ItemModule {}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
output,
|
output,
|
||||||
} from '@angular/core'
|
} from '@angular/core'
|
||||||
import { MarketplacePkgBase } from '../../types'
|
import { MarketplacePkgBase } from '../../types'
|
||||||
import { CopyService, i18nPipe } from '@start9labs/shared'
|
import { CopyService, i18nPipe, LocalizePipe } from '@start9labs/shared'
|
||||||
import { DatePipe } from '@angular/common'
|
import { DatePipe } from '@angular/common'
|
||||||
import { MarketplaceItemComponent } from './item.component'
|
import { MarketplaceItemComponent } from './item.component'
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ import { MarketplaceItemComponent } from './item.component'
|
|||||||
<div class="background-border box-shadow-lg shadow-color-light">
|
<div class="background-border box-shadow-lg shadow-color-light">
|
||||||
<div class="box-container">
|
<div class="box-container">
|
||||||
<h2 class="additional-detail-title">{{ 'Description' | i18n }}</h2>
|
<h2 class="additional-detail-title">{{ 'Description' | i18n }}</h2>
|
||||||
<p [innerHTML]="pkg().description.long"></p>
|
<p [innerHTML]="pkg().description.long | localize"></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`,
|
`,
|
||||||
@@ -129,7 +129,7 @@ import { MarketplaceItemComponent } from './item.component'
|
|||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
imports: [MarketplaceItemComponent, DatePipe, i18nPipe],
|
imports: [MarketplaceItemComponent, DatePipe, i18nPipe, LocalizePipe],
|
||||||
})
|
})
|
||||||
export class MarketplaceAboutComponent {
|
export class MarketplaceAboutComponent {
|
||||||
readonly copyService = inject(CopyService)
|
readonly copyService = inject(CopyService)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { inject, Injectable, Pipe, PipeTransform } from '@angular/core'
|
import { inject, Injectable, Pipe, PipeTransform } from '@angular/core'
|
||||||
import { i18nService } from './i18n.service'
|
import { i18nService } from './i18n.service'
|
||||||
|
import { I18N } from './i18n.providers'
|
||||||
import { T } from '@start9labs/start-sdk'
|
import { T } from '@start9labs/start-sdk'
|
||||||
|
|
||||||
@Pipe({
|
@Pipe({
|
||||||
@@ -9,8 +10,10 @@ import { T } from '@start9labs/start-sdk'
|
|||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class LocalizePipe implements PipeTransform {
|
export class LocalizePipe implements PipeTransform {
|
||||||
private readonly i18nService = inject(i18nService)
|
private readonly i18nService = inject(i18nService)
|
||||||
|
private readonly i18n = inject(I18N)
|
||||||
|
|
||||||
transform(string: T.LocaleString): string {
|
transform(string: T.LocaleString): string {
|
||||||
|
this.i18n() // read signal to trigger change detection on language switch
|
||||||
return this.i18nService.localize(string)
|
return this.i18nService.localize(string)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user