From 95c4e77ae4954b7dea91c304f9226e488204dce8 Mon Sep 17 00:00:00 2001 From: jonaswinkler Date: Wed, 23 Dec 2020 15:09:39 +0100 Subject: [PATCH] added many localization markers to the front end #123 --- .../app-frame/app-frame.component.html | 56 +++++++---------- .../dashboard/dashboard.component.html | 2 +- .../dashboard/dashboard.component.ts | 6 +- .../saved-view-widget.component.html | 6 +- .../statistics-widget.component.html | 6 +- .../upload-file-widget.component.html | 8 +-- .../upload-file-widget.component.ts | 6 +- .../welcome-widget.component.html | 14 ++--- .../document-detail.component.html | 63 +++++++++---------- .../document-detail.component.ts | 8 +-- .../document-card-large.component.html | 20 +++--- .../document-card-small.component.html | 10 +-- .../document-list.component.html | 20 +++--- .../document-list/document-list.component.ts | 6 +- .../save-view-config-dialog.component.html | 12 ++-- .../correspondent-edit-dialog.component.html | 12 ++-- .../correspondent-list.component.html | 25 +++----- .../document-type-edit-dialog.component.html | 12 ++-- .../document-type-list.component.html | 21 +++---- .../generic-list/generic-list.component.ts | 10 +-- .../manage/logs/logs.component.html | 7 ++- .../manage/settings/settings.component.html | 22 +++---- .../manage/settings/settings.component.ts | 6 +- .../not-found/not-found.component.html | 2 +- .../components/search/search.component.html | 2 +- src-ui/src/app/data/matching-model.ts | 12 ++-- .../src/app/services/rest/document.service.ts | 14 ++--- 27 files changed, 178 insertions(+), 210 deletions(-) diff --git a/src-ui/src/app/components/app-frame/app-frame.component.html b/src-ui/src/app/components/app-frame/app-frame.component.html index 2458005f..5fe42fc4 100644 --- a/src-ui/src/app/components/app-frame/app-frame.component.html +++ b/src-ui/src/app/components/app-frame/app-frame.component.html @@ -1,7 +1,7 @@ @@ -28,136 +28,122 @@ - - Dashboard +  Dashboard diff --git a/src-ui/src/app/components/dashboard/dashboard.component.html b/src-ui/src/app/components/dashboard/dashboard.component.html index 541255a6..5b76dd24 100644 --- a/src-ui/src/app/components/dashboard/dashboard.component.html +++ b/src-ui/src/app/components/dashboard/dashboard.component.html @@ -1,4 +1,4 @@ - + diff --git a/src-ui/src/app/components/dashboard/dashboard.component.ts b/src-ui/src/app/components/dashboard/dashboard.component.ts index db9b5d42..0dca25d8 100644 --- a/src-ui/src/app/components/dashboard/dashboard.component.ts +++ b/src-ui/src/app/components/dashboard/dashboard.component.ts @@ -24,15 +24,15 @@ export class DashboardComponent implements OnInit { } else if (tagUsername && tagUsername.content) { return tagUsername.content } else { - return null + return "null" } } get subtitle() { if (this.displayName) { - return `Hello ${this.displayName}, welcome to Paperless-ng!` + return $localize`Hello ${this.displayName}, welcome to Paperless-ng!` } else { - return `Welcome to Paperless-ng!` + return $localize`Welcome to Paperless-ng!` } } diff --git a/src-ui/src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.html b/src-ui/src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.html index f50708af..1bf06b60 100644 --- a/src-ui/src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.html +++ b/src-ui/src/app/components/dashboard/widgets/saved-view-widget/saved-view-widget.component.html @@ -1,13 +1,13 @@ - Show all + Show all - - + + diff --git a/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.html b/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.html index 50d844b3..0ad0005e 100644 --- a/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.html +++ b/src-ui/src/app/components/dashboard/widgets/statistics-widget/statistics-widget.component.html @@ -1,6 +1,6 @@ - + -

Documents in inbox: {{statistics.documents_inbox}}

-

Total documents: {{statistics.documents_total}}

+

Documents in inbox: {{statistics.documents_inbox}}

+

Total documents: {{statistics.documents_total}}

\ No newline at end of file diff --git a/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html b/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html index 013486a4..91fff4e8 100644 --- a/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html +++ b/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.html @@ -1,16 +1,16 @@ - +
- + browseBtnClassName="btn btn-sm btn-outline-primary ml-2" i18n-dropZoneLabel i18n-browseBtnLabel>
-

Uploading {{uploadStatus.length}} file(s)

