From 63e4f9bd3497fad97ad40ee18b30960eb181d1f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20=C5=BBegle=C5=84?= Date: Mon, 26 Aug 2019 19:53:22 +0200 Subject: [PATCH] Refactor product section translations (#125) --- locale/messages.pot | 790 +++++++++++++++++- src/intl.ts | 4 + .../ProductAttributes/ProductAttributes.tsx | 31 +- .../ProductCategoryAndCollectionsForm.tsx | 69 +- .../ProductCreatePage/ProductCreatePage.tsx | 16 +- .../ProductDetailsForm/ProductDetailsForm.tsx | 66 +- .../ProductImageNavigation.tsx | 62 +- .../ProductImagePage/ProductImagePage.tsx | 147 ++-- .../ProductImages/ProductImages.tsx | 147 ++-- .../ProductListFilter/ProductListFilter.tsx | 190 +++-- .../ProductListPage/ProductListPage.tsx | 37 +- .../ProductOrganization.tsx | 167 ++-- .../ProductPricing/ProductPricing.tsx | 62 +- .../components/ProductStock/ProductStock.tsx | 99 ++- .../ProductUpdatePage/ProductUpdatePage.tsx | 8 +- .../ProductVariantAttributes.tsx | 79 +- .../ProductVariantCreatePage.tsx | 13 +- .../ProductVariantDeleteDialog.tsx | 32 +- .../ProductVariantImageSelectDialog.tsx | 10 +- .../ProductVariantImages.tsx | 84 +- .../ProductVariantNavigation.tsx | 112 +-- .../ProductVariantPrice.tsx | 99 ++- .../ProductVariantStock.tsx | 103 ++- .../ProductVariants/ProductVariants.tsx | 266 +++--- src/products/index.tsx | 53 +- src/products/views/ProductCreate.tsx | 19 +- src/products/views/ProductImage.tsx | 15 +- .../views/ProductList/ProductList.tsx | 128 +-- .../views/ProductUpdate/ProductUpdate.tsx | 75 +- src/products/views/ProductVariant.tsx | 12 +- src/products/views/ProductVariantCreate.tsx | 21 +- 31 files changed, 2120 insertions(+), 896 deletions(-) diff --git a/locale/messages.pot b/locale/messages.pot index 354677703..761ed940a 100644 --- a/locale/messages.pot +++ b/locale/messages.pot @@ -1,6 +1,6 @@ msgid "" msgstr "" -"POT-Creation-Date: 2019-08-26T17:47:33.625Z\n" +"POT-Creation-Date: 2019-08-26T17:50:42.071Z\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "MIME-Version: 1.0\n" @@ -19,6 +19,14 @@ msgctxt "field is optional" msgid "(Optional)" msgstr "" +#: build/locale/src/products/components/ProductOrganization/ProductOrganization.json +#. [src.products.components.ProductOrganization.2805838453] - field is optional +#. defaultMessage is: +#. *Optional. Adding product to collection helps users find it. +msgctxt "field is optional" +msgid "*Optional. Adding product to collection helps users find it." +msgstr "" + #: build/locale/src/attributes/views/AttributeCreate/AttributeCreate.json #. [src.attributes.views.AttributeCreate.2348058468] - attribute value edit error #. defaultMessage is: @@ -91,6 +99,14 @@ msgctxt "dialog header" msgid "Add Product" msgstr "" +#: build/locale/src/products/components/ProductListPage/ProductListPage.json +#. [src.products.components.ProductListPage.2775402904] - button +#. defaultMessage is: +#. Add Product +msgctxt "button" +msgid "Add Product" +msgstr "" + #: build/locale/src/discounts/components/SaleListPage/SaleListPage.json #. [src.discounts.components.SaleListPage.1742771332] - button #. defaultMessage is: @@ -107,6 +123,14 @@ msgctxt "add attribute value" msgid "Add Value" msgstr "" +#: build/locale/src/products/views/ProductVariantCreate.json +#. [src.products.views.2178905289] - header +#. defaultMessage is: +#. Add Variant +msgctxt "header" +msgid "Add Variant" +msgstr "" + #: build/locale/src/customers/components/CustomerAddressListPage/CustomerAddressListPage.json #. [src.customers.components.CustomerAddressListPage.3623935073] - button #. defaultMessage is: @@ -239,6 +263,14 @@ msgctxt "description" msgid "Add search engine title and description to make this page easier to find" msgstr "" +#: build/locale/src/products/components/ProductCreatePage/ProductCreatePage.json +#. [src.products.components.ProductCreatePage.2706108815] +#. defaultMessage is: +#. Add search engine title and description to make this product easier to find +msgctxt "description" +msgid "Add search engine title and description to make this product easier to find" +msgstr "" + #: build/locale/src/orders/components/OrderDraftDetailsSummary/OrderDraftDetailsSummary.json #. [src.orders.components.OrderDraftDetailsSummary.2429341469] - button #. defaultMessage is: @@ -279,6 +311,18 @@ msgctxt "add attribute value button" msgid "Add value" msgstr "" +#: build/locale/src/products/components/ProductVariantNavigation/ProductVariantNavigation.json +#. [src.products.components.ProductVariantNavigation.2845381934] - button +#. defaultMessage is: +#. Add variant +#: build/locale/src/products/components/ProductVariants/ProductVariants.json +#. [src.products.components.ProductVariants.2845381934] - button +#. defaultMessage is: +#. Add variant +msgctxt "button" +msgid "Add variant" +msgstr "" + #: build/locale/src/discounts/components/VoucherListPage/VoucherListPage.json #. [src.discounts.components.VoucherListPage.1536809153] - button #. defaultMessage is: @@ -343,6 +387,22 @@ msgctxt "tab name" msgid "All Orders" msgstr "" +#: build/locale/src/products/components/ProductImageNavigation/ProductImageNavigation.json +#. [src.products.components.ProductImageNavigation.3060635772] - section header +#. defaultMessage is: +#. All Photos +msgctxt "section header" +msgid "All Photos" +msgstr "" + +#: build/locale/src/products/components/ProductListPage/ProductListPage.json +#. [src.products.components.ProductListPage.821159718] - tab name +#. defaultMessage is: +#. All Products +msgctxt "tab name" +msgid "All Products" +msgstr "" + #: build/locale/src/categories/components/CategoryList/CategoryList.json #. [src.categories.components.CategoryList.3229914152] - section header #. defaultMessage is: @@ -351,6 +411,22 @@ msgctxt "section header" msgid "All Subcategories" msgstr "" +#: build/locale/src/products/components/ProductStock/ProductStock.json +#. [src.products.components.ProductStock.1680952454] - allocated product stock +#. defaultMessage is: +#. Allocated: {quantity} +msgctxt "allocated product stock" +msgid "Allocated: {quantity}" +msgstr "" + +#: build/locale/src/products/components/ProductVariantStock/ProductVariantStock.json +#. [src.products.components.ProductVariantStock.1680952454] - variant allocated stock +#. defaultMessage is: +#. Allocated: {quantity} +msgctxt "variant allocated stock" +msgid "Allocated: {quantity}" +msgstr "" + #: build/locale/src/orders/components/OrderPaymentDialog/OrderPaymentDialog.json #. [src.orders.components.OrderPaymentDialog.75546233] - amount of refunded money #. defaultMessage is: @@ -539,6 +615,14 @@ msgctxt "dialog content" msgid "Are you sure you want to delete {counter,plural,one{this page} other{{displayQuantity} pages}}?" msgstr "" +#: build/locale/src/products/views/ProductList/ProductList.json +#. [src.products.views.ProductList.2742463171] - dialog content +#. defaultMessage is: +#. Are you sure you want to delete {counter,plural,one{this product} other{{displayQuantity} products}}? +msgctxt "dialog content" +msgid "Are you sure you want to delete {counter,plural,one{this product} other{{displayQuantity} products}}?" +msgstr "" + #: build/locale/src/discounts/views/SaleList.json #. [src.discounts.views.2516361175] - dialog content #. defaultMessage is: @@ -547,6 +631,14 @@ msgctxt "dialog content" msgid "Are you sure you want to delete {counter,plural,one{this sale} other{{displayQuantity} sales}}?" msgstr "" +#: build/locale/src/products/views/ProductUpdate/ProductUpdate.json +#. [src.products.views.ProductUpdate.2446451819] - dialog content +#. defaultMessage is: +#. Are you sure you want to delete {counter,plural,one{this variant} other{{displayQuantity} variants}}? +msgctxt "dialog content" +msgid "Are you sure you want to delete {counter,plural,one{this variant} other{{displayQuantity} variants}}?" +msgstr "" + #: build/locale/src/discounts/views/VoucherList.json #. [src.discounts.views.1791926983] - dialog content #. defaultMessage is: @@ -571,6 +663,22 @@ msgctxt "description" msgid "Are you sure you want to delete {menuName}?" msgstr "" +#: build/locale/src/products/components/ProductVariantDeleteDialog/ProductVariantDeleteDialog.json +#. [src.products.components.ProductVariantDeleteDialog.2297471173] - delete product variant +#. defaultMessage is: +#. Are you sure you want to delete {name}? +msgctxt "delete product variant" +msgid "Are you sure you want to delete {name}?" +msgstr "" + +#: build/locale/src/products/views/ProductUpdate/ProductUpdate.json +#. [src.products.views.ProductUpdate.2297471173] - delete product +#. defaultMessage is: +#. Are you sure you want to delete {name}? +msgctxt "delete product" +msgid "Are you sure you want to delete {name}?" +msgstr "" + #: build/locale/src/discounts/views/SaleDetails.json #. [src.discounts.views.1457489953] - dialog content #. defaultMessage is: @@ -627,6 +735,14 @@ msgctxt "dialog content" msgid "Are you sure you want to publish {counter,plural,one{this page} other{{displayQuantity} pages}}?" msgstr "" +#: build/locale/src/products/views/ProductList/ProductList.json +#. [src.products.views.ProductList.740606822] - dialog content +#. defaultMessage is: +#. Are you sure you want to publish {counter,plural,one{this product} other{{displayQuantity} products}}? +msgctxt "dialog content" +msgid "Are you sure you want to publish {counter,plural,one{this product} other{{displayQuantity} products}}?" +msgstr "" + #: build/locale/src/orders/components/OrderDraftCancelDialog/OrderDraftCancelDialog.json #. [src.orders.components.OrderDraftCancelDialog.3199827590] #. defaultMessage is: @@ -635,6 +751,14 @@ msgctxt "description" msgid "Are you sure you want to remove draft #{number}?" msgstr "" +#: build/locale/src/products/views/ProductImage.json +#. [src.products.views.672103788] +#. defaultMessage is: +#. Are you sure you want to remove this image? +msgctxt "description" +msgid "Are you sure you want to remove this image?" +msgstr "" + #: build/locale/src/discounts/views/SaleDetails.json #. [src.discounts.views.376977560] - dialog content #. defaultMessage is: @@ -695,6 +819,14 @@ msgctxt "dialog content" msgid "Are you sure you want to unpublish {counter,plural,one{this page} other{{displayQuantity} pages}}?" msgstr "" +#: build/locale/src/products/views/ProductList/ProductList.json +#. [src.products.views.ProductList.193914731] - dialog content +#. defaultMessage is: +#. Are you sure you want to unpublish {counter,plural,one{this product} other{{displayQuantity} products}}? +msgctxt "dialog content" +msgid "Are you sure you want to unpublish {counter,plural,one{this product} other{{displayQuantity} products}}?" +msgstr "" + #: build/locale/src/orders/components/OrderPaymentVoidDialog/OrderPaymentVoidDialog.json #. [src.orders.components.OrderPaymentVoidDialog.2217048637] #. defaultMessage is: @@ -791,6 +923,14 @@ msgctxt "attributes section name" msgid "Attributes" msgstr "" +#: build/locale/src/products/components/ProductAttributes/ProductAttributes.json +#. [src.products.components.ProductAttributes.4153345096] - product attributes, section header +#. defaultMessage is: +#. Attributes +msgctxt "product attributes, section header" +msgid "Attributes" +msgstr "" + #: build/locale/src/attributes/views/AttributeList/AttributeList.json #. [src.attributes.views.AttributeList.3218248395] - deleted multiple attributes #. defaultMessage is: @@ -815,6 +955,22 @@ msgctxt "description" msgid "Availability" msgstr "" +#: build/locale/src/products/components/ProductListFilter/ProductListFilter.json +#. [src.products.components.ProductListFilter.2157131639] - product status +#. defaultMessage is: +#. Available +msgctxt "product status" +msgid "Available" +msgstr "" + +#: build/locale/src/products/components/ProductVariants/ProductVariants.json +#. [src.products.components.ProductVariants.2157131639] - product variant status +#. defaultMessage is: +#. Available +msgctxt "product variant status" +msgid "Available" +msgstr "" + #: build/locale/src/intl.json #. [src.back] - button #. defaultMessage is: @@ -971,6 +1127,18 @@ msgctxt "number of categories" msgid "Categories ({quantity})" msgstr "" +#: build/locale/src/products/components/ProductCategoryAndCollectionsForm/ProductCategoryAndCollectionsForm.json +#. [src.products.components.ProductCategoryAndCollectionsForm.1755013298] +#. defaultMessage is: +#. Category +#: build/locale/src/products/components/ProductOrganization/ProductOrganization.json +#. [src.products.components.ProductOrganization.1755013298] +#. defaultMessage is: +#. Category +msgctxt "description" +msgid "Category" +msgstr "" + #: build/locale/src/categories/components/CategoryDetailsForm/CategoryDetailsForm.json #. [src.categories.components.CategoryDetailsForm.4037703468] #. defaultMessage is: @@ -1019,6 +1187,22 @@ msgctxt "description" msgid "Category name" msgstr "" +#: build/locale/src/products/views/ProductList/ProductList.json +#. [src.products.views.ProductList.224127438] - product status update notification +#. defaultMessage is: +#. Changed publication status +msgctxt "product status update notification" +msgid "Changed publication status" +msgstr "" + +#: build/locale/src/products/components/ProductPricing/ProductPricing.json +#. [src.products.components.ProductPricing.3015886868] +#. defaultMessage is: +#. Charge taxes for this item +msgctxt "description" +msgid "Charge taxes for this item" +msgstr "" + #: build/locale/src/discounts/components/DiscountCountrySelectDialog/DiscountCountrySelectDialog.json #. [src.discounts.components.DiscountCountrySelectDialog.2177165134] #. defaultMessage is: @@ -1027,6 +1211,14 @@ msgctxt "description" msgid "Choose countries, you want voucher to be limited to, from the list below" msgstr "" +#: build/locale/src/products/components/ProductVariantImages/ProductVariantImages.json +#. [src.products.components.ProductVariantImages.989683980] - button +#. defaultMessage is: +#. Choose photos +msgctxt "button" +msgid "Choose photos" +msgstr "" + #: build/locale/src/discounts/components/VoucherList/VoucherList.json #. [src.discounts.components.VoucherList.78726751] - voucher code #. defaultMessage is: @@ -1055,6 +1247,18 @@ msgctxt "collections section name" msgid "Collections" msgstr "" +#: build/locale/src/products/components/ProductCategoryAndCollectionsForm/ProductCategoryAndCollectionsForm.json +#. [src.products.components.ProductCategoryAndCollectionsForm.222873645] +#. defaultMessage is: +#. Collections +#: build/locale/src/products/components/ProductOrganization/ProductOrganization.json +#. [src.products.components.ProductOrganization.222873645] +#. defaultMessage is: +#. Collections +msgctxt "description" +msgid "Collections" +msgstr "" + #: build/locale/src/discounts/components/SaleDetailsPage/SaleDetailsPage.json #. [saleDetailsPageCollectionsQuantity] - number of collections #. defaultMessage is: @@ -1067,6 +1271,14 @@ msgctxt "number of collections" msgid "Collections ({quantity})" msgstr "" +#: build/locale/src/products/components/ProductOrganization/ProductOrganization.json +#. [src.products.components.ProductOrganization.2754779425] - product is configurable +#. defaultMessage is: +#. Configurable +msgctxt "product is configurable" +msgid "Configurable" +msgstr "" + #: build/locale/src/intl.json #. [src.configuration] - configuration section name #. defaultMessage is: @@ -1099,6 +1311,14 @@ msgctxt "page content" msgid "Content" msgstr "" +#: build/locale/src/products/components/ProductVariantPrice/ProductVariantPrice.json +#. [src.products.components.ProductVariantPrice.1416480328] +#. defaultMessage is: +#. Cost price override +msgctxt "description" +msgid "Cost price override" +msgstr "" + #: build/locale/src/orders/views/OrderDetails/OrderDetailsMessages.json #. [src.orders.views.OrderDetails.2714957902] #. defaultMessage is: @@ -1211,6 +1431,14 @@ msgctxt "page header" msgid "Create New Category" msgstr "" +#: build/locale/src/products/views/ProductCreate.json +#. [src.products.views.1542417144] - window title +#. defaultMessage is: +#. Create Product +msgctxt "window title" +msgid "Create Product" +msgstr "" + #: build/locale/src/discounts/components/SaleCreatePage/SaleCreatePage.json #. [src.discounts.components.SaleCreatePage.3866518732] - page header #. defaultMessage is: @@ -1219,6 +1447,14 @@ msgctxt "page header" msgid "Create Sale" msgstr "" +#: build/locale/src/products/views/ProductVariantCreate.json +#. [src.products.views.2362587265] - window title +#. defaultMessage is: +#. Create Variant +msgctxt "window title" +msgid "Create Variant" +msgstr "" + #: build/locale/src/discounts/components/VoucherCreatePage/VoucherCreatePage.json #. [src.discounts.components.VoucherCreatePage.1357216572] - page header #. defaultMessage is: @@ -1535,6 +1771,30 @@ msgctxt "dialog header" msgid "Delete Pages" msgstr "" +#: build/locale/src/products/views/ProductUpdate/ProductUpdate.json +#. [src.products.views.ProductUpdate.879305849] - dialog header +#. defaultMessage is: +#. Delete Product +msgctxt "dialog header" +msgid "Delete Product" +msgstr "" + +#: build/locale/src/products/views/ProductUpdate/ProductUpdate.json +#. [src.products.views.ProductUpdate.1454532689] - dialog header +#. defaultMessage is: +#. Delete Product Variants +msgctxt "dialog header" +msgid "Delete Product Variants" +msgstr "" + +#: build/locale/src/products/views/ProductList/ProductList.json +#. [src.products.views.ProductList.400629795] - dialog header +#. defaultMessage is: +#. Delete Products +msgctxt "dialog header" +msgid "Delete Products" +msgstr "" + #: build/locale/src/discounts/views/SaleDetails.json #. [src.discounts.views.506030254] - dialog header #. defaultMessage is: @@ -1551,6 +1811,22 @@ msgctxt "dialog header" msgid "Delete Sales" msgstr "" +#: build/locale/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.json +#. [src.products.components.ProductVariantCreatePage.3726089650] - button +#. defaultMessage is: +#. Delete Variant +msgctxt "button" +msgid "Delete Variant" +msgstr "" + +#: build/locale/src/products/components/ProductVariantDeleteDialog/ProductVariantDeleteDialog.json +#. [src.products.components.ProductVariantDeleteDialog.3726089650] - dialog header +#. defaultMessage is: +#. Delete Variant +msgctxt "dialog header" +msgid "Delete Variant" +msgstr "" + #: build/locale/src/discounts/views/VoucherDetails.json #. [src.discounts.views.895379508] - dialog header #. defaultMessage is: @@ -1675,6 +1951,14 @@ msgctxt "dialog title" msgid "Delete products" msgstr "" +#: build/locale/src/products/components/ProductVariantDeleteDialog/ProductVariantDeleteDialog.json +#. [src.products.components.ProductVariantDeleteDialog.1583616500] - button +#. defaultMessage is: +#. Delete variant +msgctxt "button" +msgid "Delete variant" +msgstr "" + #: build/locale/src/collections/views/CollectionDetails.json #. [src.collections.views.1152429477] #. defaultMessage is: @@ -1831,6 +2115,14 @@ msgctxt "edit menu item, header" msgid "Edit Item" msgstr "" +#: build/locale/src/products/components/ProductImagePage/ProductImagePage.json +#. [src.products.components.ProductImagePage.2546267317] - header +#. defaultMessage is: +#. Edit Photo +msgctxt "header" +msgid "Edit Photo" +msgstr "" + #: build/locale/src/orders/components/OrderShippingMethodEditDialog/OrderShippingMethodEditDialog.json #. [src.orders.components.OrderShippingMethodEditDialog.3369240294] - dialog header #. defaultMessage is: @@ -1847,6 +2139,14 @@ msgctxt "edit attribute value" msgid "Edit Value" msgstr "" +#: build/locale/src/products/components/ProductVariants/ProductVariants.json +#. [src.products.components.ProductVariants.1703363919] - product variant attributes, button +#. defaultMessage is: +#. Edit attributes +msgctxt "product variant attributes, button" +msgid "Edit attributes" +msgstr "" + #: build/locale/src/orders/components/OrderAddressEditDialog/OrderAddressEditDialog.json #. [src.orders.components.OrderAddressEditDialog.2935008093] - dialog header #. defaultMessage is: @@ -2127,6 +2427,14 @@ msgctxt "subheader" msgid "Here is some information we gathered about your store" msgstr "" +#: build/locale/src/products/components/ProductListFilter/ProductListFilter.json +#. [src.products.components.ProductListFilter.77815154] - product is hidden +#. defaultMessage is: +#. Hidden +msgctxt "product is hidden" +msgid "Hidden" +msgstr "" + #: build/locale/src/pages/components/PageSlug/PageSlug.json #. [src.pages.components.PageSlug.4210828158] #. defaultMessage is: @@ -2151,6 +2459,50 @@ msgctxt "description" msgid "If this option is disabled, discount will be counted for every eligible product" msgstr "" +#: build/locale/src/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.json +#. [src.products.components.ProductVariantImageSelectDialog.3196043669] - dialog header +#. defaultMessage is: +#. Image Selection +msgctxt "dialog header" +msgid "Image Selection" +msgstr "" + +#: build/locale/src/products/components/ProductImages/ProductImages.json +#. [src.products.components.ProductImages.3240888698] - section header +#. defaultMessage is: +#. Images +#: build/locale/src/products/components/ProductVariantImages/ProductVariantImages.json +#. [src.products.components.ProductVariantImages.3240888698] - section header +#. defaultMessage is: +#. Images +msgctxt "section header" +msgid "Images" +msgstr "" + +#: build/locale/src/products/components/ProductStock/ProductStock.json +#. [productStockHeader] - product stock, section header +#. defaultMessage is: +#. Inventory +msgctxt "product stock, section header" +msgid "Inventory" +msgstr "" + +#: build/locale/src/products/components/ProductStock/ProductStock.json +#. [prodictStockInventoryLabel] - product stock +#. defaultMessage is: +#. Inventory +msgctxt "product stock" +msgid "Inventory" +msgstr "" + +#: build/locale/src/products/components/ProductVariantStock/ProductVariantStock.json +#. [src.products.components.ProductVariantStock.3490038570] - product variant stock +#. defaultMessage is: +#. Inventory +msgctxt "product variant stock" +msgid "Inventory" +msgstr "" + #: build/locale/src/navigation/components/MenuList/MenuList.json #. [menuListItems] - number of menu items #. defaultMessage is: @@ -2415,6 +2767,10 @@ msgstr "" #. [src.collections.components.CollectionProducts.636461959] - product name #. defaultMessage is: #. Name +#: build/locale/src/products/components/ProductDetailsForm/ProductDetailsForm.json +#. [src.products.components.ProductDetailsForm.636461959] - product name +#. defaultMessage is: +#. Name msgctxt "product name" msgid "Name" msgstr "" @@ -2451,6 +2807,14 @@ msgctxt "menu item name" msgid "Name" msgstr "" +#: build/locale/src/products/components/ProductVariants/ProductVariants.json +#. [src.products.components.ProductVariants.636461959] - product variant name +#. defaultMessage is: +#. Name +msgctxt "product variant name" +msgid "Name" +msgstr "" + #: build/locale/src/intl.json #. [src.navigation] - navigation section name #. defaultMessage is: @@ -2459,6 +2823,22 @@ msgctxt "navigation section name" msgid "Navigation" msgstr "" +#: build/locale/src/products/views/ProductCreate.json +#. [src.products.views.1591632382] - page header +#. defaultMessage is: +#. New Product +msgctxt "page header" +msgid "New Product" +msgstr "" + +#: build/locale/src/products/components/ProductVariantNavigation/ProductVariantNavigation.json +#. [src.products.components.ProductVariantNavigation.3185562157] - variant name +#. defaultMessage is: +#. New Variant +msgctxt "variant name" +msgid "New Variant" +msgstr "" + #: build/locale/src/orders/components/OrderDraftDetailsProducts/OrderDraftDetailsProducts.json #. [src.orders.components.OrderDraftDetailsProducts.546865199] #. defaultMessage is: @@ -2835,10 +3215,26 @@ msgstr "" #. [src.optionalField] - field is optional #. defaultMessage is: #. Optional +#: build/locale/src/products/components/ProductImagePage/ProductImagePage.json +#. [src.products.components.ProductImagePage.1905082483] - field is optional +#. defaultMessage is: +#. Optional msgctxt "field is optional" msgid "Optional" msgstr "" +#: build/locale/src/products/components/ProductVariantPrice/ProductVariantPrice.json +#. [productVariantPriceOptionalPriceOverrideField] - optional field +#. defaultMessage is: +#. Optional +#: build/locale/src/products/components/ProductVariantPrice/ProductVariantPrice.json +#. [productVariantPriceOptionalCostPriceField] - optional field +#. defaultMessage is: +#. Optional +msgctxt "optional field" +msgid "Optional" +msgstr "" + #: build/locale/src/orders/components/OrderDraftDetails/OrderDraftDetails.json #. [src.orders.components.OrderDraftDetails.2343989342] - section header #. defaultMessage is: @@ -2987,6 +3383,30 @@ msgctxt "description" msgid "Orders cancelled" msgstr "" +#: build/locale/src/products/components/ProductCategoryAndCollectionsForm/ProductCategoryAndCollectionsForm.json +#. [src.products.components.ProductCategoryAndCollectionsForm.3829816432] - product organization, header +#. defaultMessage is: +#. Organization +msgctxt "product organization, header" +msgid "Organization" +msgstr "" + +#: build/locale/src/products/components/ProductOrganization/ProductOrganization.json +#. [src.products.components.ProductOrganization.2364184433] - section header +#. defaultMessage is: +#. Organize Product +msgctxt "section header" +msgid "Organize Product" +msgstr "" + +#: build/locale/src/products/components/ProductListFilter/ProductListFilter.json +#. [src.products.components.ProductListFilter.1640493122] - product status +#. defaultMessage is: +#. Out Of Stock +msgctxt "product status" +msgid "Out Of Stock" +msgstr "" + #: build/locale/src/orders/components/OrderPayment/OrderPayment.json #. [src.orders.components.OrderPayment.353147224] - order payment #. defaultMessage is: @@ -3107,6 +3527,22 @@ msgctxt "voucher discount type" msgid "Percentage" msgstr "" +#: build/locale/src/products/components/ProductImagePage/ProductImagePage.json +#. [src.products.components.ProductImagePage.3822382625] - section header +#. defaultMessage is: +#. Photo Information +msgctxt "section header" +msgid "Photo Information" +msgstr "" + +#: build/locale/src/products/components/ProductImagePage/ProductImagePage.json +#. [src.products.components.ProductImagePage.367472710] - section header +#. defaultMessage is: +#. Photo View +msgctxt "section header" +msgid "Photo View" +msgstr "" + #: build/locale/src/attributes/components/AttributeProperties/AttributeProperties.json #. [src.attributes.components.AttributeProperties.3590282519] - attribute position in storefront filters #. defaultMessage is: @@ -3135,6 +3571,14 @@ msgstr "" #. [src.orders.components.OrderFulfillment.1134347598] - product price #. defaultMessage is: #. Price +#: build/locale/src/products/components/ProductListPage/ProductListPage.json +#. [src.products.components.ProductListPage.1134347598] - product price +#. defaultMessage is: +#. Price +#: build/locale/src/products/components/ProductPricing/ProductPricing.json +#. [src.products.components.ProductPricing.1134347598] - product price +#. defaultMessage is: +#. Price msgctxt "product price" msgid "Price" msgstr "" @@ -3147,6 +3591,22 @@ msgctxt "product unit price" msgid "Price" msgstr "" +#: build/locale/src/products/components/ProductListFilter/ProductListFilter.json +#. [src.products.components.ProductListFilter.1134347598] +#. defaultMessage is: +#. Price +msgctxt "description" +msgid "Price" +msgstr "" + +#: build/locale/src/products/components/ProductVariants/ProductVariants.json +#. [src.products.components.ProductVariants.1134347598] - product variant price +#. defaultMessage is: +#. Price +msgctxt "product variant price" +msgid "Price" +msgstr "" + #: build/locale/src/discounts/components/SalePricing/SalePricing.json #. [src.discounts.components.SalePricing.1099355007] - sale pricing, header #. defaultMessage is: @@ -3155,6 +3615,22 @@ msgctxt "sale pricing, header" msgid "Pricing" msgstr "" +#: build/locale/src/products/components/ProductPricing/ProductPricing.json +#. [src.products.components.ProductPricing.1099355007] - product pricing +#. defaultMessage is: +#. Pricing +msgctxt "product pricing" +msgid "Pricing" +msgstr "" + +#: build/locale/src/products/components/ProductVariantPrice/ProductVariantPrice.json +#. [src.products.components.ProductVariantPrice.1099355007] - product pricing, section header +#. defaultMessage is: +#. Pricing +msgctxt "product pricing, section header" +msgid "Pricing" +msgstr "" + #: build/locale/src/customers/components/CustomerCreateAddress/CustomerCreateAddress.json #. [src.customers.components.CustomerCreateAddress.1922654050] - page header #. defaultMessage is: @@ -3195,6 +3671,10 @@ msgstr "" #. [src.discounts.components.DiscountProducts.4257289053] #. defaultMessage is: #. Product Type +#: build/locale/src/products/components/ProductOrganization/ProductOrganization.json +#. [src.products.components.ProductOrganization.4257289053] +#. defaultMessage is: +#. Product Type msgctxt "description" msgid "Product Type" msgstr "" @@ -3207,6 +3687,18 @@ msgctxt "product types section name" msgid "Product Types" msgstr "" +#: build/locale/src/products/views/ProductCreate.json +#. [src.products.views.2899821092] +#. defaultMessage is: +#. Product created +#: build/locale/src/products/views/ProductVariantCreate.json +#. [src.products.views.2899821092] +#. defaultMessage is: +#. Product created +msgctxt "description" +msgid "Product created" +msgstr "" + #: build/locale/src/orders/components/OrderFulfillmentDialog/OrderFulfillmentDialog.json #. [src.orders.components.OrderFulfillmentDialog.4046223826] #. defaultMessage is: @@ -3215,6 +3707,14 @@ msgctxt "description" msgid "Product name" msgstr "" +#: build/locale/src/products/views/ProductUpdate/ProductUpdate.json +#. [src.products.views.ProductUpdate.4108890645] +#. defaultMessage is: +#. Product removed +msgctxt "description" +msgid "Product removed" +msgstr "" + #: build/locale/src/categories/components/CategoryProducts/CategoryProducts.json #. [src.categories.components.CategoryProducts.2968663655] - section header #. defaultMessage is: @@ -3243,6 +3743,14 @@ msgctxt "number of products" msgid "Products" msgstr "" +#: build/locale/src/intl.json +#. [src.products] - products section name +#. defaultMessage is: +#. Products +msgctxt "products section name" +msgid "Products" +msgstr "" + #: build/locale/src/discounts/components/SaleDetailsPage/SaleDetailsPage.json #. [saleDetailsPageProductsQuantity] - number of products #. defaultMessage is: @@ -3271,6 +3779,14 @@ msgctxt "products in collection" msgid "Products in {name}" msgstr "" +#: build/locale/src/products/views/ProductList/ProductList.json +#. [src.products.views.ProductList.1694086800] +#. defaultMessage is: +#. Products removed +msgctxt "description" +msgid "Products removed" +msgstr "" + #: build/locale/src/orders/components/OrderHistory/OrderHistory.json #. [src.orders.components.OrderHistory.3506022286] - order history message #. defaultMessage is: @@ -3311,6 +3827,14 @@ msgctxt "publish page, button" msgid "Publish" msgstr "" +#: build/locale/src/products/views/ProductList/ProductList.json +#. [src.products.views.ProductList.1547167026] - publish product, button +#. defaultMessage is: +#. Publish +msgctxt "publish product, button" +msgid "Publish" +msgstr "" + #: build/locale/src/pages/views/PageList.json #. [src.pages.views.2321087286] - dialog header #. defaultMessage is: @@ -3319,6 +3843,14 @@ msgctxt "dialog header" msgid "Publish Pages" msgstr "" +#: build/locale/src/products/views/ProductList/ProductList.json +#. [src.products.views.ProductList.2946646245] - dialog header +#. defaultMessage is: +#. Publish Products +msgctxt "dialog header" +msgid "Publish Products" +msgstr "" + #: build/locale/src/collections/views/CollectionList.json #. [src.collections.views.2823425739] - dialog title #. defaultMessage is: @@ -3355,6 +3887,14 @@ msgctxt "page status" msgid "Published" msgstr "" +#: build/locale/src/products/components/ProductListPage/ProductListPage.json +#. [src.products.components.ProductListPage.3640454975] - product status +#. defaultMessage is: +#. Published +msgctxt "product status" +msgid "Published" +msgstr "" + #: build/locale/src/pages/views/PageList.json #. [src.pages.views.2543350562] - notification #. defaultMessage is: @@ -3399,6 +3939,10 @@ msgstr "" #. [src.orders.components.OrderListFilter.2545228781] #. defaultMessage is: #. Range +#: build/locale/src/products/components/ProductListFilter/ProductListFilter.json +#. [src.products.components.ProductListFilter.2545228781] +#. defaultMessage is: +#. Range msgctxt "description" msgid "Range" msgstr "" @@ -3463,6 +4007,14 @@ msgctxt "button" msgid "Remove" msgstr "" +#: build/locale/src/products/views/ProductImage.json +#. [src.products.views.490753666] - dialog header +#. defaultMessage is: +#. Remove Image +msgctxt "dialog header" +msgid "Remove Image" +msgstr "" + #: build/locale/src/orders/components/OrderDraftCancelDialog/OrderDraftCancelDialog.json #. [src.orders.components.OrderDraftCancelDialog.500287069] - dialog header #. defaultMessage is: @@ -3527,6 +4079,26 @@ msgctxt "product's sku" msgid "SKU" msgstr "" +#: build/locale/src/products/components/ProductVariants/ProductVariants.json +#. [src.products.components.ProductVariants.693960049] +#. defaultMessage is: +#. SKU +msgctxt "description" +msgid "SKU" +msgstr "" + +#: build/locale/src/products/components/ProductStock/ProductStock.json +#. [src.products.components.ProductStock.2585918415] +#. defaultMessage is: +#. SKU (Stock Keeping Unit) +#: build/locale/src/products/components/ProductVariantStock/ProductVariantStock.json +#. [src.products.components.ProductVariantStock.2585918415] +#. defaultMessage is: +#. SKU (Stock Keeping Unit) +msgctxt "description" +msgid "SKU (Stock Keeping Unit)" +msgstr "" + #: build/locale/src/orders/components/OrderProductAddDialog/OrderProductAddDialog.json #. [src.orders.components.OrderProductAddDialog.2272209368] - variant sku #. defaultMessage is: @@ -3559,6 +4131,14 @@ msgctxt "button" msgid "Save" msgstr "" +#: build/locale/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.json +#. [src.products.components.ProductVariantCreatePage.2853608829] - button +#. defaultMessage is: +#. Save variant +msgctxt "button" +msgid "Save variant" +msgstr "" + #: build/locale/src/intl.json #. [src.savedChanges] #. defaultMessage is: @@ -3591,6 +4171,14 @@ msgctxt "description" msgid "Search Products" msgstr "" +#: build/locale/src/products/components/ProductListPage/ProductListPage.json +#. [src.products.components.ProductListPage.3550330425] +#. defaultMessage is: +#. Search Products... +msgctxt "description" +msgid "Search Products..." +msgstr "" + #: build/locale/src/discounts/components/DiscountCountrySelectDialog/DiscountCountrySelectDialog.json #. [src.discounts.components.DiscountCountrySelectDialog.2110418881] - search box placeholder #. defaultMessage is: @@ -3615,6 +4203,14 @@ msgctxt "attribute can be searched in dashboard" msgid "Searchable" msgstr "" +#: build/locale/src/products/components/ProductVariantImages/ProductVariantImages.json +#. [src.products.components.ProductVariantImages.3449133076] +#. defaultMessage is: +#. Select a specific variant image from product images +msgctxt "description" +msgid "Select a specific variant image from product images" +msgstr "" + #: build/locale/src/orders/components/OrderListPage/OrderListPage.json #. [src.orders.components.OrderListPage.3524904717] #. defaultMessage is: @@ -3623,6 +4219,22 @@ msgctxt "description" msgid "Select all orders where:" msgstr "" +#: build/locale/src/products/components/ProductListPage/ProductListPage.json +#. [src.products.components.ProductListPage.1421689426] +#. defaultMessage is: +#. Select all products where: +msgctxt "description" +msgid "Select all products where:" +msgstr "" + +#: build/locale/src/products/components/ProductVariantPrice/ProductVariantPrice.json +#. [src.products.components.ProductVariantPrice.2238565650] +#. defaultMessage is: +#. Selling price override +msgctxt "description" +msgid "Selling price override" +msgstr "" + #: build/locale/src/customers/components/CustomerAddress/CustomerAddress.json #. [src.customers.components.CustomerAddress.3096438859] - button #. defaultMessage is: @@ -3719,6 +4331,14 @@ msgctxt "button" msgid "Show" msgstr "" +#: build/locale/src/products/components/ProductOrganization/ProductOrganization.json +#. [src.products.components.ProductOrganization.150865454] - product is not configurable +#. defaultMessage is: +#. Simple +msgctxt "product is not configurable" +msgid "Simple" +msgstr "" + #: build/locale/src/intl.json #. [src.siteSettings] - site settings section name #. defaultMessage is: @@ -3755,6 +4375,14 @@ msgctxt "description" msgid "Specific Date" msgstr "" +#: build/locale/src/products/components/ProductListFilter/ProductListFilter.json +#. [src.products.components.ProductListFilter.2844426531] +#. defaultMessage is: +#. Specific Price +msgctxt "description" +msgid "Specific Price" +msgstr "" + #: build/locale/src/intl.json #. [src.staff] - staff section name #. defaultMessage is: @@ -3819,6 +4447,46 @@ msgctxt "order fulfillment status" msgid "Status" msgstr "" +#: build/locale/src/products/components/ProductListFilter/ProductListFilter.json +#. [src.products.components.ProductListFilter.1756106276] - product status +#. defaultMessage is: +#. Status +msgctxt "product status" +msgid "Status" +msgstr "" + +#: build/locale/src/products/components/ProductVariants/ProductVariants.json +#. [src.products.components.ProductVariants.1756106276] - product variant status +#. defaultMessage is: +#. Status +msgctxt "product variant status" +msgid "Status" +msgstr "" + +#: build/locale/src/products/components/ProductListFilter/ProductListFilter.json +#. [src.products.components.ProductListFilter.3841616483] - product stock +#. defaultMessage is: +#. Stock +msgctxt "product stock" +msgid "Stock" +msgstr "" + +#: build/locale/src/products/components/ProductVariantStock/ProductVariantStock.json +#. [src.products.components.ProductVariantStock.3841616483] - product variant stock, section header +#. defaultMessage is: +#. Stock +msgctxt "product variant stock, section header" +msgid "Stock" +msgstr "" + +#: build/locale/src/products/components/ProductListFilter/ProductListFilter.json +#. [src.products.components.ProductListFilter.3645081351] +#. defaultMessage is: +#. Stock quantity +msgctxt "description" +msgid "Stock quantity" +msgstr "" + #: build/locale/src/attributes/components/AttributeProperties/AttributeProperties.json #. [src.attributes.components.AttributeProperties.1877630205] - attribute properties regarding storefront #. defaultMessage is: @@ -3987,6 +4655,14 @@ msgctxt "attribute slug input field helper text" msgid "This is used internally. Make sure you don’t use spaces" msgstr "" +#: build/locale/src/products/components/ProductVariants/ProductVariants.json +#. [src.products.components.ProductVariants.3156701241] +#. defaultMessage is: +#. This product has no variants +msgctxt "description" +msgid "This product has no variants" +msgstr "" + #: build/locale/src/discounts/components/SalePricing/SalePricing.json #. [src.discounts.components.SalePricing.2503204759] - time during which sale is active #. defaultMessage is: @@ -4119,6 +4795,10 @@ msgstr "" #. [src.collections.components.CollectionProducts.1952810469] - product type #. defaultMessage is: #. Type +#: build/locale/src/products/components/ProductListPage/ProductListPage.json +#. [src.products.components.ProductListPage.1952810469] - product type +#. defaultMessage is: +#. Type msgctxt "product type" msgid "Type" msgstr "" @@ -4243,6 +4923,14 @@ msgctxt "dialog title" msgid "Unassign products from collection" msgstr "" +#: build/locale/src/products/components/ProductVariants/ProductVariants.json +#. [src.products.components.ProductVariants.1033175132] - product variant status +#. defaultMessage is: +#. Unavailable +msgctxt "product variant status" +msgid "Unavailable" +msgstr "" + #: build/locale/src/intl.json #. [src.undo] - button #. defaultMessage is: @@ -4283,6 +4971,14 @@ msgctxt "unpublish page, button" msgid "Unpublish" msgstr "" +#: build/locale/src/products/views/ProductList/ProductList.json +#. [src.products.views.ProductList.2237014112] - unpublish product, button +#. defaultMessage is: +#. Unpublish +msgctxt "unpublish product, button" +msgid "Unpublish" +msgstr "" + #: build/locale/src/pages/views/PageList.json #. [src.pages.views.158565417] - dialog header #. defaultMessage is: @@ -4291,6 +4987,14 @@ msgctxt "dialog header" msgid "Unpublish Pages" msgstr "" +#: build/locale/src/products/views/ProductList/ProductList.json +#. [src.products.views.ProductList.3362608461] - dialog header +#. defaultMessage is: +#. Unpublish Products +msgctxt "dialog header" +msgid "Unpublish Products" +msgstr "" + #: build/locale/src/collections/views/CollectionList.json #. [src.collections.views.2637364047] - dialog title #. defaultMessage is: @@ -4355,6 +5059,14 @@ msgctxt "attribute can be searched in storefront" msgid "Use in faceted search" msgstr "" +#: build/locale/src/products/components/ProductVariants/ProductVariants.json +#. [src.products.components.ProductVariants.277989856] +#. defaultMessage is: +#. Use variants for products that come in a variety of versions for example different sizes or colors +msgctxt "description" +msgid "Use variants for products that come in a variety of versions for example different sizes or colors" +msgstr "" + #: build/locale/src/customers/components/CustomerDetails/CustomerDetails.json #. [src.customers.components.CustomerDetails.2968565128] - check to mark this account as active #. defaultMessage is: @@ -4411,6 +5123,14 @@ msgctxt "section header" msgid "Value" msgstr "" +#: build/locale/src/products/components/ProductAttributes/ProductAttributes.json +#. [src.products.components.ProductAttributes.1148029984] - attribute value +#. defaultMessage is: +#. Value +msgctxt "attribute value" +msgid "Value" +msgstr "" + #: build/locale/src/attributes/components/AttributeDetails/AttributeDetails.json #. [src.attributes.components.AttributeDetails.2592224946] - check to require attribute to have value #. defaultMessage is: @@ -4427,6 +5147,34 @@ msgctxt "attribute value deleted" msgid "Value deleted" msgstr "" +#: build/locale/src/products/components/ProductAttributes/ProductAttributes.json +#. [src.products.components.ProductAttributes.1207761269] - attribute values +#. defaultMessage is: +#. Values +msgctxt "attribute values" +msgid "Values" +msgstr "" + +#: build/locale/src/products/views/ProductVariant.json +#. [src.products.views.2279302139] +#. defaultMessage is: +#. Variant removed +msgctxt "description" +msgid "Variant removed" +msgstr "" + +#: build/locale/src/products/components/ProductVariantNavigation/ProductVariantNavigation.json +#. [src.products.components.ProductVariantNavigation.2153006789] - section header +#. defaultMessage is: +#. Variants +#: build/locale/src/products/components/ProductVariants/ProductVariants.json +#. [src.products.components.ProductVariants.2153006789] - section header +#. defaultMessage is: +#. Variants +msgctxt "section header" +msgid "Variants" +msgstr "" + #: build/locale/src/orders/components/OrderCustomer/OrderCustomer.json #. [src.orders.components.OrderCustomer.2672803871] - link #. defaultMessage is: @@ -4459,6 +5207,14 @@ msgctxt "page status" msgid "Visibility" msgstr "" +#: build/locale/src/products/components/ProductListFilter/ProductListFilter.json +#. [src.products.components.ProductListFilter.1459686496] - product visibility +#. defaultMessage is: +#. Visibility +msgctxt "product visibility" +msgid "Visibility" +msgstr "" + #: build/locale/src/attributes/components/AttributeList/AttributeList.json #. [src.attributes.components.AttributeList.643174786] - attribute is visible #. defaultMessage is: @@ -4467,6 +5223,14 @@ msgctxt "attribute is visible" msgid "Visible" msgstr "" +#: build/locale/src/products/components/ProductListFilter/ProductListFilter.json +#. [src.products.components.ProductListFilter.643174786] - product is visible +#. defaultMessage is: +#. Visible +msgctxt "product is visible" +msgid "Visible" +msgstr "" + #: build/locale/src/attributes/components/AttributeProperties/AttributeProperties.json #. [src.attributes.components.AttributeProperties.3876764312] - attribute #. defaultMessage is: @@ -4539,6 +5303,14 @@ msgctxt "description" msgid "equals" msgstr "" +#: build/locale/src/products/components/ProductListFilter/ProductListFilter.json +#. [src.products.components.ProductListFilter.3477667254] - product price +#. defaultMessage is: +#. equals +msgctxt "product price" +msgid "equals" +msgstr "" + #: build/locale/src/orders/components/OrderListFilter/OrderListFilter.json #. [src.orders.components.OrderListFilter.1438173764] - date is set as #. defaultMessage is: @@ -4547,6 +5319,14 @@ msgctxt "date is set as" msgid "is set as" msgstr "" +#: build/locale/src/products/components/ProductListFilter/ProductListFilter.json +#. [src.products.components.ProductListFilter.1438173764] - product status is set as +#. defaultMessage is: +#. is set as +msgctxt "product status is set as" +msgid "is set as" +msgstr "" + #: build/locale/src/home/components/HomeProductListCard/HomeProductListCard.json #. [homeProductListCardOrders] - number of ordered products #. defaultMessage is: @@ -4595,6 +5375,14 @@ msgctxt "customer's address book, header" msgid "{fullName}'s Address Book" msgstr "" +#: build/locale/src/products/components/ProductAttributes/ProductAttributes.json +#. [src.products.components.ProductAttributes.1071548120] - number of product attributes +#. defaultMessage is: +#. {number} Attributes +msgctxt "number of product attributes" +msgid "{number} Attributes" +msgstr "" + #: build/locale/src/orders/components/OrderPayment/OrderPayment.json #. [src.orders.components.OrderPayment.2183023165] - ordered products #. defaultMessage is: diff --git a/src/intl.ts b/src/intl.ts index 790031190..d0140ae33 100644 --- a/src/intl.ts +++ b/src/intl.ts @@ -133,6 +133,10 @@ export const sectionNames = defineMessages({ defaultMessage: "Product Types", description: "product types section name" }, + products: { + defaultMessage: "Products", + description: "products section name" + }, sales: { defaultMessage: "Sales", description: "sales section name" diff --git a/src/products/components/ProductAttributes/ProductAttributes.tsx b/src/products/components/ProductAttributes/ProductAttributes.tsx index b6e96efc6..1da540333 100644 --- a/src/products/components/ProductAttributes/ProductAttributes.tsx +++ b/src/products/components/ProductAttributes/ProductAttributes.tsx @@ -7,6 +7,7 @@ import ArrowDropDownIcon from "@material-ui/icons/ArrowDropDown"; import makeStyles from "@material-ui/styles/makeStyles"; import classNames from "classnames"; import React from "react"; +import { FormattedMessage, useIntl } from "react-intl"; import CardTitle from "@saleor/components/CardTitle"; import Grid from "@saleor/components/Grid"; @@ -18,7 +19,6 @@ import SingleAutocompleteSelectField, { SingleAutocompleteChoiceType } from "@saleor/components/SingleAutocompleteSelectField"; import { FormsetAtomicData, FormsetChange } from "@saleor/hooks/useFormset"; -import i18n from "@saleor/i18n"; import { maybe } from "@saleor/misc"; import { ProductDetails_product_attributes_attribute_values } from "@saleor/products/types/ProductDetails"; import { AttributeInputTypeEnum } from "@saleor/types/globalTypes"; @@ -127,21 +127,30 @@ const ProductAttributes: React.FC = ({ onChange, onMultiChange }) => { + const intl = useIntl(); const classes = useStyles({}); const [expanded, setExpansionStatus] = React.useState(true); const toggleExpansion = () => setExpansionStatus(!expanded); return ( - +
- {i18n.t("{{ number }} Attributes", { - context: "number of attribute", - number: attributes.length - })} +
= ({ )} emptyOption name={`attribute:${attribute.label}`} - label={i18n.t("Value")} + label={intl.formatMessage({ + defaultMessage: "Value", + description: "attribute value" + })} value={attribute.value[0]} onChange={event => onChange(attribute.id, event.target.value) @@ -195,7 +207,10 @@ const ProductAttributes: React.FC = ({ diff --git a/src/products/components/ProductCategoryAndCollectionsForm/ProductCategoryAndCollectionsForm.tsx b/src/products/components/ProductCategoryAndCollectionsForm/ProductCategoryAndCollectionsForm.tsx index 0e109b9a6..ef069da4e 100644 --- a/src/products/components/ProductCategoryAndCollectionsForm/ProductCategoryAndCollectionsForm.tsx +++ b/src/products/components/ProductCategoryAndCollectionsForm/ProductCategoryAndCollectionsForm.tsx @@ -1,12 +1,12 @@ import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import React from "react"; +import { useIntl } from "react-intl"; import FormSpacer from "@saleor/components/FormSpacer"; import MultiSelectField from "@saleor/components/MultiSelectField"; import PageHeader from "@saleor/components/PageHeader"; import SingleSelectField from "@saleor/components/SingleSelectField"; -import i18n from "../../../i18n"; interface ProductCategoryAndCollectionsFormProps { categories?: Array<{ value: string; label: string }>; @@ -26,34 +26,47 @@ const ProductCategoryAndCollectionsForm = ({ category, loading, onChange -}: ProductCategoryAndCollectionsFormProps) => ( - - - - { + const intl = useIntl(); + + return ( + + - - - - -); + + + + + + + ); +}; ProductCategoryAndCollectionsForm.displayName = "ProductCategoryAndCollectionsForm"; export default ProductCategoryAndCollectionsForm; diff --git a/src/products/components/ProductCreatePage/ProductCreatePage.tsx b/src/products/components/ProductCreatePage/ProductCreatePage.tsx index cd9724688..08788dcfd 100644 --- a/src/products/components/ProductCreatePage/ProductCreatePage.tsx +++ b/src/products/components/ProductCreatePage/ProductCreatePage.tsx @@ -1,5 +1,6 @@ import { ContentState, convertToRaw, RawDraftContentState } from "draft-js"; import React from "react"; +import { useIntl } from "react-intl"; import AppHeader from "@saleor/components/AppHeader"; import CardSpacer from "@saleor/components/CardSpacer"; @@ -16,6 +17,7 @@ import { SearchCategories_categories_edges_node } from "@saleor/containers/Searc import { SearchCollections_collections_edges_node } from "@saleor/containers/SearchCollections/types/SearchCollections"; import useFormset from "@saleor/hooks/useFormset"; import useStateFromProps from "@saleor/hooks/useStateFromProps"; +import { sectionNames } from "@saleor/intl"; import { getChoices, ProductAttributeValueChoices, @@ -23,7 +25,6 @@ import { } from "@saleor/products/utils/data"; import createMultiAutocompleteSelectHandler from "@saleor/utils/handlers/multiAutocompleteSelectChangeHandler"; import createSingleAutocompleteSelectHandler from "@saleor/utils/handlers/singleAutocompleteSelectChangeHandler"; -import i18n from "../../../i18n"; import { UserError } from "../../../types"; import { ProductCreateData_productTypes_edges_node_productAttributes } from "../../types/ProductCreateData"; import { @@ -96,6 +97,8 @@ export const ProductCreatePage: React.StatelessComponent< onBack, onSubmit }: ProductCreatePageProps) => { + const intl = useIntl(); + // Form values const { change: changeAttributeData, @@ -200,7 +203,9 @@ export const ProductCreatePage: React.StatelessComponent< return ( - {i18n.t("Products")} + + {intl.formatMessage(sectionNames.products)} +
@@ -239,9 +244,10 @@ export const ProductCreatePage: React.StatelessComponent< )} createStyles({ @@ -48,36 +49,45 @@ export const ProductDetailsForm = withStyles(styles, { errors, initialDescription, onChange - }: ProductDetailsFormProps) => ( - - - -
- { + const intl = useIntl(); + + return ( + + + +
+ +
+ + -
- - -
-
- ) + + + ); + } ); ProductDetailsForm.displayName = "ProductDetailsForm"; export default ProductDetailsForm; diff --git a/src/products/components/ProductImageNavigation/ProductImageNavigation.tsx b/src/products/components/ProductImageNavigation/ProductImageNavigation.tsx index 452e3bc7e..5873147ea 100644 --- a/src/products/components/ProductImageNavigation/ProductImageNavigation.tsx +++ b/src/products/components/ProductImageNavigation/ProductImageNavigation.tsx @@ -8,10 +8,10 @@ import { } from "@material-ui/core/styles"; import classNames from "classnames"; import React from "react"; +import { useIntl } from "react-intl"; import CardTitle from "@saleor/components/CardTitle"; import Skeleton from "@saleor/components/Skeleton"; -import i18n from "../../../i18n"; const styles = (theme: Theme) => createStyles({ @@ -64,31 +64,41 @@ const ProductImageNavigation = withStyles(styles, { highlighted, images, onRowClick - }: ProductImageNavigationProps) => ( - - - - {images === undefined ? ( - - ) : ( -
- {images.map(image => ( -
- -
- ))} -
- )} -
-
- ) + }: ProductImageNavigationProps) => { + const intl = useIntl(); + + return ( + + + + {images === undefined ? ( + + ) : ( +
+ {images.map(image => ( +
+ +
+ ))} +
+ )} +
+
+ ); + } ); ProductImageNavigation.displayName = "ProductImageNavigation"; export default ProductImageNavigation; diff --git a/src/products/components/ProductImagePage/ProductImagePage.tsx b/src/products/components/ProductImagePage/ProductImagePage.tsx index f5b4ebe6e..5d14a47be 100644 --- a/src/products/components/ProductImagePage/ProductImagePage.tsx +++ b/src/products/components/ProductImagePage/ProductImagePage.tsx @@ -8,6 +8,7 @@ import { } from "@material-ui/core/styles"; import TextField from "@material-ui/core/TextField"; import React from "react"; +import { useIntl } from "react-intl"; import AppHeader from "@saleor/components/AppHeader"; import CardTitle from "@saleor/components/CardTitle"; @@ -18,7 +19,7 @@ import Grid from "@saleor/components/Grid"; import PageHeader from "@saleor/components/PageHeader"; import SaveButtonBar from "@saleor/components/SaveButtonBar"; import Skeleton from "@saleor/components/Skeleton"; -import i18n from "../../../i18n"; +import { commonMessages } from "@saleor/intl"; import ProductImageNavigation from "../ProductImageNavigation"; const styles = (theme: Theme) => @@ -69,68 +70,90 @@ const ProductImagePage = withStyles(styles, { name: "ProductImagePage" })( onDelete, onRowClick, onSubmit - }: ProductImagePageProps) => ( -
- {({ change, data, hasChanged, submit }) => { - return ( - - {product} - - -
- - - - - { + const intl = useIntl(); + + return ( + + {({ change, data, hasChanged, submit }) => { + return ( + + {product} + + +
+ + + - - -
-
- - - - {!!image ? ( -
- -
- ) : ( - - )} -
-
-
-
- -
- ); - }} - - ) + + + +
+
+
+ + + + {!!image ? ( +
+ +
+ ) : ( + + )} +
+
+
+
+ +
+ ); + }} + + ); + } ); ProductImagePage.displayName = "ProductImagePage"; export default ProductImagePage; diff --git a/src/products/components/ProductImages/ProductImages.tsx b/src/products/components/ProductImages/ProductImages.tsx index 6fc860399..c5a389fe3 100644 --- a/src/products/components/ProductImages/ProductImages.tsx +++ b/src/products/components/ProductImages/ProductImages.tsx @@ -2,6 +2,7 @@ import Button from "@material-ui/core/Button"; import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import classNames from "classnames"; +import { useIntl } from "react-intl"; import { createStyles, @@ -12,10 +13,10 @@ import { import CardTitle from "@saleor/components/CardTitle"; import ImageTile from "@saleor/components/ImageTile"; import ImageUpload from "@saleor/components/ImageUpload"; +import { commonMessages } from "@saleor/intl"; import { ReorderAction } from "@saleor/types"; import React from "react"; import { SortableContainer, SortableElement } from "react-sortable-hoc"; -import i18n from "../../../i18n"; import { ProductDetails_product_images } from "../../types/ProductDetails"; const styles = (theme: Theme) => @@ -181,75 +182,83 @@ const ProductImages = withStyles(styles, { name: "ProductImages" })( onImageDelete, onImageReorder, onImageUpload - }: ProductImagesProps) => ( - - - - onImageUpload(event.target.files[0])} - type="file" - ref={ref => (this.upload = ref)} - /> - - } - /> -
- {images === undefined ? ( - -
-
- + }: ProductImagesProps) => { + const intl = useIntl(); + const upload = React.useRef(null); + + return ( + + + + onImageUpload(event.target.files[0])} + type="file" + ref={upload} + /> + + } + /> +
+ {images === undefined ? ( + +
+
+ +
-
- - ) : images.length > 0 ? ( - <> - - {({ isDragActive }) => ( - - - - )} - - - ) : ( - - )} -
- - ) + + ) : images.length > 0 ? ( + <> + + {({ isDragActive }) => ( + + + + )} + + + ) : ( + + )} +
+ + ); + } ); ProductImages.displayName = "ProductImages"; export default ProductImages; diff --git a/src/products/components/ProductListFilter/ProductListFilter.tsx b/src/products/components/ProductListFilter/ProductListFilter.tsx index 4381325cb..deeaca78b 100644 --- a/src/products/components/ProductListFilter/ProductListFilter.tsx +++ b/src/products/components/ProductListFilter/ProductListFilter.tsx @@ -1,8 +1,8 @@ import React from "react"; +import { useIntl } from "react-intl"; import { FieldType, IFilter } from "@saleor/components/Filter"; import FilterBar from "@saleor/components/FilterBar"; -import i18n from "@saleor/i18n"; import { FilterProps } from "@saleor/types"; import { StockAvailability } from "@saleor/types/globalTypes"; import { ProductListUrlFilters } from "../../urls"; @@ -17,79 +17,121 @@ export enum ProductFilterKeys { stock, query } -const filterMenu: IFilter = [ - { - children: [], - data: { - additionalText: i18n.t("is set as"), - fieldLabel: i18n.t("Status"), - options: [ - { - label: i18n.t("Visible"), - value: true - }, - { - label: i18n.t("Hidden"), - value: false - } - ], - type: FieldType.select - }, - label: i18n.t("Visibility"), - value: ProductFilterKeys.published.toString() - }, - { - children: [], - data: { - fieldLabel: i18n.t("Stock quantity"), - options: [ - { - label: i18n.t("Available"), - value: StockAvailability.IN_STOCK - }, - { - label: i18n.t("Out Of Stock"), - value: StockAvailability.OUT_OF_STOCK - } - ], - type: FieldType.select - }, - label: i18n.t("Stock"), - value: ProductFilterKeys.stock.toString() - }, - { - children: [ - { - children: [], - data: { - additionalText: i18n.t("equals"), - fieldLabel: null, - type: FieldType.price - }, - label: i18n.t("Specific Price"), - value: ProductFilterKeys.priceEqual.toString() - }, - { - children: [], - data: { - fieldLabel: i18n.t("Range"), - type: FieldType.rangePrice - }, - label: i18n.t("Range"), - value: ProductFilterKeys.priceRange.toString() - } - ], - data: { - fieldLabel: i18n.t("Price"), - type: FieldType.range - }, - label: i18n.t("Price"), - value: ProductFilterKeys.price.toString() - } -]; -const ProductListFilter: React.FC = props => ( - -); +const ProductListFilter: React.FC = props => { + const intl = useIntl(); + + const filterMenu: IFilter = [ + { + children: [], + data: { + additionalText: intl.formatMessage({ + defaultMessage: "is set as", + description: "product status is set as" + }), + fieldLabel: intl.formatMessage({ + defaultMessage: "Status", + description: "product status" + }), + options: [ + { + label: intl.formatMessage({ + defaultMessage: "Visible", + description: "product is visible" + }), + value: true + }, + { + label: intl.formatMessage({ + defaultMessage: "Hidden", + description: "product is hidden" + }), + value: false + } + ], + type: FieldType.select + }, + label: intl.formatMessage({ + defaultMessage: "Visibility", + description: "product visibility" + }), + value: ProductFilterKeys.published.toString() + }, + { + children: [], + data: { + fieldLabel: intl.formatMessage({ + defaultMessage: "Stock quantity" + }), + options: [ + { + label: intl.formatMessage({ + defaultMessage: "Available", + description: "product status" + }), + value: StockAvailability.IN_STOCK + }, + { + label: intl.formatMessage({ + defaultMessage: "Out Of Stock", + description: "product status" + }), + value: StockAvailability.OUT_OF_STOCK + } + ], + type: FieldType.select + }, + label: intl.formatMessage({ + defaultMessage: "Stock", + description: "product stock" + }), + value: ProductFilterKeys.stock.toString() + }, + { + children: [ + { + children: [], + data: { + additionalText: intl.formatMessage({ + defaultMessage: "equals", + description: "product price" + }), + fieldLabel: null, + type: FieldType.price + }, + label: intl.formatMessage({ + defaultMessage: "Specific Price" + }), + value: ProductFilterKeys.priceEqual.toString() + }, + { + children: [], + data: { + fieldLabel: intl.formatMessage({ + defaultMessage: "Range" + }), + type: FieldType.rangePrice + }, + label: intl.formatMessage({ + defaultMessage: "Range" + }), + value: ProductFilterKeys.priceRange.toString() + } + ], + data: { + fieldLabel: intl.formatMessage({ + defaultMessage: "Price" + }), + type: FieldType.range + }, + label: intl.formatMessage({ + defaultMessage: "Price" + }), + value: ProductFilterKeys.price.toString() + } + ]; + + return ; +}; ProductListFilter.displayName = "ProductListFilter"; export default ProductListFilter; diff --git a/src/products/components/ProductListPage/ProductListPage.tsx b/src/products/components/ProductListPage/ProductListPage.tsx index f94cf5ef0..6096fb686 100644 --- a/src/products/components/ProductListPage/ProductListPage.tsx +++ b/src/products/components/ProductListPage/ProductListPage.tsx @@ -4,6 +4,7 @@ import { Theme } from "@material-ui/core/styles"; import AddIcon from "@material-ui/icons/Add"; import makeStyles from "@material-ui/styles/makeStyles"; import React from "react"; +import { FormattedMessage, useIntl } from "react-intl"; import { CategoryDetails_category_products_edges_node } from "@saleor/categories/types/CategoryDetails"; import ColumnPicker, { @@ -14,7 +15,7 @@ import PageHeader from "@saleor/components/PageHeader"; import ProductList from "@saleor/components/ProductList"; import { ProductListColumns } from "@saleor/config"; import useStateFromProps from "@saleor/hooks/useStateFromProps"; -import i18n from "@saleor/i18n"; +import { sectionNames } from "@saleor/intl"; import { FilterPageProps, ListActions, PageListProps } from "@saleor/types"; import { toggle } from "@saleor/utils/lists"; import { ProductListUrlFilters } from "../../urls"; @@ -53,6 +54,7 @@ export const ProductListPage: React.FC = props => { onUpdateListSettings, ...listProps } = props; + const intl = useIntl(); const classes = useStyles(props); const [selectedColumns, setSelectedColumns] = useStateFromProps( settings.columns @@ -74,22 +76,31 @@ export const ProductListPage: React.FC = props => { const columns: ColumnPickerChoice[] = [ { - label: i18n.t("Published"), + label: intl.formatMessage({ + defaultMessage: "Published", + description: "product status" + }), value: "isPublished" as ProductListColumns }, { - label: i18n.t("Price"), + label: intl.formatMessage({ + defaultMessage: "Price", + description: "product price" + }), value: "price" as ProductListColumns }, { - label: i18n.t("Type"), + label: intl.formatMessage({ + defaultMessage: "Type", + description: "product type" + }), value: "productType" as ProductListColumns } ]; return ( - + = props => { variant="contained" data-tc="add-product" > - {i18n.t("Add product")} + + ( - - - - {canChangeType ? ( - - ) : ( - <> - - {i18n.t("Product Type")} - - {maybe(() => productType.name, "...")} - - - {i18n.t("Product Type")} - - - {maybe( - () => - productType.hasVariants - ? i18n.t("Configurable") - : i18n.t("Simple"), - "..." - )} - - - )} - -
- - { + const intl = useIntl(); + + return ( + + - -
- - + {canChangeType ? ( + + ) : ( + <> + + + + {maybe(() => productType.name, "...")} + + + + + + {maybe( + () => + productType.hasVariants + ? intl.formatMessage({ + defaultMessage: "Configurable", + description: "product is configurable" + }) + : intl.formatMessage({ + defaultMessage: "Simple", + description: "product is not configurable" + }), + "..." + )} + + )} - onChange={onCollectionChange} - fetchChoices={fetchCollections} - data-tc="collections" - /> -
-
- ) + +
+ + + +
+ + +
+ + ); + } ); ProductOrganization.displayName = "ProductOrganization"; export default ProductOrganization; diff --git a/src/products/components/ProductPricing/ProductPricing.tsx b/src/products/components/ProductPricing/ProductPricing.tsx index fc22a32f0..fc74d5d38 100644 --- a/src/products/components/ProductPricing/ProductPricing.tsx +++ b/src/products/components/ProductPricing/ProductPricing.tsx @@ -7,11 +7,11 @@ import { WithStyles } from "@material-ui/core/styles"; import React from "react"; +import { useIntl } from "react-intl"; import CardTitle from "@saleor/components/CardTitle"; import ControlledCheckbox from "@saleor/components/ControlledCheckbox"; import PriceField from "@saleor/components/PriceField"; -import i18n from "../../../i18n"; const styles = (theme: Theme) => createStyles({ @@ -33,31 +33,45 @@ interface ProductPricingProps extends WithStyles { } const ProductPricing = withStyles(styles, { name: "ProductPricing" })( - ({ classes, currency, data, disabled, onChange }: ProductPricingProps) => ( - - - - - -
- { + const intl = useIntl(); + + return ( + + + -
-
-
- ) + + +
+ +
+
+ + ); + } ); ProductPricing.displayName = "ProductPricing"; export default ProductPricing; diff --git a/src/products/components/ProductStock/ProductStock.tsx b/src/products/components/ProductStock/ProductStock.tsx index 3407fcb84..f60d5f2fa 100644 --- a/src/products/components/ProductStock/ProductStock.tsx +++ b/src/products/components/ProductStock/ProductStock.tsx @@ -8,9 +8,9 @@ import { } from "@material-ui/core/styles"; import TextField from "@material-ui/core/TextField"; import React from "react"; +import { useIntl } from "react-intl"; import CardTitle from "@saleor/components/CardTitle"; -import i18n from "../../../i18n"; import { maybe } from "../../../misc"; import { ProductDetails_product } from "../../types/ProductDetails"; @@ -35,39 +35,70 @@ interface ProductStockProps extends WithStyles { } const ProductStock = withStyles(styles, { name: "ProductStock" })( - ({ classes, data, disabled, product, onChange, errors }: ProductStockProps) => ( - - - -
- - product.variants[0].quantityAllocated) - }) - : undefined - } - /> -
-
-
- ) + ({ + classes, + data, + disabled, + product, + onChange, + errors + }: ProductStockProps) => { + const intl = useIntl(); + + return ( + + + +
+ + product.variants[0].quantityAllocated + ) + } + ) + : undefined + } + /> +
+
+
+ ); + } ); ProductStock.displayName = "ProductStock"; export default ProductStock; diff --git a/src/products/components/ProductUpdatePage/ProductUpdatePage.tsx b/src/products/components/ProductUpdatePage/ProductUpdatePage.tsx index 169aa649e..155d79de2 100644 --- a/src/products/components/ProductUpdatePage/ProductUpdatePage.tsx +++ b/src/products/components/ProductUpdatePage/ProductUpdatePage.tsx @@ -1,5 +1,6 @@ import { convertFromRaw, RawDraftContentState } from "draft-js"; import React from "react"; +import { useIntl } from "react-intl"; import AppHeader from "@saleor/components/AppHeader"; import CardSpacer from "@saleor/components/CardSpacer"; @@ -15,7 +16,7 @@ import { SearchCategories_categories_edges_node } from "@saleor/containers/Searc import { SearchCollections_collections_edges_node } from "@saleor/containers/SearchCollections/types/SearchCollections"; import useFormset from "@saleor/hooks/useFormset"; import useStateFromProps from "@saleor/hooks/useStateFromProps"; -import i18n from "@saleor/i18n"; +import { sectionNames } from "@saleor/intl"; import { maybe } from "@saleor/misc"; import { ListActions, UserError } from "@saleor/types"; import createMultiAutocompleteSelectHandler from "@saleor/utils/handlers/multiAutocompleteSelectChangeHandler"; @@ -107,6 +108,7 @@ export const ProductUpdatePage: React.FC = ({ toggleAll, toolbar }) => { + const intl = useIntl(); const attributeInput = React.useMemo( () => getAttributeInputFromProduct(product), [product] @@ -188,7 +190,9 @@ export const ProductUpdatePage: React.FC = ({ return ( <> - {i18n.t("Products")} + + {intl.formatMessage(sectionNames.products)} +
diff --git a/src/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx b/src/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx index a8da22fe2..b14ae526e 100644 --- a/src/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx +++ b/src/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx @@ -1,6 +1,7 @@ import Card from "@material-ui/core/Card"; import CardContent from "@material-ui/core/CardContent"; import React from "react"; +import { useIntl } from "react-intl"; import CardTitle from "@saleor/components/CardTitle"; import Grid from "@saleor/components/Grid"; @@ -9,7 +10,7 @@ import SingleAutocompleteSelectField, { } from "@saleor/components/SingleAutocompleteSelectField"; import Skeleton from "@saleor/components/Skeleton"; import { FormsetAtomicData, FormsetChange } from "@saleor/hooks/useFormset"; -import i18n from "../../../i18n"; +import { commonMessages } from "@saleor/intl"; import { ProductVariant_attributes_attribute_values } from "../../types/ProductVariant"; export interface VariantAttributeInputData { @@ -67,40 +68,46 @@ const ProductVariantAttributes: React.FC = ({ disabled, errors, onChange -}) => ( - - - - - {attributes === undefined ? ( - - ) : ( - attributes.map((attribute, attributeIndex) => { - return ( - onChange(attribute.id, event.target.value)} - value={getAttributeValue(attribute.id, attributes)} - choices={getAttributeValueChoices(attribute.id, attributes)} - allowCustomValues - data-tc="variant-attribute-input" - /> - ); - }) - )} - - - -); +}) => { + const intl = useIntl(); + + return ( + + + + + {attributes === undefined ? ( + + ) : ( + attributes.map((attribute, attributeIndex) => { + return ( + onChange(attribute.id, event.target.value)} + value={getAttributeValue(attribute.id, attributes)} + choices={getAttributeValueChoices(attribute.id, attributes)} + allowCustomValues + data-tc="variant-attribute-input" + /> + ); + }) + )} + + + + ); +}; ProductVariantAttributes.displayName = "ProductVariantAttributes"; export default ProductVariantAttributes; diff --git a/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx b/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx index 1c70303b2..73c2a4c35 100644 --- a/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx +++ b/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx @@ -1,4 +1,5 @@ import React from "react"; +import { useIntl } from "react-intl"; import AppHeader from "@saleor/components/AppHeader"; import CardSpacer from "@saleor/components/CardSpacer"; @@ -16,7 +17,6 @@ import { getVariantAttributeErrors, getVariantAttributeInputFromProduct } from "@saleor/products/utils/data"; -import i18n from "../../../i18n"; import { maybe } from "../../../misc"; import { UserError } from "../../../types"; import { ProductVariantCreateData_product } from "../../types/ProductVariantCreateData"; @@ -63,6 +63,7 @@ const ProductVariantCreatePage: React.FC = ({ onSubmit, onVariantClick }) => { + const intl = useIntl(); const attributeInput = React.useMemo( () => getVariantAttributeInputFromProduct(product), [product] @@ -150,8 +151,14 @@ const ProductVariantCreatePage: React.FC = ({ createStyles({ @@ -50,21 +51,25 @@ const ProductVariantDeleteDialog = withStyles(styles, { }: ProductVariantDeleteDialogProps) => ( - {i18n.t("Delete variant", { context: "title" })} + - {{name}}?", - { name } - ) - }} - /> + + + - {i18n.t("Delete variant", { context: "button" })} + diff --git a/src/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.tsx b/src/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.tsx index 028a5eacd..bd7e1717d 100644 --- a/src/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.tsx +++ b/src/products/components/ProductVariantImageSelectDialog/ProductVariantImageSelectDialog.tsx @@ -11,8 +11,9 @@ import { } from "@material-ui/core/styles"; import classNames from "classnames"; import React from "react"; +import { FormattedMessage } from "react-intl"; -import i18n from "../../../i18n"; +import { buttonMessages } from "@saleor/intl"; import { ProductImage } from "../../types/ProductImage"; const styles = (theme: Theme) => @@ -72,7 +73,10 @@ const ProductVariantImageSelectDialog = withStyles(styles, { }: ProductVariantImageSelectDialogProps) => ( - {i18n.t("Image selection", { context: "title" })} +
@@ -97,7 +101,7 @@ const ProductVariantImageSelectDialog = withStyles(styles, {
diff --git a/src/products/components/ProductVariantImages/ProductVariantImages.tsx b/src/products/components/ProductVariantImages/ProductVariantImages.tsx index 6dda4936c..7d492930f 100644 --- a/src/products/components/ProductVariantImages/ProductVariantImages.tsx +++ b/src/products/components/ProductVariantImages/ProductVariantImages.tsx @@ -9,10 +9,10 @@ import { } from "@material-ui/core/styles"; import Typography from "@material-ui/core/Typography"; import React from "react"; +import { FormattedMessage, useIntl } from "react-intl"; import CardTitle from "@saleor/components/CardTitle"; import Skeleton from "@saleor/components/Skeleton"; -import i18n from "../../../i18n"; import { ProductImage } from "../../types/ProductImage"; const styles = (theme: Theme) => @@ -54,41 +54,51 @@ interface ProductVariantImagesProps extends WithStyles { export const ProductVariantImages = withStyles(styles, { name: "ProductVariantImages" -})(({ classes, disabled, images, onImageAdd }: ProductVariantImagesProps) => ( - - - {i18n.t("Choose photos")} - - } - /> - -
- {images === undefined || images === null ? ( - - ) : images.length > 0 ? ( - images - .sort((prev, next) => (prev.sortOrder > next.sortOrder ? 1 : -1)) - .map(tile => ( -
- -
- )) - ) : ( - - {i18n.t("Select a specific variant image from product images")} - - )} -
-
-
-)); +})(({ classes, disabled, images, onImageAdd }: ProductVariantImagesProps) => { + const intl = useIntl(); + + return ( + + + + + } + /> + +
+ {images === undefined || images === null ? ( + + ) : images.length > 0 ? ( + images + .sort((prev, next) => (prev.sortOrder > next.sortOrder ? 1 : -1)) + .map(tile => ( +
+ +
+ )) + ) : ( + + + + )} +
+
+
+ ); +}); ProductVariantImages.displayName = "ProductVariantImages"; export default ProductVariantImages; diff --git a/src/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx b/src/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx index 96f534a15..7d198b50d 100644 --- a/src/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx +++ b/src/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx @@ -12,11 +12,11 @@ import TableCell from "@material-ui/core/TableCell"; import TableRow from "@material-ui/core/TableRow"; import classNames from "classnames"; import React from "react"; +import { FormattedMessage, useIntl } from "react-intl"; import CardTitle from "@saleor/components/CardTitle"; import Skeleton from "@saleor/components/Skeleton"; import TableCellAvatar from "@saleor/components/TableCellAvatar"; -import i18n from "../../../i18n"; import { maybe, renderCollection } from "../../../misc"; import { ProductVariantCreateData_product_variants } from "../../types/ProductVariantCreateData"; import { ProductVariantDetails_productVariant } from "../../types/ProductVariantDetails"; @@ -63,52 +63,70 @@ const ProductVariantNavigation = withStyles(styles, { variants, onAdd, onRowClick - }: ProductVariantNavigationProps) => ( - - - - - {renderCollection(variants, variant => ( - onRowClick(variant.id) : undefined} - > - variant.images[0].url, - fallbackThumbnail - )} - /> - - {variant ? variant.name || variant.sku : } - - - ))} - {onAdd ? ( - - - - - - ) : ( - - - - {i18n.t("New Variant")} - - - )} - -
-
- ) + }: ProductVariantNavigationProps) => { + const intl = useIntl(); + + return ( + + + + + {renderCollection(variants, variant => ( + onRowClick(variant.id) : undefined} + > + variant.images[0].url, + fallbackThumbnail + )} + /> + + {variant ? variant.name || variant.sku : } + + + ))} + {onAdd ? ( + + + + + + ) : ( + + + + + + + )} + +
+
+ ); + } ); ProductVariantNavigation.displayName = "ProductVariantNavigation"; export default ProductVariantNavigation; diff --git a/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx b/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx index 077a4b49d..8cfd5bc12 100644 --- a/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx +++ b/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx @@ -7,10 +7,10 @@ import { WithStyles } from "@material-ui/core/styles"; import React from "react"; +import { useIntl } from "react-intl"; import CardTitle from "@saleor/components/CardTitle"; import PriceField from "@saleor/components/PriceField"; -import i18n from "../../../i18n"; const styles = (theme: Theme) => createStyles({ @@ -39,43 +39,68 @@ const ProductVariantPrice = withStyles(styles, { name: "ProductVariantPrice" })( priceOverride, loading, onChange - }: ProductVariantPriceProps) => ( - - - -
-
- + }: ProductVariantPriceProps) => { + const intl = useIntl(); + + return ( + + + +
+
+ +
+
+ +
-
- -
-
- - - ) + + + ); + } ); ProductVariantPrice.displayName = "ProductVariantPrice"; export default ProductVariantPrice; diff --git a/src/products/components/ProductVariantStock/ProductVariantStock.tsx b/src/products/components/ProductVariantStock/ProductVariantStock.tsx index 748f85362..295d0962b 100644 --- a/src/products/components/ProductVariantStock/ProductVariantStock.tsx +++ b/src/products/components/ProductVariantStock/ProductVariantStock.tsx @@ -8,9 +8,9 @@ import { } from "@material-ui/core/styles"; import TextField from "@material-ui/core/TextField"; import React from "react"; +import { useIntl } from "react-intl"; import CardTitle from "@saleor/components/CardTitle"; -import i18n from "../../../i18n"; const styles = (theme: Theme) => createStyles({ @@ -42,48 +42,67 @@ const ProductVariantStock = withStyles(styles, { name: "ProductVariantStock" })( stockAllocated, loading, onChange - }: ProductVariantStockProps) => ( - - - -
-
- + }: ProductVariantStockProps) => { + const intl = useIntl(); + + return ( + + + +
+
+ +
+
+ +
-
- -
-
- - - ) + + + ); + } ); ProductVariantStock.displayName = "ProductVariantStock"; export default ProductVariantStock; diff --git a/src/products/components/ProductVariants/ProductVariants.tsx b/src/products/components/ProductVariants/ProductVariants.tsx index 9b88a7e3f..c7467c99a 100644 --- a/src/products/components/ProductVariants/ProductVariants.tsx +++ b/src/products/components/ProductVariants/ProductVariants.tsx @@ -14,6 +14,7 @@ import TableCell from "@material-ui/core/TableCell"; import TableRow from "@material-ui/core/TableRow"; import Typography from "@material-ui/core/Typography"; import React from "react"; +import { FormattedMessage, useIntl } from "react-intl"; import CardTitle from "@saleor/components/CardTitle"; import Checkbox from "@saleor/components/Checkbox"; @@ -21,7 +22,6 @@ import Money from "@saleor/components/Money"; import Skeleton from "@saleor/components/Skeleton"; import StatusLabel from "@saleor/components/StatusLabel"; import TableHead from "@saleor/components/TableHead"; -import i18n from "../../../i18n"; import { renderCollection } from "../../../misc"; import { ListActions } from "../../../types"; import { ProductDetails_product_variants } from "../../types/ProductDetails"; @@ -88,130 +88,162 @@ export const ProductVariants = withStyles(styles, { name: "ProductVariants" })( toggle, toggleAll, toolbar - }: ProductVariantsProps) => ( - - - - - - } - /> - - - {i18n.t( - "Use variants for products that come in a variety of versions for example different sizes or colors" - )} - - - - - {i18n.t("Name")} - - {i18n.t("Status")} - - {i18n.t("SKU")} - - - {i18n.t("Price")} - - - - - {renderCollection( - variants, - variant => { - const isSelected = variant ? isChecked(variant.id) : false; + }: ProductVariantsProps) => { + const intl = useIntl(); - return ( - - - toggle(variant.id)} - /> - - - {variant ? variant.name || variant.sku : } - - - {variant ? ( - 0 ? "success" : "error"} - label={ - variant.stockQuantity > 0 - ? i18n.t("Available") - : i18n.t("Unavailable") - } + return ( + + + + + + } + /> + + + + + +
+ + + + + + + + + + + + + + + + + + {renderCollection( + variants, + variant => { + const isSelected = variant ? isChecked(variant.id) : false; + + return ( + + + toggle(variant.id)} /> - ) : ( - - )} - - - {variant ? variant.sku : } - - - + + + {variant ? variant.name || variant.sku : } + + {variant ? ( - variant.priceOverride ? ( - - ) : fallbackPrice ? ( - - ) : ( - - ) + 0 ? "success" : "error" + } + label={ + variant.stockQuantity > 0 + ? intl.formatMessage({ + defaultMessage: "Available", + description: "product variant status" + }) + : intl.formatMessage({ + defaultMessage: "Unavailable", + description: "product variant status" + }) + } + /> ) : ( )} - + + {variant ? variant.sku : } + + + + {variant ? ( + variant.priceOverride ? ( + + ) : fallbackPrice ? ( + + ) : ( + + ) + ) : ( + + )} + + + + ); + }, + () => ( + + + + - ); - }, - () => ( - - - {i18n.t("This product has no variants")} - - - ) - )} - -
-
- ) + ) + )} + + + + ); + } ); ProductVariants.displayName = "ProductVariants"; export default ProductVariants; diff --git a/src/products/index.tsx b/src/products/index.tsx index c82475310..0a8a1e767 100644 --- a/src/products/index.tsx +++ b/src/products/index.tsx @@ -1,9 +1,10 @@ import { parse as parseQs } from "qs"; import React from "react"; +import { useIntl } from "react-intl"; import { Route, RouteComponentProps, Switch } from "react-router-dom"; +import { sectionNames } from "@saleor/intl"; import { WindowTitle } from "../components/WindowTitle"; -import i18n from "../i18n"; import { productAddPath, productImagePath, @@ -86,28 +87,32 @@ const ProductVariantCreate: React.StatelessComponent< ); }; -const Component = () => ( - <> - - - - - - - - - - -); +const Component = () => { + const intl = useIntl(); + + return ( + <> + + + + + + + + + + + ); +}; export default Component; diff --git a/src/products/views/ProductCreate.tsx b/src/products/views/ProductCreate.tsx index 47b70babe..e3528a3b3 100644 --- a/src/products/views/ProductCreate.tsx +++ b/src/products/views/ProductCreate.tsx @@ -1,4 +1,5 @@ import React from "react"; +import { useIntl } from "react-intl"; import { WindowTitle } from "@saleor/components/WindowTitle"; import useNavigator from "@saleor/hooks/useNavigator"; @@ -7,7 +8,6 @@ import useShop from "@saleor/hooks/useShop"; import { DEFAULT_INITIAL_SEARCH_DATA } from "../../config"; import SearchCategories from "../../containers/SearchCategories"; import SearchCollections from "../../containers/SearchCollections"; -import i18n from "../../i18n"; import { decimal, getMutationState, maybe } from "../../misc"; import ProductCreatePage, { ProductCreatePageSubmitData @@ -27,6 +27,7 @@ export const ProductUpdate: React.StatelessComponent< const navigate = useNavigator(); const notify = useNotifier(); const shop = useShop(); + const intl = useIntl(); const handleAttributesEdit = undefined; const handleBack = () => navigate(productListUrl()); @@ -41,7 +42,9 @@ export const ProductUpdate: React.StatelessComponent< const handleSuccess = (data: ProductCreate) => { if (data.productCreate.errors.length === 0) { notify({ - text: i18n.t("Product created") + text: intl.formatMessage({ + defaultMessage: "Product created" + }) }); navigate(productUrl(data.productCreate.product.id)); } else { @@ -109,7 +112,12 @@ export const ProductUpdate: React.StatelessComponent< ); return ( <> - + shop.defaultCurrency)} categories={maybe( @@ -127,7 +135,10 @@ export const ProductUpdate: React.StatelessComponent< )} fetchCategories={searchCategory} fetchCollections={searchCollection} - header={i18n.t("New Product")} + header={intl.formatMessage({ + defaultMessage: "New Product", + description: "page header" + })} productTypes={maybe(() => data.productTypes.edges.map(edge => edge.node) )} diff --git a/src/products/views/ProductImage.tsx b/src/products/views/ProductImage.tsx index bb7e4a193..765e7bc4b 100644 --- a/src/products/views/ProductImage.tsx +++ b/src/products/views/ProductImage.tsx @@ -1,10 +1,10 @@ import DialogContentText from "@material-ui/core/DialogContentText"; import React from "react"; +import { FormattedMessage, useIntl } from "react-intl"; import ActionDialog from "@saleor/components/ActionDialog"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; -import i18n from "../../i18n"; import { getMutationState, maybe } from "../../misc"; import ProductImagePage from "../components/ProductImagePage"; import { @@ -32,6 +32,7 @@ export const ProductImage: React.StatelessComponent = ({ }) => { const navigate = useNavigator(); const notify = useNotifier(); + const intl = useIntl(); const handleBack = () => navigate(productUrl(productId)); const handleUpdateSuccess = (data: ProductImageUpdate) => { @@ -103,19 +104,15 @@ export const ProductImage: React.StatelessComponent = ({ } onConfirm={handleDelete} open={params.action === "remove"} - title={i18n.t("Remove image", { - context: "modal title" + title={intl.formatMessage({ + defaultMessage: "Remove Image", + description: "dialog header" })} variant="delete" confirmButtonState={deleteTransitionState} > - {i18n.t( - "Are you sure you want to remove this image?", - { - context: "modal content" - } - )} + diff --git a/src/products/views/ProductList/ProductList.tsx b/src/products/views/ProductList/ProductList.tsx index 17f6d7e00..8dc070057 100644 --- a/src/products/views/ProductList/ProductList.tsx +++ b/src/products/views/ProductList/ProductList.tsx @@ -3,6 +3,7 @@ import DialogContentText from "@material-ui/core/DialogContentText"; import IconButton from "@material-ui/core/IconButton"; import DeleteIcon from "@material-ui/icons/Delete"; import React from "react"; +import { FormattedMessage, useIntl } from "react-intl"; import ActionDialog from "@saleor/components/ActionDialog"; import DeleteFilterTabDialog from "@saleor/components/DeleteFilterTabDialog"; @@ -19,7 +20,6 @@ import usePaginator, { createPaginationState } from "@saleor/hooks/usePaginator"; import useShop from "@saleor/hooks/useShop"; -import i18n from "@saleor/i18n"; import { getMutationState, maybe } from "@saleor/misc"; import { ListViews } from "@saleor/types"; import ProductListPage from "../../components/ProductListPage"; @@ -67,6 +67,8 @@ export const ProductList: React.StatelessComponent = ({ const { updateListSettings, settings } = useListSettings( ListViews.PRODUCT_LIST ); + const intl = useIntl(); + const tabs = getFilterTabs(); const currentTab = @@ -155,7 +157,9 @@ export const ProductList: React.StatelessComponent = ({ if (data.productBulkDelete.errors.length === 0) { closeModal(); notify({ - text: i18n.t("Products removed") + text: intl.formatMessage({ + defaultMessage: "Products removed" + }) }); reset(); refetch(); @@ -166,7 +170,10 @@ export const ProductList: React.StatelessComponent = ({ if (data.productBulkPublish.errors.length === 0) { closeModal(); notify({ - text: i18n.t("Changed publication status") + text: intl.formatMessage({ + defaultMessage: "Changed publication status", + description: "product status update notification" + }) }); reset(); refetch(); @@ -235,13 +242,19 @@ export const ProductList: React.StatelessComponent = ({ openModal("unpublish", listElements) } > - {i18n.t("Unpublish")} + = ({ variables: { ids: params.ids } }) } - title={i18n.t("Remove products")} + title={intl.formatMessage({ + defaultMessage: "Delete Products", + description: "dialog header" + })} variant="delete" > - {{ number }} products?", - { - number: maybe( - () => params.ids.length.toString(), - "..." - ) - } - ) - }} - /> + + params.ids.length), + displayQuantity: ( + + {maybe(() => params.ids.length)} + + ) + }} + /> + = ({ } }) } - title={i18n.t("Publish products")} + title={intl.formatMessage({ + defaultMessage: "Publish Products", + description: "dialog header" + })} > - {{ number }} products?", - { - number: maybe( - () => params.ids.length.toString(), - "..." - ) - } - ) - }} - /> + + params.ids.length), + displayQuantity: ( + + {maybe(() => params.ids.length)} + + ) + }} + /> + = ({ } }) } - title={i18n.t("Unpublish products")} + title={intl.formatMessage({ + defaultMessage: "Unpublish Products", + description: "dialog header" + })} > - {{ number }} products?", - { - number: maybe( - () => params.ids.length.toString(), - "..." - ) - } - ) - }} - /> + + params.ids.length), + displayQuantity: ( + + {maybe(() => params.ids.length)} + + ) + }} + /> + = ({ const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions( params.ids ); + const intl = useIntl(); const openModal = (action: ProductUrlDialog) => navigate( @@ -73,12 +75,18 @@ export const ProductUpdate: React.StatelessComponent = ({ > {({ data, loading, refetch }) => { const handleDelete = () => { - notify({ text: i18n.t("Product removed") }); + notify({ + text: intl.formatMessage({ + defaultMessage: "Product removed" + }) + }); navigate(productListUrl()); }; const handleUpdate = (data: ProductUpdateMutationResult) => { if (data.productUpdate.errors.length === 0) { - notify({ text: i18n.t("Saved changes") }); + notify({ + text: intl.formatMessage(commonMessages.savedChanges) + }); } else { const attributeError = data.productUpdate.errors.find( err => err.field === "attributes" @@ -103,7 +111,7 @@ export const ProductUpdate: React.StatelessComponent = ({ }; const handleImageDeleteSuccess = () => notify({ - text: i18n.t("Image successfully deleted") + text: intl.formatMessage(commonMessages.savedChanges) }); const handleVariantAdd = () => navigate(productVariantAddUrl(id)); @@ -276,18 +284,20 @@ export const ProductUpdate: React.StatelessComponent = ({ confirmButtonState={deleteTransitionState} onConfirm={() => deleteProduct.mutate({ id })} variant="delete" - title={i18n.t("Remove product")} + title={intl.formatMessage({ + defaultMessage: "Delete Product", + description: "dialog header" + })} > - {{ name }}?", - { - name: product ? product.name : undefined - } - ) - }} - /> + + + = ({ }) } variant="delete" - title={i18n.t("Remove product variants")} + title={intl.formatMessage({ + defaultMessage: "Delete Product Variants", + description: "dialog header" + })} > - {{ number }} variants?", - { - number: maybe( - () => params.ids.length.toString(), - "..." - ) - } - ) - }} - /> + + params.ids.length), + displayQuantity: ( + + {maybe(() => params.ids.length)} + + ) + }} + /> + ); diff --git a/src/products/views/ProductVariant.tsx b/src/products/views/ProductVariant.tsx index 88adf4d4d..4d3e1e716 100644 --- a/src/products/views/ProductVariant.tsx +++ b/src/products/views/ProductVariant.tsx @@ -1,10 +1,11 @@ import React from "react"; +import { useIntl } from "react-intl"; import placeholderImg from "@assets/images/placeholder255x255.png"; import { WindowTitle } from "@saleor/components/WindowTitle"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; -import i18n from "../../i18n"; +import { commonMessages } from "@saleor/intl"; import { decimal, getMutationState, maybe } from "../../misc"; import ProductVariantDeleteDialog from "../components/ProductVariantDeleteDialog"; import ProductVariantPage, { @@ -33,6 +34,7 @@ export const ProductVariant: React.StatelessComponent = ({ }) => { const navigate = useNavigator(); const notify = useNotifier(); + const intl = useIntl(); return ( = ({ const variant = data ? data.productVariant : undefined; const handleBack = () => navigate(productUrl(productId)); const handleDelete = () => { - notify({ text: i18n.t("Variant removed") }); + notify({ + text: intl.formatMessage({ + defaultMessage: "Variant removed" + }) + }); navigate(productUrl(productId)); }; const handleUpdate = (data: VariantUpdate) => { if (!maybe(() => data.productVariantUpdate.errors.length)) { - notify({ text: i18n.t("Changes saved") }); + notify({ text: intl.formatMessage(commonMessages.savedChanges) }); } }; diff --git a/src/products/views/ProductVariantCreate.tsx b/src/products/views/ProductVariantCreate.tsx index ede273a8e..2735880dc 100644 --- a/src/products/views/ProductVariantCreate.tsx +++ b/src/products/views/ProductVariantCreate.tsx @@ -1,10 +1,10 @@ import React from "react"; +import { useIntl } from "react-intl"; import { WindowTitle } from "@saleor/components/WindowTitle"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; import useShop from "@saleor/hooks/useShop"; -import i18n from "../../i18n"; import { decimal, getMutationState, maybe } from "../../misc"; import ProductVariantCreatePage, { ProductVariantCreatePageSubmitData @@ -24,6 +24,7 @@ export const ProductVariant: React.StatelessComponent = ({ const navigate = useNavigator(); const notify = useNotifier(); const shop = useShop(); + const intl = useIntl(); return ( = ({ {({ data, loading: productLoading }) => { const handleCreateSuccess = (data: VariantCreate) => { if (data.productVariantCreate.errors.length === 0) { - notify({ text: i18n.t("Product created") }); + notify({ + text: intl.formatMessage({ + defaultMessage: "Product created" + }) + }); navigate( productVariantEditUrl( productId, @@ -81,7 +86,12 @@ export const ProductVariant: React.StatelessComponent = ({ ); return ( <> - + shop.defaultCurrency)} errors={maybe( @@ -89,7 +99,10 @@ export const ProductVariant: React.StatelessComponent = ({ variantCreateResult.data.productVariantCreate.errors, [] )} - header={i18n.t("Add Variant")} + header={intl.formatMessage({ + defaultMessage: "Add Variant", + description: "header" + })} loading={disableForm} product={maybe(() => data.product)} onBack={handleBack}