Skip to content

Commit

Permalink
refactor(admin-ui): Create assets translation group
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Feb 12, 2020
1 parent 7011bc1 commit 7c114fd
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
type="text"
name="searchTerm"
[formControl]="searchTerm"
[placeholder]="'catalog.search-asset-name' | translate"
[placeholder]="'asset.search-asset-name' | translate"
class="clr-input search-input"
/>
</vdr-ab-left>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class AssetListComponent extends BaseListComponent<GetAssetList.Query, Ge
if (files.length) {
this.dataService.product.createAssets(files).subscribe(res => {
super.refresh();
this.notificationService.success(_('catalog.notify-create-assets-success'), {
this.notificationService.success(_('asset.notify-create-assets-success'), {
count: files.length,
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<div class="card-footer" *vdrIfPermissions="'UpdateCatalog'">
<button class="btn" (click)="selectAssets()">
<clr-icon shape="attachment"></clr-icon>
{{ 'catalog.add-asset' | translate }}
{{ 'asset.add-asset' | translate }}
</button>
</div>
</div>
Expand All @@ -35,11 +35,11 @@
<button
*vdrIfPermissions="'UpdateCatalog'"
class="compact-select btn btn-icon btn-sm btn-block"
[title]="'catalog.add-asset' | translate"
[title]="'asset.add-asset' | translate"
(click)="selectAssets()"
>
<clr-icon shape="attachment"></clr-icon>
{{ 'catalog.add-asset' | translate }}
{{ 'asset.add-asset' | translate }}
</button>
</ng-template>

Expand Down Expand Up @@ -78,7 +78,7 @@
vdrDropdownItem
(click)="setAsFeatured(asset)"
>
{{ 'catalog.set-as-featured-asset' | translate }}
{{ 'asset.set-as-featured-asset' | translate }}
</button>
<div class="dropdown-divider"></div>
<button
Expand All @@ -88,7 +88,7 @@
[disabled]="!('UpdateCatalog' | hasPermission)"
(click)="removeAsset(asset)"
>
{{ 'catalog.remove-asset' | translate }}
{{ 'asset.remove-asset' | translate }}
</button>
</vdr-dropdown-menu>
</vdr-dropdown>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<input type="file" class="file-input" #fileInput (change)="select($event)" multiple />
<button class="btn btn-primary" (click)="fileInput.click()">
<clr-icon shape="upload-cloud"></clr-icon>
{{ 'catalog.upload-assets' | translate }}
{{ 'asset.upload-assets' | translate }}
</button>
<div
class="drop-zone"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<div class="card-block details" *ngIf="selection.length >= 1">
<div class="name">{{ lastSelected().name }}</div>
<div>
{{ 'catalog.original-asset-size' | translate }}: {{ lastSelected().fileSize | filesize }}
{{ 'asset.original-asset-size' | translate }}: {{ lastSelected().fileSize | filesize }}
</div>
<div>
<button (click)="previewAsset(lastSelected())" class="btn btn-link">
Expand All @@ -44,7 +44,7 @@
</div>
<div>
<a [href]="lastSelected().source" target="_blank" class="btn btn-link">
{{ 'catalog.open-asset-source' | translate }}
{{ 'asset.open-asset-source' | translate }}
</a>
</div>
</div>
Expand All @@ -53,7 +53,7 @@
<div class="selection-count" [class.visible]="selection.length > 1">
<clr-tooltip>
<div clrTooltipTrigger class="trigger">
{{ 'catalog.assets-selected-count' | translate: { count: selection.length } }}
{{ 'asset.assets-selected-count' | translate: { count: selection.length } }}
</div>
<clr-tooltip-content vdrPosition="top-left" clrSize="lg">
<ul>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<ng-template vdrDialogTitle>
<div class="title-row">
{{ 'catalog.select-assets' | translate }}
{{ 'asset.select-assets' | translate }}
<vdr-asset-file-input
(selectFiles)="createAssets($event)"
dropZoneTarget=".modal-content"
Expand All @@ -11,7 +11,7 @@
type="text"
name="searchTerm"
[formControl]="searchTerm"
[placeholder]="'catalog.search-asset-name' | translate"
[placeholder]="'asset.search-asset-name' | translate"
class="clr-input search-input"
/>
<vdr-asset-gallery
Expand All @@ -37,6 +37,6 @@
<ng-template vdrDialogButtons>
<button type="button" class="btn" (click)="cancel()">{{ 'common.cancel' | translate }}</button>
<button type="submit" (click)="select()" class="btn btn-primary" [disabled]="selection.length === 0">
{{ 'catalog.add-asset-with-count' | translate: { count: selection.length } }}
{{ 'asset.add-asset-with-count' | translate: { count: selection.length } }}
</button>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class AssetPickerDialogComponent implements OnInit, OnDestroy, Dialog<Ass
this.paginationConfig.itemsPerPage,
this.searchTerm.value,
);
this.notificationService.success(_('catalog.notify-create-assets-success'), {
this.notificationService.success(_('asset.notify-create-assets-success'), {
count: files.length,
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
</div>
<div class="flex-spacer"></div>
<a [href]="asset.source" target="_blank" class="btn btn-link">
{{ 'catalog.open-asset-source' | translate }}
{{ 'asset.open-asset-source' | translate }}
</a>
</div>
26 changes: 14 additions & 12 deletions packages/admin-ui/src/i18n-messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
"admin": {
"create-new-administrator": "Create new administrator"
},
"asset": {
"add-asset": "Add asset",
"add-asset-with-count": "Add {count, plural, 0 {assets} one {1 asset} other {{count} assets}}",
"assets-selected-count": "{ count } assets selected",
"notify-create-assets-success": "Created {count, plural, one {new Asset} other {{count} new Assets}}",
"open-asset-source": "Open asset source",
"original-asset-size": "Source size",
"remove-asset": "Remove asset",
"search-asset-name": "Search assets by name",
"select-assets": "Select assets",
"set-as-featured-asset": "Set as featured asset",
"upload-assets": "Upload assets"
},
"breadcrumb": {
"administrators": "Administrators",
"assets": "Assets",
Expand All @@ -23,12 +36,9 @@
"tax-rates": "Tax rates"
},
"catalog": {
"add-asset": "Add asset",
"add-asset-with-count": "Add {count, plural, 0 {assets} one {1 asset} other {{count} assets}}",
"add-facet-value": "Add facet value",
"add-facets": "Add facets",
"add-option": "Add option",
"assets-selected-count": "{ count } assets selected",
"assign-product-to-channel-success": "Successfully assigned Product to \"{ channel }\"",
"assign-products-to-channel": "Assign products to channel",
"assign-to-channel": "Assign to channel",
Expand Down Expand Up @@ -69,14 +79,11 @@
"no-channel-selected": "No channel selected",
"no-featured-asset": "No featured asset",
"no-selection": "No selection",
"notify-create-assets-success": "Created {count, plural, one {new Asset} other {{count} new Assets}}",
"notify-remove-product-from-channel-error": "Could not remove product from channel",
"notify-remove-product-from-channel-success": "Successfully removed product from channel",
"open-asset-source": "Open asset source",
"option": "Option",
"option-name": "Option name",
"option-values": "Option values",
"original-asset-size": "Source size",
"preview": "Preview",
"preview-size": "Preview size",
"price": "Price",
Expand All @@ -93,15 +100,11 @@
"reindex-error": "An error occurred while rebuilding search index",
"reindex-successful": "Indexed {count, plural, one {product variant} other {{count} product variants}} in {time}ms",
"reindexing": "Rebuilding search index",
"remove-asset": "Remove asset",
"remove-from-channel": "Remove from channel",
"remove-option": "Remove option",
"remove-product-from-channel": "Remove product from channel",
"search-asset-name": "Search assets by name",
"search-for-term": "Search for term",
"search-product-name-or-code": "Search by product name or code",
"select-assets": "Select assets",
"set-as-featured-asset": "Set as featured asset",
"sku": "SKU",
"slug": "Slug",
"slug-pattern-error": "The slug may only contain letters, numbers, - and _",
Expand All @@ -110,7 +113,6 @@
"taxes": "Taxes",
"track-inventory": "Track inventory",
"update-product-option": "Update product option",
"upload-assets": "Upload assets",
"values": "Values",
"variant": "Variant",
"view-contents": "View contents",
Expand Down Expand Up @@ -611,4 +613,4 @@
"update": "Update",
"zone": "Zone"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class SliderControl implements CustomFieldControl {
</div>
<button class="btn" (click)="selectAssets()">
<clr-icon shape="attachment"></clr-icon>
{{ 'catalog.add-asset' | translate }}
{{ 'asset.add-asset' | translate }}
</button>
`,
})
Expand Down

0 comments on commit 7c114fd

Please sign in to comment.