+

Uploading {{uploadStatus.length}} file(s)

diff --git a/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts b/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts index 2ea4825f..b80f9544 100644 --- a/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts +++ b/src-ui/src/app/components/dashboard/widgets/upload-file-widget/upload-file-widget.component.ts @@ -60,7 +60,7 @@ export class UploadFileWidgetComponent implements OnInit { } else if (event.type == HttpEventType.Response) { this.uploadStatus.splice(this.uploadStatus.indexOf(uploadStatusObject), 1) this.completedFiles += 1 - this.toastService.showToast(Toast.make("Information", "The document has been uploaded and will be processed by the consumer shortly.")) + this.toastService.showToast(Toast.make("Information", $localize`The document has been uploaded and will be processed by the consumer shortly.`)) } }, error => { @@ -68,11 +68,11 @@ export class UploadFileWidgetComponent implements OnInit { this.completedFiles += 1 switch (error.status) { case 400: { - this.toastService.showToast(Toast.makeError(`There was an error while uploading the document: ${error.error.document}`)) + this.toastService.showToast(Toast.makeError($localize`There was an error while uploading the document: ${error.error.document}`)) break; } default: { - this.toastService.showToast(Toast.makeError("An error has occurred while uploading the document. Sorry!")) + this.toastService.showToast(Toast.makeError($localize`An error has occurred while uploading the document. Sorry!`)) break; } } diff --git a/src-ui/src/app/components/dashboard/widgets/welcome-widget/welcome-widget.component.html b/src-ui/src/app/components/dashboard/widgets/welcome-widget/welcome-widget.component.html index 0caf55f1..6c9c34d5 100644 --- a/src-ui/src/app/components/dashboard/widgets/welcome-widget/welcome-widget.component.html +++ b/src-ui/src/app/components/dashboard/widgets/welcome-widget/welcome-widget.component.html @@ -1,16 +1,16 @@ - + -

Paperless is running! :)

-

You can start uploading documents by dropping them in the file upload box to the right or by dropping them in the configured consumption folder and they'll start showing up in the documents list. +

Paperless is running! :)

+

You can start uploading documents by dropping them in the file upload box to the right or by dropping them in the configured consumption folder and they'll start showing up in the documents list. After you've added some metadata to your documents, use the filtering mechanisms of paperless to create custom views (such as 'Recently added', 'Tagged TODO') and have them displayed on the dashboard instead of this message.

-

Paperless offers some more features that try to make your life easier, such as:

+

Paperless offers some more features that try to make your life easier, such as:

    -
  • Once you've got a couple documents in paperless and added metadata to them, paperless can assign that metadata to new documents automatically.
  • -
  • You can configure paperless to read your mails and add documents from attached files.
  • +
  • Once you've got a couple documents in paperless and added metadata to them, paperless can assign that metadata to new documents automatically.
  • +
  • You can configure paperless to read your mails and add documents from attached files.
-

Consult the documentation on how to use these features. The section on basic usage also has some information on how to use paperless in general.

+

Consult the documentation on how to use these features. The section on basic usage also has some information on how to use paperless in general.

