فهرست منبع

refactor(admin-ui): Simplify some translation strings

Michael Bromley 7 سال پیش
والد
کامیت
33c284aea2

+ 1 - 1
admin-ui/src/app/administrator/components/administrator-list/administrator-list.component.html

@@ -13,7 +13,7 @@
                 [currentPage]="currentPage$ | async"
                 (pageChange)="setPageNumber($event)"
                 (itemsPerPageChange)="setItemsPerPage($event)">
-    <vdr-dt-column>{{ 'admin.ID' | translate }}</vdr-dt-column>
+    <vdr-dt-column>{{ 'common.ID' | translate }}</vdr-dt-column>
     <vdr-dt-column>{{ 'admin.first-name' | translate }}</vdr-dt-column>
     <vdr-dt-column>{{ 'admin.last-name' | translate }}</vdr-dt-column>
     <vdr-dt-column>{{ 'admin.email-address' | translate }}</vdr-dt-column>

+ 1 - 1
admin-ui/src/app/administrator/components/role-detail/role-detail.component.html

@@ -19,7 +19,7 @@
         <vdr-form-field [label]="'admin.description' | translate" for="description">
             <input id="description" type="text" formControlName="description" (input)="updateCode($event.target.value)">
         </vdr-form-field>
-        <vdr-form-field [label]="'admin.code' | translate" for="code" [readOnlyToggle]="true">
+        <vdr-form-field [label]="'common.code' | translate" for="code" [readOnlyToggle]="true">
             <input id="code" type="text" formControlName="code">
         </vdr-form-field>
     </section>

+ 10 - 4
admin-ui/src/app/administrator/components/role-detail/role-detail.component.ts

@@ -71,14 +71,17 @@ export class RoleDetailComponent extends BaseDetailComponent<Role> implements On
         };
         this.dataService.administrator.createRole(role).subscribe(
             data => {
-                this.notificationService.success(_('admin.notify-create-role-success'));
+                this.notificationService.success(_('common.notify-create-success'), { entity: 'Role' });
                 this.roleForm.markAsPristine();
                 this.changeDetector.markForCheck();
                 this.permissionsChanged = false;
                 this.router.navigate(['../', data.createRole.id], { relativeTo: this.route });
             },
             err => {
-                this.notificationService.error(_('admin.notify-create-role-error'));
+                this.notificationService.error(_('common.notify-create-error'), {
+                    entity: 'Role',
+                    error: err.message,
+                });
             },
         );
     }
@@ -100,13 +103,16 @@ export class RoleDetailComponent extends BaseDetailComponent<Role> implements On
             )
             .subscribe(
                 data => {
-                    this.notificationService.success(_('admin.notify-update-role-success'));
+                    this.notificationService.success(_('common.notify-update-success'), { entity: 'Role' });
                     this.roleForm.markAsPristine();
                     this.changeDetector.markForCheck();
                     this.permissionsChanged = false;
                 },
                 err => {
-                    this.notificationService.error(_('admin.notify-update-role-error'));
+                    this.notificationService.error(_('common.notify-update-error'), {
+                        entity: 'Role',
+                        error: err.message,
+                    });
                 },
             );
     }

+ 2 - 2
admin-ui/src/app/administrator/components/role-list/role-list.component.html

@@ -13,8 +13,8 @@
                 [currentPage]="currentPage$ | async"
                 (pageChange)="setPageNumber($event)"
                 (itemsPerPageChange)="setItemsPerPage($event)">
-    <vdr-dt-column>{{ 'admin.ID' | translate }}</vdr-dt-column>
-    <vdr-dt-column>{{ 'admin.code' | translate }}</vdr-dt-column>
+    <vdr-dt-column>{{ 'common.ID' | translate }}</vdr-dt-column>
+    <vdr-dt-column>{{ 'common.code' | translate }}</vdr-dt-column>
     <vdr-dt-column>{{ 'admin.description' | translate }}</vdr-dt-column>
     <vdr-dt-column>{{ 'admin.permissions' | translate }}</vdr-dt-column>
     <vdr-dt-column></vdr-dt-column>

+ 2 - 2
admin-ui/src/app/catalog/components/facet-detail/facet-detail.component.html

@@ -25,7 +25,7 @@
         <vdr-form-field [label]="'catalog.name' | translate" for="name">
             <input id="name" type="text" formControlName="name" (input)="updateCode($event.target.value)">
         </vdr-form-field>
