Skip to content

Commit

Permalink
Translation: correct some static strings
Browse files Browse the repository at this point in the history
Closes rero/rero-ils#1820.
Closes rero/rero-ils#1798.

Co-Authored-by: Renaud Michotte <renaud.michotte@gmaiil.com>
  • Loading branch information
zannkukai and Renaud Michotte committed May 14, 2021
1 parent eef0d48 commit 956e571
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,9 @@ export class CheckinComponent implements OnInit {
private _checkinErrorManagement(error: any, barcode: string) {
// get the error message from the raised error. This will be the toastr message core.
let message = (error.hasOwnProperty('error') && error.error.hasOwnProperty('status'))
? error.error.status.replace(/^error:/, '')
? error.error.status.replace(/^error:/, '').trim()
: error.message;
message = this._translate.instant(message);

// the message could contains some data information from the item. So we need to load the item
this._itemsService.getItem(barcode).pipe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export class LoanComponent implements OnInit, OnDestroy {
},
error => {
this._toastService.error(
error.message,
this._translateService.instant(error.message),
this._translateService.instant('Checkout')
);
this.searchText = '';
Expand Down Expand Up @@ -288,8 +288,9 @@ export class LoanComponent implements OnInit, OnDestroy {
this.checkedInItems.unshift(newItem);
// display a toast message if the item goes in transit...
if (newItem.status === ItemStatus.IN_TRANSIT) {
const destination = newItem.loan.item_destination.library_name;
this._toastService.warning(
this._translateService.instant('The item is in transit'),
this._translateService.instant('The item is in transit to [{{ destination }}]', {destination}),
this._translateService.instant('Checkin')
);
}
Expand Down Expand Up @@ -327,7 +328,7 @@ export class LoanComponent implements OnInit, OnDestroy {
errorMessage = err.error.message;
}
if (err.error.status === 403) {
let message = errorMessage || this._translateService.instant('Checkout is not allowed by circulation policy');
let message = this._translateService.instant(errorMessage) || this._translateService.instant('Checkout is not allowed by circulation policy');
let title = this._translateService.instant('Circulation');
if (message.includes(': ')) {
const splittedData = message.split(': ', 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,9 @@ export class ItemTransactionsComponent implements OnInit {
this._currentUser.currentLibrary
)
.subscribe((itemData: any) => {
const status = itemData.status;
const status = this._translateService.instant(itemData.status);
this._toastrService.warning(
this._translateService.instant('The item is ' + status),
// this._translateService.instant('The item is {{ status }}', { status }),
this._translateService.instant('The item is {{ status }}', { status }),
this._translateService.instant('Request')
);
this.cancelRequestEvent.emit();
Expand Down
2 changes: 1 addition & 1 deletion projects/admin/src/app/service/items.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class ItemsService {
catchError(e => {
switch (e.status) {
case 404:
throw new Error('item not found');
throw new Error('Item not found');
default:
throw e;
}
Expand Down
6 changes: 6 additions & 0 deletions projects/admin/src/manual_translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ _('The item status does not allow requests.');
_('Library not found.');
_('Patron not found.');
_('Request possible');
_('Circulation policy disallows the operation.');
_('No circulation action performed');
_('Item returned at owning library');
_('The item is {{ status }}');
_('The item is in transit to [{{ destination }}]');
_('Checkout is not allowed by circulation policy');

// item note
_('public_note');
Expand Down

0 comments on commit 956e571

Please sign in to comment.