mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
more localization tags #123
This commit is contained in:
parent
bd3a2306d6
commit
9093ac5901
@ -13,8 +13,7 @@ export abstract class EditDialogComponent<T extends ObjectWithId> implements OnI
|
||||
constructor(
|
||||
private service: AbstractPaperlessService<T>,
|
||||
private activeModal: NgbActiveModal,
|
||||
private toastService: ToastService,
|
||||
private entityName: string) { }
|
||||
private toastService: ToastService) { }
|
||||
|
||||
@Input()
|
||||
dialogMode: string = 'create'
|
||||
@ -35,12 +34,24 @@ export abstract class EditDialogComponent<T extends ObjectWithId> implements OnI
|
||||
}
|
||||
}
|
||||
|
||||
getCreateTitle() {
|
||||
return $localize`Create new item`
|
||||
}
|
||||
|
||||
getEditTitle() {
|
||||
return $localize`Edit item`
|
||||
}
|
||||
|
||||
getSaveErrorMessage(error: string) {
|
||||
return $localize`Could not save element: ${error}`
|
||||
}
|
||||
|
||||
getTitle() {
|
||||
switch (this.dialogMode) {
|
||||
case 'create':
|
||||
return "Create new " + this.entityName
|
||||
return this.getCreateTitle()
|
||||
case 'edit':
|
||||
return "Edit " + this.entityName
|
||||
return this.getEditTitle()
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -66,7 +77,7 @@ export abstract class EditDialogComponent<T extends ObjectWithId> implements OnI
|
||||
this.activeModal.close()
|
||||
this.success.emit(result)
|
||||
}, error => {
|
||||
this.toastService.showError($localize`Could not save ${this.entityName}: ${error.error.name}`)
|
||||
this.toastService.showError(this.getSaveErrorMessage(error.error.name))
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,19 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
export class CorrespondentEditDialogComponent extends EditDialogComponent<PaperlessCorrespondent> {
|
||||
|
||||
constructor(service: CorrespondentService, activeModal: NgbActiveModal, toastService: ToastService) {
|
||||
super(service, activeModal, toastService, 'correspondent')
|
||||
super(service, activeModal, toastService)
|
||||
}
|
||||
|
||||
getCreateTitle() {
|
||||
return $localize`Create new correspondent`
|
||||
}
|
||||
|
||||
getEditTitle() {
|
||||
return $localize`Edit correspondent`
|
||||
}
|
||||
|
||||
getSaveErrorMessage(error: string) {
|
||||
return $localize`Could not save correspondent: ${error}`
|
||||
}
|
||||
|
||||
getForm(): FormGroup {
|
||||
|
@ -22,8 +22,8 @@ export class CorrespondentListComponent extends GenericListComponent<PaperlessCo
|
||||
super(correspondentsService,modalService,CorrespondentEditDialogComponent)
|
||||
}
|
||||
|
||||
getObjectName(object: PaperlessCorrespondent) {
|
||||
return `correspondent '${object.name}'`
|
||||
getDeleteMessage(object: PaperlessCorrespondent) {
|
||||
return $localize`Do you really want to delete the correspondent ${object.name}?`
|
||||
}
|
||||
|
||||
filterDocuments(object: PaperlessCorrespondent) {
|
||||
|
@ -14,7 +14,19 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
export class DocumentTypeEditDialogComponent extends EditDialogComponent<PaperlessDocumentType> {
|
||||
|
||||
constructor(service: DocumentTypeService, activeModal: NgbActiveModal, toastService: ToastService) {
|
||||
super(service, activeModal, toastService, 'document type')
|
||||
super(service, activeModal, toastService)
|
||||
}
|
||||
|
||||
getCreateTitle() {
|
||||
return $localize`Create new document type`
|
||||
}
|
||||
|
||||
getEditTitle() {
|
||||
return $localize`Edit document type`
|
||||
}
|
||||
|
||||
getSaveErrorMessage(error: string) {
|
||||
return $localize`Could not save document type: ${error}`
|
||||
}
|
||||
|
||||
getForm(): FormGroup {
|
||||
|
@ -22,10 +22,11 @@ export class DocumentTypeListComponent extends GenericListComponent<PaperlessDoc
|
||||
super(service, modalService, DocumentTypeEditDialogComponent)
|
||||
}
|
||||
|
||||
getObjectName(object: PaperlessDocumentType) {
|
||||
return `document type '${object.name}'`
|
||||
getDeleteMessage(object: PaperlessDocumentType) {
|
||||
return $localize`Do you really want to delete the document type ${object.name}?`
|
||||
}
|
||||
|
||||
|
||||
filterDocuments(object: PaperlessDocumentType) {
|
||||
this.list.documentListView.filter_rules = [
|
||||
{rule_type: FILTER_DOCUMENT_TYPE, value: object.id.toString()}
|
||||
|
@ -84,14 +84,14 @@ export abstract class GenericListComponent<T extends ObjectWithId> implements On
|
||||
})
|
||||
}
|
||||
|
||||
getObjectName(object: T) {
|
||||
return object.toString()
|
||||
getDeleteMessage(object: T) {
|
||||
return $localize`Do you really want to delete this element?`
|
||||
}
|
||||
|
||||
openDeleteDialog(object: T) {
|
||||
var activeModal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'})
|
||||
activeModal.componentInstance.title = $localize`Confirm delete`
|
||||
activeModal.componentInstance.messageBold = $localize`Do you really want to delete ${this.getObjectName(object)}?`
|
||||
activeModal.componentInstance.messageBold = this.getDeleteMessage(object)
|
||||
activeModal.componentInstance.message = $localize`Associated documents will not be deleted.`
|
||||
activeModal.componentInstance.btnClass = "btn-danger"
|
||||
activeModal.componentInstance.btnCaption = $localize`Delete`
|
||||
|
@ -14,7 +14,19 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
export class TagEditDialogComponent extends EditDialogComponent<PaperlessTag> {
|
||||
|
||||
constructor(service: TagService, activeModal: NgbActiveModal, toastService: ToastService) {
|
||||
super(service, activeModal, toastService, 'tag')
|
||||
super(service, activeModal, toastService)
|
||||
}
|
||||
|
||||
getCreateTitle() {
|
||||
return $localize`Create new tag`
|
||||
}
|
||||
|
||||
getEditTitle() {
|
||||
return $localize`Edit tag`
|
||||
}
|
||||
|
||||
getSaveErrorMessage(error: string) {
|
||||
return $localize`Could not save tag: ${error}`
|
||||
}
|
||||
|
||||
getForm(): FormGroup {
|
||||
|
@ -26,8 +26,8 @@ export class TagListComponent extends GenericListComponent<PaperlessTag> {
|
||||
return TAG_COLOURS.find(c => c.id == id)
|
||||
}
|
||||
|
||||
getObjectName(object: PaperlessTag) {
|
||||
return `tag '${object.name}'`
|
||||
getDeleteMessage(object: PaperlessTag) {
|
||||
return $localize`Do you really want to delete the tag ${object.name}?`
|
||||
}
|
||||
|
||||
filterDocuments(object: PaperlessTag) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user