\ No newline at end of file diff --git a/src-ui/src/app/components/document-detail/document-detail.component.html b/src-ui/src/app/components/document-detail/document-detail.component.html index ae3fb0c0..f569c103 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.html +++ b/src-ui/src/app/components/document-detail/document-detail.component.html @@ -1,19 +1,18 @@
-
Page
+
Page
-
of {{previewNumPages}}
+
of {{previewNumPages}}
@@ -21,14 +20,13 @@ - - Download +  Download @@ -37,15 +35,13 @@ @@ -57,27 +53,27 @@
CreatedTitleCreatedTitle
- + - + - + - + - + - + - + - +
Date modifiedDate modified {{document.modified | date:'medium'}}
Date addedDate added {{document.added | date:'medium'}}
Media filenameMedia filename {{metadata?.media_filename}}
Original MD5 ChecksumOriginal MD5 checksum {{metadata?.original_checksum}}
Original file sizeOriginal file size {{metadata?.original_size | fileSize}}
Original mime typeOriginal mime type {{metadata?.original_mime_type}}
Archive MD5 ChecksumArchive MD5 checksum {{metadata?.archive_checksum}}
Archive file sizeArchive file size {{metadata?.archive_size | fileSize}}
- - + + @@ -135,10 +131,9 @@
-   -   -   +   +   +   diff --git a/src-ui/src/app/components/document-detail/document-detail.component.ts b/src-ui/src/app/components/document-detail/document-detail.component.ts index d705c317..2efd32f2 100644 --- a/src-ui/src/app/components/document-detail/document-detail.component.ts +++ b/src-ui/src/app/components/document-detail/document-detail.component.ts @@ -158,11 +158,11 @@ export class DocumentDetailComponent implements OnInit { delete() { let modal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'}) - modal.componentInstance.title = "Confirm delete" - modal.componentInstance.messageBold = `Do you really want to delete document '${this.document.title}'?` - modal.componentInstance.message = `The files for this document will be deleted permanently. This operation cannot be undone.` + modal.componentInstance.title = $localize`Confirm delete` + modal.componentInstance.messageBold = $localize`Do you really want to delete document '${this.document.title}'?` + modal.componentInstance.message = $localize`The files for this document will be deleted permanently. This operation cannot be undone.` modal.componentInstance.btnClass = "btn-danger" - modal.componentInstance.btnCaption = "Delete document" + modal.componentInstance.btnCaption = $localize`Delete document` modal.componentInstance.confirmClicked.subscribe(() => { this.documentsService.delete(this.document).subscribe(() => { modal.close() diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html index 8f52f707..ac015cc5 100644 --- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html +++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html @@ -17,11 +17,11 @@
- {{(document.correspondent$ | async)?.name}} + {{(document.correspondent$ | async)?.name}} {{(document.correspondent$ | async)?.name}}: {{document.title | documentTitle}} - +
#{{document.archive_serial_number}}
@@ -36,37 +36,33 @@ - - More like this +  More like this - - Edit +  Edit - - View +  View - - Download +  Download - Score: + Score: - Created: {{document.created | date}} + Created: {{document.created | date}} diff --git a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html index 658aa1ea..4fd15555 100644 --- a/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html +++ b/src-ui/src/app/components/document-list/document-card-small/document-card-small.component.html @@ -12,7 +12,7 @@
- +
+ {{moreTags}} @@ -23,7 +23,7 @@

- {{(document.correspondent$ | async)?.name}}: + {{(document.correspondent$ | async)?.name}}: {{document.title | documentTitle}}

@@ -32,18 +32,18 @@
- + - + - + diff --git a/src-ui/src/app/components/document-list/document-list.component.html b/src-ui/src/app/components/document-list/document-list.component.html index 25bcb746..888639b5 100644 --- a/src-ui/src/app/components/document-list/document-list.component.html +++ b/src-ui/src/app/components/document-list/document-list.component.html @@ -47,7 +47,7 @@
- +
@@ -70,15 +70,15 @@
- +
@@ -104,12 +104,12 @@ - - - - - - + + + + + + diff --git a/src-ui/src/app/components/document-list/document-list.component.ts b/src-ui/src/app/components/document-list/document-list.component.ts index f72a92aa..cb0d09fe 100644 --- a/src-ui/src/app/components/document-list/document-list.component.ts +++ b/src-ui/src/app/components/document-list/document-list.component.ts @@ -48,7 +48,7 @@ export class DocumentListComponent implements OnInit { } getTitle() { - return this.list.savedViewTitle || "Documents" + return this.list.savedViewTitle || $localize`Documents` } getSortFields() { @@ -90,7 +90,7 @@ export class DocumentListComponent implements OnInit { saveViewConfig() { this.savedViewService.update(this.list.savedView).subscribe(result => { - this.toastService.showToast(Toast.make("Information", `View "${this.list.savedView.name}" saved successfully.`)) + this.toastService.showToast(Toast.make("Information", $localize`View "${this.list.savedView.name}" saved successfully.`)) }) } @@ -109,7 +109,7 @@ export class DocumentListComponent implements OnInit { } this.savedViewService.create(savedView).subscribe(() => { modal.close() - this.toastService.showToast(Toast.make("Information", `View "${savedView.name}" created successfully.`)) + this.toastService.showToast(Toast.make("Information", $localize`View "${savedView.name}" created successfully.`)) }) }) } diff --git a/src-ui/src/app/components/document-list/save-view-config-dialog/save-view-config-dialog.component.html b/src-ui/src/app/components/document-list/save-view-config-dialog/save-view-config-dialog.component.html index 8819aa31..9a2a37e3 100644 --- a/src-ui/src/app/components/document-list/save-view-config-dialog/save-view-config-dialog.component.html +++ b/src-ui/src/app/components/document-list/save-view-config-dialog/save-view-config-dialog.component.html @@ -1,17 +1,17 @@ diff --git a/src-ui/src/app/components/manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component.html b/src-ui/src/app/components/manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component.html index e09ea38b..bc3d1c88 100644 --- a/src-ui/src/app/components/manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component.html +++ b/src-ui/src/app/components/manage/correspondent-list/correspondent-edit-dialog/correspondent-edit-dialog.component.html @@ -7,13 +7,13 @@ \ No newline at end of file diff --git a/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.html b/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.html index 2efd1c58..4abc7203 100644 --- a/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.html +++ b/src-ui/src/app/components/manage/correspondent-list/correspondent-list.component.html @@ -1,7 +1,5 @@ - - + +
@@ -11,11 +9,11 @@
ASNCorrespondentTitleDocument typeCreatedAddedASNCorrespondentTitleDocument typeCreatedAdded
- - - - - + + + + + @@ -29,21 +27,18 @@ diff --git a/src-ui/src/app/components/manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component.html b/src-ui/src/app/components/manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component.html index 3338c40c..16c00605 100644 --- a/src-ui/src/app/components/manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component.html +++ b/src-ui/src/app/components/manage/document-type-list/document-type-edit-dialog/document-type-edit-dialog.component.html @@ -7,14 +7,14 @@ \ No newline at end of file diff --git a/src-ui/src/app/components/manage/document-type-list/document-type-list.component.html b/src-ui/src/app/components/manage/document-type-list/document-type-list.component.html index d2ffab40..6de7e059 100644 --- a/src-ui/src/app/components/manage/document-type-list/document-type-list.component.html +++ b/src-ui/src/app/components/manage/document-type-list/document-type-list.component.html @@ -1,7 +1,5 @@ - +
@@ -12,10 +10,10 @@
NameMatchingDocument countLast correspondenceActionsNameMatchingDocument countLast correspondenceActions
- - - - + + + + @@ -28,21 +26,18 @@ diff --git a/src-ui/src/app/components/manage/generic-list/generic-list.component.ts b/src-ui/src/app/components/manage/generic-list/generic-list.component.ts index 783c22b3..e1ef3942 100644 --- a/src-ui/src/app/components/manage/generic-list/generic-list.component.ts +++ b/src-ui/src/app/components/manage/generic-list/generic-list.component.ts @@ -28,7 +28,7 @@ export abstract class GenericListComponent implements On getMatching(o: MatchingModel) { if (o.matching_algorithm == MATCH_AUTO) { - return "Automatic" + return $localize`Automatic` } else if (o.match && o.match.length > 0) { return `${o.match} (${MATCHING_ALGORITHMS.find(a => a.id == o.matching_algorithm).name})` } else { @@ -90,11 +90,11 @@ export abstract class GenericListComponent implements On openDeleteDialog(object: T) { var activeModal = this.modalService.open(ConfirmDialogComponent, {backdrop: 'static'}) - activeModal.componentInstance.title = "Confirm delete" - activeModal.componentInstance.messageBold = `Do you really want to delete ${this.getObjectName(object)}?` - activeModal.componentInstance.message = "Associated documents will not be deleted." + activeModal.componentInstance.title = $localize`Confirm delete` + activeModal.componentInstance.messageBold = $localize`Do you really want to delete ${this.getObjectName(object)}?` + activeModal.componentInstance.message = $localize`Associated documents will not be deleted.` activeModal.componentInstance.btnClass = "btn-danger" - activeModal.componentInstance.btnCaption = "Delete" + activeModal.componentInstance.btnCaption = $localize`Delete` activeModal.componentInstance.confirmClicked.subscribe(() => { this.service.delete(object).subscribe(_ => { activeModal.close() diff --git a/src-ui/src/app/components/manage/logs/logs.component.html b/src-ui/src/app/components/manage/logs/logs.component.html index 6af482c6..8c2cbae3 100644 --- a/src-ui/src/app/components/manage/logs/logs.component.html +++ b/src-ui/src/app/components/manage/logs/logs.component.html @@ -1,11 +1,12 @@ - +
+ +
-
No saved views defined.
+
No saved views defined.
diff --git a/src-ui/src/app/components/manage/settings/settings.component.ts b/src-ui/src/app/components/manage/settings/settings.component.ts index f839010b..bec85e03 100644 --- a/src-ui/src/app/components/manage/settings/settings.component.ts +++ b/src-ui/src/app/components/manage/settings/settings.component.ts @@ -46,14 +46,14 @@ export class SettingsComponent implements OnInit { this.savedViewService.delete(savedView).subscribe(() => { this.savedViewGroup.removeControl(savedView.id.toString()) this.savedViews.splice(this.savedViews.indexOf(savedView), 1) - this.toastService.showToast(Toast.make("Information", `Saved view "${savedView.name} deleted.`)) + this.toastService.showToast(Toast.make("Information", $localize`Saved view "${savedView.name} deleted.`)) }) } private saveLocalSettings() { localStorage.setItem(GENERAL_SETTINGS.DOCUMENT_LIST_SIZE, this.settingsForm.value.documentListItemPerPage) this.documentListViewService.updatePageSize() - this.toastService.showToast(Toast.make("Information", "Settings saved successfully.")) + this.toastService.showToast(Toast.make("Information", $localize`Settings saved successfully.`)) } saveSettings() { @@ -65,7 +65,7 @@ export class SettingsComponent implements OnInit { this.savedViewService.patchMany(x).subscribe(s => { this.saveLocalSettings() }, error => { - this.toastService.showToast(Toast.makeError(`Error while storing settings on server: ${JSON.stringify(error.error)}`)) + this.toastService.showToast(Toast.makeError($localize`Error while storing settings on server: ${JSON.stringify(error.error)}`)) }) } else { this.saveLocalSettings() diff --git a/src-ui/src/app/components/not-found/not-found.component.html b/src-ui/src/app/components/not-found/not-found.component.html index 6b21cf3b..4d7e0f7e 100644 --- a/src-ui/src/app/components/not-found/not-found.component.html +++ b/src-ui/src/app/components/not-found/not-found.component.html @@ -4,5 +4,5 @@ -

404 Not Found

+

404 Not Found

\ No newline at end of file diff --git a/src-ui/src/app/components/search/search.component.html b/src-ui/src/app/components/search/search.component.html index de6f0133..ba225340 100644 --- a/src-ui/src/app/components/search/search.component.html +++ b/src-ui/src/app/components/search/search.component.html @@ -1,7 +1,7 @@ -
Invalid search query: {{errorMessage}}
+
Invalid search query: {{errorMessage}}

Showing documents similar to diff --git a/src-ui/src/app/data/matching-model.ts b/src-ui/src/app/data/matching-model.ts index 698c32da..dd9ae95f 100644 --- a/src-ui/src/app/data/matching-model.ts +++ b/src-ui/src/app/data/matching-model.ts @@ -9,12 +9,12 @@ export const MATCH_FUZZY = 5 export const MATCH_AUTO = 6 export const MATCHING_ALGORITHMS = [ - {id: MATCH_ANY, name: "Any"}, - {id: MATCH_ALL, name: "All"}, - {id: MATCH_LITERAL, name: "Literal"}, - {id: MATCH_REGEX, name: "Regular Expression"}, - {id: MATCH_FUZZY, name: "Fuzzy Match"}, - {id: MATCH_AUTO, name: "Auto"}, + {id: MATCH_ANY, name: $localize`Any`}, + {id: MATCH_ALL, name: $localize`All`}, + {id: MATCH_LITERAL, name: $localize`Literal`}, + {id: MATCH_REGEX, name: $localize`Regular expression`}, + {id: MATCH_FUZZY, name: $localize`Fuzzy match`}, + {id: MATCH_AUTO, name: $localize`Auto`}, ] export interface MatchingModel extends ObjectWithId { diff --git a/src-ui/src/app/services/rest/document.service.ts b/src-ui/src/app/services/rest/document.service.ts index c132fa85..ec5c7689 100644 --- a/src-ui/src/app/services/rest/document.service.ts +++ b/src-ui/src/app/services/rest/document.service.ts @@ -13,13 +13,13 @@ import { TagService } from './tag.service'; import { FILTER_RULE_TYPES } from 'src/app/data/filter-rule-type'; export const DOCUMENT_SORT_FIELDS = [ - { field: "correspondent__name", name: "Correspondent" }, - { field: "document_type__name", name: "Document type" }, - { field: 'title', name: 'Title' }, - { field: 'archive_serial_number', name: 'ASN' }, - { field: 'created', name: 'Created' }, - { field: 'added', name: 'Added' }, - { field: 'modified', name: 'Modified' } + { field: "correspondent__name", name: $localize`Correspondent` }, + { field: "document_type__name", name: $localize`Document type` }, + { field: 'title', name: $localize`Title` }, + { field: 'archive_serial_number', name: $localize`ASN` }, + { field: 'created', name: $localize`Created` }, + { field: 'added', name: $localize`Added` }, + { field: 'modified', name: $localize`Modified` } ] @Injectable({

NameMatchingDocument countActionsNameMatchingDocument countActions