-        <vdr-form-field [label]="'catalog.code' | translate" for="code" [readOnlyToggle]="true">
+        <vdr-form-field [label]="'common.code' | translate" for="code" [readOnlyToggle]="true">
             <input id="code" type="text" formControlName="code">
         </vdr-form-field>
 
@@ -47,7 +47,7 @@
             <thead>
             <tr>
                 <th>{{ 'catalog.name' | translate }}</th>
-                <th>{{ 'catalog.code' | translate }}</th>
+                <th>{{ 'common.code' | translate }}</th>
                 <ng-container *ngFor="let customField of customValueFields">
                     <th>{{ customField.name }}</th>
                 </ng-container>

+ 8 - 4
admin-ui/src/app/catalog/components/facet-detail/facet-detail.component.ts

@@ -118,13 +118,16 @@ export class FacetDetailComponent extends BaseDetailComponent<FacetWithValues> i
             )
             .subscribe(
                 data => {
-                    this.notificationService.success(_('catalog.notify-create-facet-success'));
+                    this.notificationService.success(_('common.notify-create-success'), { entity: 'Facet' });
                     this.facetForm.markAsPristine();
                     this.changeDetector.markForCheck();
                     this.router.navigate(['../', data.createFacet.id], { relativeTo: this.route });
                 },
                 err => {
-                    this.notificationService.error(_('catalog.notify-create-facet-error'));
+                    this.notificationService.error(_('common.notify-create-error'), {
+                        entity: 'Facet',
+                        error: err.message,
+                    });
                 },
             );
     }
@@ -172,11 +175,12 @@ export class FacetDetailComponent extends BaseDetailComponent<FacetWithValues> i
                 () => {
                     this.facetForm.markAsPristine();
                     this.changeDetector.markForCheck();
-                    this.notificationService.success(_('catalog.notify-update-facet-success'));
+                    this.notificationService.success(_('common.notify-update-success'), { entity: 'Facet' });
                 },
                 err => {
-                    this.notificationService.error(_('catalog.notify-update-facet-error'), {
+                    this.notificationService.error(_('common.notify-update-error'), {
                         error: err.message,
+                        entity: 'Facet',
                     });
                 },
             );

+ 2 - 2
admin-ui/src/app/catalog/components/facet-list/facet-list.component.html

@@ -13,8 +13,8 @@
                 [currentPage]="currentPage$ | async"
                 (pageChange)="setPageNumber($event)"
                 (itemsPerPageChange)="setItemsPerPage($event)">
-    <vdr-dt-column>{{ 'catalog.ID' | translate }}</vdr-dt-column>
-    <vdr-dt-column>{{ 'catalog.code' | translate }}</vdr-dt-column>
+    <vdr-dt-column>{{ 'common.ID' | translate }}</vdr-dt-column>
+    <vdr-dt-column>{{ 'common.code' | translate }}</vdr-dt-column>
     <vdr-dt-column>{{ 'catalog.name' | translate }}</vdr-dt-column>
     <vdr-dt-column>{{ 'catalog.values' | translate }}</vdr-dt-column>
     <vdr-dt-column></vdr-dt-column>

+ 12 - 4
admin-ui/src/app/catalog/components/product-detail/product-detail.component.ts

@@ -133,12 +133,17 @@ export class ProductDetailComponent extends BaseDetailComponent<ProductWithVaria
             )
             .subscribe(
                 data => {
-                    this.notificationService.success(_('catalog.notify-create-product-success'));
+                    this.notificationService.success(_('common.notify-create-success'), {
+                        entity: 'Product',
+                    });
                     this.productForm.markAsPristine();
                     this.router.navigate(['../', data.createProduct.id], { relativeTo: this.route });
                 },
                 err => {
-                    this.notificationService.error(_('catalog.notify-create-product-error'));
+                    this.notificationService.error(_('common.notify-create-error'), {
+                        entity: 'Product',
+                        error: err.message,
+                    });
                 },
             );
     }
