Charges with translations
This commit is contained in:
committed by
Jose Alberto Hernandez
parent
8ac82cc6a6
commit
b380f7f630
@@ -11,9 +11,9 @@ export class FormatNumberPipe implements PipeTransform {
|
||||
private settingsService: SettingsService) {
|
||||
}
|
||||
|
||||
transform(value: string | number, ...args: unknown[]): string {
|
||||
transform(value: string | number, defaultValue: any): string {
|
||||
if (!value) {
|
||||
return '';
|
||||
return defaultValue ? defaultValue : '';
|
||||
}
|
||||
const locale = this.settingsService.language.code;
|
||||
const decimals = this.settingsService.decimals;
|
||||
|
||||
@@ -12,13 +12,50 @@ import { ExternalIdentifierPipe } from './external-identifier.pipe';
|
||||
import { FormatNumberPipe } from './format-number.pipe';
|
||||
import { YesnoPipe } from './yesno.pipe';
|
||||
import { PrettyPrintPipe } from './pretty-print.pipe';
|
||||
import { TranslateCatalogPipe } from './translate-catalog.pipe';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule
|
||||
],
|
||||
declarations: [StatusLookupPipe, AccountsFilterPipe, ChargesFilterPipe, ChargesPenaltyFilterPipe, FindPipe, UrlToStringPipe, DateFormatPipe, DatetimeFormatPipe, ExternalIdentifierPipe, FormatNumberPipe, YesnoPipe, PrettyPrintPipe ],
|
||||
providers: [StatusLookupPipe, AccountsFilterPipe, ChargesFilterPipe, ChargesPenaltyFilterPipe, FindPipe, UrlToStringPipe, DateFormatPipe, DatetimeFormatPipe, ExternalIdentifierPipe, FormatNumberPipe, YesnoPipe, PrettyPrintPipe ],
|
||||
exports: [StatusLookupPipe, AccountsFilterPipe, ChargesFilterPipe, ChargesPenaltyFilterPipe, FindPipe, UrlToStringPipe, DateFormatPipe, DatetimeFormatPipe, ExternalIdentifierPipe, FormatNumberPipe, YesnoPipe, PrettyPrintPipe ]
|
||||
declarations: [StatusLookupPipe,
|
||||
AccountsFilterPipe,
|
||||
ChargesFilterPipe,
|
||||
ChargesPenaltyFilterPipe,
|
||||
FindPipe,
|
||||
UrlToStringPipe,
|
||||
DateFormatPipe,
|
||||
DatetimeFormatPipe,
|
||||
ExternalIdentifierPipe,
|
||||
FormatNumberPipe,
|
||||
YesnoPipe,
|
||||
PrettyPrintPipe,
|
||||
TranslateCatalogPipe],
|
||||
providers: [StatusLookupPipe,
|
||||
AccountsFilterPipe,
|
||||
ChargesFilterPipe,
|
||||
ChargesPenaltyFilterPipe,
|
||||
FindPipe,
|
||||
UrlToStringPipe,
|
||||
DateFormatPipe,
|
||||
DatetimeFormatPipe,
|
||||
ExternalIdentifierPipe,
|
||||
FormatNumberPipe,
|
||||
YesnoPipe,
|
||||
PrettyPrintPipe,
|
||||
TranslateCatalogPipe],
|
||||
exports: [StatusLookupPipe,
|
||||
AccountsFilterPipe,
|
||||
ChargesFilterPipe,
|
||||
ChargesPenaltyFilterPipe,
|
||||
FindPipe,
|
||||
UrlToStringPipe,
|
||||
DateFormatPipe,
|
||||
DatetimeFormatPipe,
|
||||
ExternalIdentifierPipe,
|
||||
FormatNumberPipe,
|
||||
YesnoPipe,
|
||||
PrettyPrintPipe,
|
||||
TranslateCatalogPipe]
|
||||
})
|
||||
export class PipesModule { }
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
|
||||
@Pipe({
|
||||
name: 'translateCatalog'
|
||||
})
|
||||
export class TranslateCatalogPipe implements PipeTransform {
|
||||
|
||||
constructor(private translateService: TranslateService) { }
|
||||
|
||||
transform(attributeValue: any, suffix?: string): string {
|
||||
return this.translateService.instant('labels.catalogs.' + attributeValue);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user