@@ -177,11 +182,14 @@ export class ProductDetailComponent extends BaseDetailComponent<ProductWithVaria
             .subscribe(
                 () => {
                     this.productForm.markAsPristine();
-                    this.notificationService.success(_('catalog.notify-update-product-success'));
+                    this.notificationService.success(_('common.notify-update-success'), {
+                        entity: 'Product',
+                    });
                 },
                 err => {
-                    this.notificationService.error(_('catalog.notify-update-product-error'), {
+                    this.notificationService.error(_('common.notify-update-error'), {
                         error: err.message,
+                        entity: 'Product',
                     });
                 },
             );

+ 1 - 1
admin-ui/src/app/catalog/components/product-list/product-list.component.html

@@ -13,7 +13,7 @@
                 [currentPage]="currentPage$ | async"
                 (pageChange)="setPageNumber($event)"
                 (itemsPerPageChange)="setItemsPerPage($event)">
-    <vdr-dt-column>{{ 'catalog.ID' | translate }}</vdr-dt-column>
+    <vdr-dt-column>{{ 'common.ID' | translate }}</vdr-dt-column>
     <vdr-dt-column>{{ 'catalog.name' | translate }}</vdr-dt-column>
     <vdr-dt-column>{{ 'catalog.slug' | translate }}</vdr-dt-column>
     <vdr-dt-column>{{ 'catalog.description' | translate }}</vdr-dt-column>

+ 1 - 1
admin-ui/src/app/catalog/components/product-variants-wizard/product-variants-wizard.component.ts

@@ -67,7 +67,7 @@ export class ProductVariantsWizardComponent implements OnChanges {
     createOptionGroup() {
         this.createOptionGroupForm.createOptionGroup().subscribe(data => {
             this.toggleSelectedGroup(data.createProductOptionGroup);
-            this.notificationService.success(_('catalog.notify-create-new-option-group'));
+            this.notificationService.success(_('common.notify-create-success'), { entity: 'OptionGroup' });
             this.createOptionGroupForm.resetForm();
         });
     }

+ 8 - 19
admin-ui/src/i18n-messages/en.json

@@ -1,22 +1,16 @@
 {
   "admin": {
-    "ID": "ID",
     "administrator": "Administrator",
     "catalog": "Catalog",
-    "code": "Code",
     "create": "Create",
     "create-new-administrator": "Create new administrator",
     "create-new-role": "Create new role",
-    "customer": "Read",
-    "delete": "Update",
+    "customer": "Customer",
+    "delete": "Delete",
     "description": "Delete",
     "email-address": "Email address",
     "first-name": "First name",
     "last-name": "Last name",
-    "notify-create-role-error": "An error occurred, could not create role",
-    "notify-create-role-success": "Created new role",
-    "notify-update-role-error": "An error occurred, could not create role",
-    "notify-update-role-success": "Updated role",
     "order": "Order",
     "permissions": "Permissions",
     "read": "Read",
@@ -32,10 +26,8 @@
     "roles": "Roles"
   },
   "catalog": {
-    "ID": "ID",
     "add-facet-value": "Add facet value",
     "apply-facets": "Apply facets",
-    "code": "Code",
     "confirm-generate-product-variants": "Click 'Finish' to generate {count} product variants.",
     "create-group": "Create option group",
     "create-new-facet": "Create new facet",
@@ -50,15 +42,6 @@
     "generate-variants-default-only": "This product does not have options",
     "generate-variants-with-options": "This product has options",
     "name": "Name",
-    "notify-create-facet-error": "An error occurred, could not create facet",
-    "notify-create-facet-success": "Created new facet",
-    "notify-create-new-option-group": "Created new option group",
-    "notify-create-product-error": "An error occurred, could not create product",
-    "notify-create-product-success": "Created new product",
-    "notify-update-facet-error": "An error occurred, could not update facet\n\n { error }",
-    "notify-update-facet-success": "Updated facet",
-    "notify-update-product-error": "An error occurred, could not update product\n\n { error }",
-    "notify-update-product-success": "Updated product",
     "option-group-code": "Code",
     "option-group-name": "Option group name",
     "option-group-options-label": "Options",
@@ -78,8 +61,10 @@
     "with-selected": "With selected"
   },
   "common": {
+    "ID": "ID",
     "back": "Back",
     "cancel": "Cancel",
+    "code": "Code",
     "confirm": "Confirm",
     "create": "Create",
     "edit": "Edit",
@@ -89,6 +74,10 @@
     "log-out": "Log out",
     "login": "Log in",
     "next": "Next",
+    "notify-create-error": "An error occurred, could not create { entity }\n\n { error }",
+    "notify-create-success": "Created new { entity }",
+    "notify-update-error": "An error occurred, could not update { entity }\n\n { error }",
+    "notify-update-success": "Updated { entity }",
     "password": "Password",
     "remember-me": "Remember me",
     "update": "Update",