From e32e2d0173b857f1b0cfa05018232839e4d1fe9e Mon Sep 17 00:00:00 2001 From: support Date: Sat, 17 Oct 2026 20:43:36 +0200 Subject: [PATCH 1/3] Move the request-language GetResource overload to Web ITranslationService.GetResource(name) read the working language of the current request, so Business code could call it and silently get an empty or wrong-language text outside a request. It is now on IRequestTranslationService in Grand.Web.Common, which extends ITranslationService. Business no longer sees the overload at compile time and TranslationService no longer depends on IContextAccessor. Web, admin panels and plugins inject IRequestTranslationService, so their GetResource(name) calls are unchanged. The API module does not reference Grand.Web.Common and passes the working language explicitly. --- .../Localization/TranslationService.cs | 19 ----- .../Localization/ITranslationService.cs | 11 --- .../Validators/Catalog/BrandValidator.cs | 14 ++-- .../Validators/Catalog/CategoryValidator.cs | 16 ++-- .../Validators/Catalog/CollectionValidator.cs | 14 ++-- .../ProductAttributeMappingValidator.cs | 8 +- .../Catalog/ProductAttributeValidator.cs | 12 ++- .../Catalog/ProductCategoryValidator.cs | 8 +- .../Catalog/ProductCollectionValidator.cs | 8 +- .../Catalog/ProductPictureValidator.cs | 8 +- .../ProductSpecificationAttributeValidator.cs | 12 +-- .../Catalog/ProductTierPriceValidator.cs | 14 ++-- .../Validators/Catalog/ProductValidator.cs | 38 +++++---- .../SpecificationAttributeValidator.cs | 12 ++- .../Validators/Common/PictureValidator.cs | 10 ++- .../Validators/Customers/AddressValidator.cs | 36 +++++---- .../Customers/CustomerGroupValidator.cs | 14 ++-- .../Validators/Customers/CustomerValidator.cs | 36 ++++----- .../Validators/Customers/PasswordValidator.cs | 8 +- ...acebookAuthenticationSettingsController.cs | 6 +- .../GoogleAuthenticationSettingsController.cs | 6 +- .../OidcLoginSettingsController.cs | 6 +- .../DiscountRulesHasAllProductsController.cs | 5 +- .../DiscountRulesHasOneProductController.cs | 5 +- .../Providers/HadSpentAmountDiscountRule.cs | 6 +- .../Controllers/PaymentBrainTreeController.cs | 6 +- .../Controllers/PaymentBrainTreeController.cs | 6 +- .../BrainTreePaymentProvider.cs | 6 +- .../BrainTreeWidgetProvider.cs | 6 +- .../Controllers/PaymentBrainTreeController.cs | 6 +- .../Validators/PaymentInfoValidator.cs | 4 +- .../PaymentCashOnDeliveryController.cs | 6 +- .../PaymentCashOnDeliveryController.cs | 6 +- .../CashOnDeliveryPaymentProvider.cs | 6 +- .../Controllers/StripeCheckoutController.cs | 6 +- .../Controllers/StripeCheckoutController.cs | 6 +- .../StripeCheckoutPaymentProvider.cs | 6 +- .../Controllers/ShippingByWeightController.cs | 6 +- .../Controllers/ShippingByWeightController.cs | 6 +- .../ByWeightShippingProvider.cs | 6 +- .../FixedRateShippingProvider.cs | 6 +- .../Controllers/ShippingPointController.cs | 6 +- .../Controllers/ShippingPointController.cs | 6 +- .../SelectedShippingPointController.cs | 6 +- .../ShippingPointRateProvider.cs | 6 +- .../Validators/ShippingPointValidator.cs | 4 +- .../CountryStateZipTaxProvider.cs | 6 +- .../Tax.FixedRate/FixedRateTaxProvider.cs | 6 +- .../WidgetsFacebookPixelController.cs | 6 +- .../FacebookPixelProvider.cs | 6 +- .../WidgetsGoogleAnalyticsController.cs | 6 +- .../GoogleAnalyticProvider.cs | 6 +- .../Controllers/WidgetsSliderController.cs | 5 +- .../Widgets.Slider/SliderWidgetProvider.cs | 6 +- .../Validators/SlideValidator.cs | 4 +- .../Localization/TranslationServiceTests.cs | 15 +--- .../Services/CustomerAttributeParserTests.cs | 8 +- .../Contacts/ContactAttributeParserTests.cs | 8 +- .../Payments/BrainTreePaymentProviderTests.cs | 2 + .../CashOnDeliveryPaymentProviderTests.cs | 2 + .../Plugins/PluginDependencyCycleTests.cs | 7 +- .../BaseAddressAttributeControllerTests.cs | 5 +- .../Controllers/BaseBlogControllerTests.cs | 7 +- .../Controllers/BaseBrandControllerTests.cs | 7 +- .../BaseCategoryControllerTests.cs | 7 +- .../BaseCheckoutAttributeControllerTests.cs | 5 +- .../BaseCollectionControllerTests.cs | 7 +- .../BaseContactAttributeControllerTests.cs | 5 +- .../BaseCustomerAttributeControllerTests.cs | 5 +- .../BaseCustomerControllerTests.cs | 8 +- .../BaseCustomerManagementControllerTests.cs | 6 +- .../BaseDeliveryDateControllerTests.cs | 5 +- .../BaseDiscountControllerTests.cs | 6 +- .../BaseEmailAccountControllerTests.cs | 8 +- .../BaseFullReportsControllerTests.cs | 5 +- .../BaseGiftVoucherControllerTests.cs | 8 +- .../Controllers/BaseHomeControllerTests.cs | 9 ++- .../BaseMerchandiseReturnControllerTests.cs | 16 ++-- .../BaseMessageTemplateControllerTests.cs | 7 +- .../Controllers/BaseNewsControllerTests.cs | 7 +- .../BaseOnlineCustomerControllerTests.cs | 8 +- .../Controllers/BaseOrderControllerTests.cs | 6 +- .../BaseOrderManagementControllerTests.cs | 6 +- .../Controllers/BasePageControllerTests.cs | 7 +- .../BasePaymentTransactionControllerTests.cs | 5 +- .../BasePickupPointControllerTests.cs | 6 +- .../BaseProductAttributeControllerTests.cs | 5 +- .../Controllers/BaseProductControllerTests.cs | 6 +- .../BaseProductReviewControllerTests.cs | 8 +- .../Controllers/BaseReportsControllerTests.cs | 5 +- .../BaseShipmentControllerTests.cs | 6 +- .../BaseShippingMethodControllerTests.cs | 5 +- ...seSpecificationAttributeControllerTests.cs | 5 +- .../BaseTaxCategoryControllerTests.cs | 8 +- .../BaseVendorReviewControllerTests.cs | 6 +- .../BaseWarehouseControllerTests.cs | 6 +- .../CustomerReportViewModelServiceTests.cs | 3 +- .../DiscountControllerVendorTests.cs | 4 +- .../LoginControllerExternalSignInTests.cs | 4 +- .../LoginControllerProviderOnlyTests.cs | 4 +- .../MerchandiseReturnViewModelServiceTests.cs | 5 +- .../Controllers/PaymentControllerTests.cs | 6 +- .../CheckoutAttributeViewModelServiceTests.cs | 3 +- .../Services/CurrencyViewModelServiceTests.cs | 6 +- .../Services/CustomerViewModelServiceTests.cs | 5 +- .../Services/LanguageViewModelServiceTests.cs | 5 +- .../PanelPasswordRecoveryServiceTests.cs | 4 +- .../Services/ProductViewModelServiceTests.cs | 4 +- .../Services/ShipmentViewModelServiceTests.cs | 4 +- .../Services/VendorViewModelServiceTests.cs | 6 +- .../Validators/CustomerValidatorTests.cs | 4 +- .../LoginValidatorExternalSignInTests.cs | 6 +- .../Validators/RobotsTxtValidatorTests.cs | 8 +- .../RequestTranslationServiceTests.cs | 59 ++++++++++++++ .../TagHelpers/AdminGridTagHelperTests.cs | 6 +- .../Controllers/BlogControllerTests.cs | 7 +- .../Controllers/BrandControllerTests.cs | 5 +- .../Controllers/CurrencyControllerTests.cs | 6 +- .../Controllers/CustomerControllerTests.cs | 8 +- .../GiftVoucherControllerAttributeTests.cs | 6 +- .../Controllers/NewsControllerTests.cs | 3 +- .../Controllers/PageControllerTests.cs | 7 +- .../Controllers/PaymentControllerTests.cs | 6 +- .../Controllers/ProductControllerTests.cs | 2 +- .../Controllers/ShippingControllerTests.cs | 6 +- .../AccountControllerExternalRegisterTests.cs | 4 +- .../AccountControllerProviderOnlyTests.cs | 4 +- ...ccountControllerTwoFactorReturnUrlTests.cs | 4 +- .../Controllers/ContentPreviewTests.cs | 8 +- .../ProductControllerPreviewTests.cs | 4 +- .../Catalog/GetHomepageBrandsHandlerTests.cs | 4 +- .../GetHomepageCollectionsHandlerTests.cs | 4 +- .../Common/GetAddressModelHandlerTests.cs | 4 +- .../Handlers/Customers/GetInfoHandlerTests.cs | 3 +- .../Customers/GetRegisterHandlerTests.cs | 4 +- .../News/GetHomePageNewsItemsHandlerTests.cs | 4 +- .../ProductEmailAFriendValidatorTests.cs | 4 +- .../CustomerValidatorsStoreScopingTests.cs | 6 +- .../Customer/DeleteAccountValidatorTests.cs | 4 +- .../LoginValidatorExternalSignInTests.cs | 6 +- ...veryConfirmValidatorExternalSignInTests.cs | 4 +- .../RegisterValidatorExternalTests.cs | 4 +- .../Affiliate/Partials/CreateOrUpdate.cshtml | 2 +- .../Areas/Admin/Views/Document/List.cshtml | 2 +- .../Grand.Web.Admin/Components/StoreScope.cs | 8 +- .../Controllers/AddressAttributeController.cs | 2 +- .../Controllers/AffiliateController.cs | 8 +- .../Controllers/BlogController.cs | 2 +- .../Controllers/BrandController.cs | 2 +- .../Controllers/CampaignController.cs | 8 +- .../Controllers/CategoryController.cs | 2 +- .../CheckoutAttributeController.cs | 2 +- .../Controllers/CollectionController.cs | 2 +- .../Controllers/ContactAttributeController.cs | 3 +- .../Controllers/ContactFormController.cs | 8 +- .../Controllers/CountryController.cs | 5 +- .../Controllers/CourseController.cs | 5 +- .../Controllers/CurrencyController.cs | 5 +- .../CustomerAttributeController.cs | 2 +- .../Controllers/CustomerController.cs | 3 +- .../Controllers/CustomerGroupController.cs | 6 +- .../Controllers/CustomerTagController.cs | 6 +- .../Controllers/DeliveryDateController.cs | 3 +- .../Controllers/DiscountController.cs | 4 +- .../Controllers/DocumentController.cs | 8 +- .../Controllers/EmailAccountController.cs | 4 +- .../ExternalAuthenticationController.cs | 6 +- .../Controllers/GiftVoucherController.cs | 4 +- .../Controllers/HomeController.cs | 4 +- .../Controllers/KnowledgebaseController.cs | 5 +- .../Controllers/LanguageController.cs | 5 +- .../Controllers/LoginController.cs | 4 +- .../Controllers/MaintenanceController.cs | 5 +- .../Controllers/MeasureController.cs | 6 +- .../Controllers/MenuController.cs | 8 +- .../MerchandiseReturnController.cs | 4 +- .../Controllers/MessageTemplateController.cs | 3 +- .../Controllers/NewsController.cs | 2 +- .../NewsLetterCategoryController.cs | 5 +- .../NewsLetterSubscriptionController.cs | 6 +- .../Controllers/OnlineCustomerController.cs | 4 +- .../Controllers/OrderController.cs | 4 +- .../Controllers/PageController.cs | 2 +- .../Controllers/PaymentController.cs | 6 +- .../PaymentTransactionController.cs | 3 +- .../Controllers/PermissionController.cs | 6 +- .../Controllers/PickupPointController.cs | 4 +- .../Controllers/PluginController.cs | 5 +- .../Controllers/ProductAttributeController.cs | 3 +- .../Controllers/ProductController.cs | 2 +- .../Controllers/ProductReviewController.cs | 4 +- .../Controllers/ProductTagsController.cs | 5 +- .../PushNotificationsController.cs | 4 +- .../Controllers/QueuedEmailController.cs | 5 +- .../Controllers/ReportsController.cs | 3 +- .../Controllers/ScheduleTaskController.cs | 6 +- .../Controllers/SearchController.cs | 6 +- .../Controllers/SettingController.cs | 2 +- .../Controllers/ShipmentController.cs | 4 +- .../Controllers/ShippingController.cs | 6 +- .../Controllers/ShippingMethodController.cs | 3 +- .../Controllers/ShoppingCartController.cs | 6 +- .../SpecificationAttributeController.cs | 3 +- .../Controllers/StoreController.cs | 5 +- .../Controllers/SystemController.cs | 6 +- .../Controllers/TaxController.cs | 3 +- .../Controllers/VendorController.cs | 5 +- .../Controllers/VendorReviewController.cs | 4 +- .../Controllers/WarehouseController.cs | 4 +- .../BaseAddressAttributeController.cs | 3 +- .../Controllers/BaseBlogController.cs | 5 +- .../Controllers/BaseBrandController.cs | 5 +- .../Controllers/BaseCategoryController.cs | 5 +- .../BaseCheckoutAttributeController.cs | 3 +- .../Controllers/BaseCollectionController.cs | 5 +- .../BaseContactAttributeController.cs | 3 +- .../BaseCustomerAttributeController.cs | 3 +- .../Controllers/BaseCustomerController.cs | 6 +- .../BaseCustomerManagementController.cs | 4 +- .../Controllers/BaseDeliveryDateController.cs | 3 +- .../Controllers/BaseDiscountController.cs | 4 +- .../Controllers/BaseEmailAccountController.cs | 4 +- .../Controllers/BaseFullReportsController.cs | 3 +- .../Controllers/BaseGiftVoucherController.cs | 6 +- .../Controllers/BaseHomeController.cs | 4 +- .../BaseHomeControllerWithSetLanguage.cs | 3 +- .../Controllers/BaseLoginController.cs | 6 +- .../BaseMerchandiseReturnController.cs | 6 +- .../BaseMessageTemplateController.cs | 5 +- .../Controllers/BaseNewsController.cs | 5 +- .../BaseOnlineCustomerController.cs | 4 +- .../Controllers/BaseOrderController.cs | 6 +- .../BaseOrderManagementController.cs | 4 +- .../Controllers/BasePageController.cs | 5 +- .../BasePaymentTransactionController.cs | 5 +- .../Controllers/BasePickupPointController.cs | 4 +- .../BaseProductAttributeController.cs | 3 +- .../Controllers/BaseProductController.cs | 4 +- .../BaseProductReviewController.cs | 4 +- .../Controllers/BaseReportsController.cs | 5 +- .../Controllers/BaseShipmentController.cs | 6 +- .../BaseShippingMethodController.cs | 3 +- .../BaseSpecificationAttributeController.cs | 3 +- .../Controllers/BaseTaxCategoryController.cs | 6 +- .../Controllers/BaseVendorReviewController.cs | 6 +- .../Controllers/BaseWarehouseController.cs | 4 +- .../Services/AffiliateViewModelService.cs | 5 +- .../Services/BlogViewModelService.cs | 5 +- .../Services/CategoryViewModelService.cs | 5 +- .../CheckoutAttributeViewModelService.cs | 3 +- .../Services/CollectionViewModelService.cs | 5 +- .../Services/ContactFormViewModelService.cs | 6 +- .../Services/CourseViewModelService.cs | 3 +- .../Services/CurrencyViewModelService.cs | 6 +- .../Services/CustomerGroupViewModelService.cs | 5 +- .../CustomerReportViewModelService.cs | 5 +- .../Services/CustomerTagViewModelService.cs | 5 +- .../Services/CustomerViewModelService.cs | 5 +- .../Services/DiscountViewModelService.cs | 5 +- .../Services/DocumentViewModelService.cs | 6 +- .../Services/EmailAccountViewModelService.cs | 8 +- .../Services/GiftVoucherViewModelService.cs | 5 +- .../Services/LanguageViewModelService.cs | 5 +- .../MerchandiseReturnViewModelService.cs | 3 +- .../Services/NewsViewModelService.cs | 6 +- .../Services/OrderViewModelService.cs | 4 +- .../Services/PageViewModelService.cs | 6 +- .../Services/PanelPasswordRecoveryService.cs | 4 +- .../Services/ProductReviewViewModelService.cs | 6 +- .../Services/ProductViewModelService.cs | 2 +- .../Services/ShipmentViewModelService.cs | 6 +- .../Services/VendorViewModelService.cs | 4 +- .../Affiliate/AffiliateValidator.cs | 4 +- .../Validators/Blogs/BlogCategoryValidator.cs | 4 +- .../Validators/Blogs/BlogPostValidator.cs | 4 +- .../AddAssociatedProductModelValidator.cs | 4 +- .../Catalog/AddBundleProductModelValidator.cs | 4 +- .../AddCategoryProductModelValidator.cs | 4 +- .../AddCollectionProductModelValidator.cs | 4 +- .../AddCrossSellProductModelValidator.cs | 4 +- .../Catalog/AddProductPriceModelValidator.cs | 4 +- ...uctSpecificationAttributeModelValidator.cs | 4 +- .../AddRecomendedProductModelValidator.cs | 4 +- .../AddRelatedProductModelValidator.cs | 4 +- .../AddSimilarProductModelValidator.cs | 4 +- .../AssociatedProductModelValidator.cs | 4 +- .../Catalog/BaseStoreAccessValidator.cs | 8 +- .../Validators/Catalog/BrandValidator.cs | 4 +- .../Catalog/BundleProductModelValidator.cs | 4 +- .../Catalog/CategoryProductModelValidator.cs | 4 +- .../Validators/Catalog/CategoryValidator.cs | 4 +- .../CollectionProductModelValidator.cs | 4 +- .../Validators/Catalog/CollectionValidator.cs | 4 +- .../Catalog/CrossSellProductModelValidator.cs | 4 +- ...inedProductAttributeValueModelValidator.cs | 4 +- .../ProductAttributeMappingModelValidator.cs | 4 +- .../Catalog/ProductAttributeValidator.cs | 4 +- .../ProductAttributeValueModelValidator.cs | 4 +- .../Catalog/ProductCategoryModelValidator.cs | 4 +- .../ProductCollectionModelValidator.cs | 4 +- .../Catalog/ProductPictureModelValidator.cs | 4 +- .../Catalog/ProductReviewValidator.cs | 4 +- ...uctSpecificationAttributeModelValidator.cs | 4 +- .../Validators/Catalog/ProductTagValidator.cs | 4 +- .../Validators/Catalog/ProductValidator.cs | 4 +- .../RecomendedProductModelValidator.cs | 4 +- .../Catalog/RelatedProductModelValidator.cs | 4 +- .../Catalog/SimilarProductModelValidator.cs | 4 +- .../SpecificationAttributeOptionValidator.cs | 4 +- .../SpecificationAttributeValidator.cs | 4 +- .../Catalog/TierPriceModelValidator.cs | 6 +- .../Common/AddressAttributeValidator.cs | 4 +- .../Common/AddressAttributeValueValidator.cs | 4 +- .../Validators/Common/AddressValidator.cs | 4 +- .../Validators/Common/LoginValidator.cs | 4 +- .../Validators/Common/MenuValidator.cs | 4 +- .../PasswordRecoveryConfirmValidator.cs | 4 +- .../Common/PasswordRecoveryValidator.cs | 4 +- .../Validators/Common/ReviewValidator.cs | 4 +- .../Validators/Common/UserFieldValidator.cs | 4 +- .../Course/CourseLessonValidator.cs | 4 +- .../Validators/Course/CourseLevelValidator.cs | 4 +- .../Course/CourseSubjectValidator.cs | 4 +- .../Validators/Course/CourseValidator.cs | 4 +- .../Customers/CustomerAddressValidator.cs | 4 +- .../Customers/CustomerAttributeValidator.cs | 4 +- .../CustomerAttributeValueValidator.cs | 4 +- .../Customers/CustomerGroupValidator.cs | 4 +- .../Customers/CustomerTagValidator.cs | 4 +- .../Validators/Customers/CustomerValidator.cs | 4 +- .../Customers/SalesEmployeeValidator.cs | 4 +- .../Customers/UserApiCreateValidator.cs | 4 +- .../Validators/Customers/UserApiValidator.cs | 4 +- .../Validators/Directory/CountryValidator.cs | 4 +- .../Validators/Directory/CurrencyValidator.cs | 4 +- .../Directory/MeasureDimensionValidator.cs | 4 +- .../Directory/MeasureUnitValidator.cs | 4 +- .../Directory/MeasureWeightValidator.cs | 4 +- .../Directory/RobotsTxtValidator.cs | 4 +- .../Directory/StateProvinceValidator.cs | 4 +- .../Validators/Discounts/DiscountValidator.cs | 4 +- .../Documents/DocumentTypeValidator.cs | 4 +- .../Validators/Documents/DocumentValidator.cs | 4 +- .../KnowledgebaseArticleModelValidator.cs | 4 +- .../KnowledgebaseCategoryModelValidator.cs | 4 +- .../Layouts/BrandLayoutValidator.cs | 4 +- .../Layouts/CategoryLayoutValidator.cs | 4 +- .../Layouts/CollectionLayoutValidator.cs | 4 +- .../Validators/Layouts/PageLayoutValidator.cs | 4 +- .../Layouts/ProductLayoutValidator.cs | 4 +- .../Localization/LanguageResourceValidator.cs | 4 +- .../Localization/LanguageValidator.cs | 4 +- .../Validators/Messages/CampaignValidator.cs | 4 +- .../Messages/ContactAttributeValidator.cs | 4 +- .../ContactAttributeValueValidator.cs | 4 +- .../Messages/EmailAccountValidator.cs | 4 +- .../Messages/MessageTemplateValidator.cs | 4 +- .../NewsLetterSubscriptionValidator.cs | 4 +- .../Messages/NewsletterCategoryValidator.cs | 4 +- .../Messages/QueuedEmailValidator.cs | 4 +- .../Validators/News/NewsItemValidator.cs | 4 +- .../Orders/CheckoutAttributeValidator.cs | 4 +- .../Orders/CheckoutAttributeValueValidator.cs | 4 +- .../Orders/GiftVoucherDeleteModelValidator.cs | 4 +- .../Validators/Orders/GiftVoucherValidator.cs | 4 +- .../Validators/Orders/OrderStatusValidator.cs | 4 +- .../Validators/Pages/PageValidator.cs | 4 +- .../PermissionCreateModelValidator.cs | 4 +- .../PermissionUpdateModelValidator.cs | 4 +- .../Validators/Plugins/PluginValidator.cs | 4 +- .../LoyaltyPointsSettingsValidator.cs | 4 +- .../MerchandiseReturnActionValidator.cs | 4 +- .../MerchandiseReturnReasonValidator.cs | 4 +- .../Settings/OrderSettingsValidator.cs | 4 +- .../Validators/Settings/SettingValidator.cs | 4 +- .../Shipping/DeliveryDateValidator.cs | 4 +- .../Shipping/PickupPointValidator.cs | 4 +- .../Shipping/ShippingMethodValidator.cs | 4 +- .../Validators/Shipping/WarehouseValidator.cs | 4 +- .../Validators/Stores/DomainHostValidator.cs | 4 +- .../Validators/Stores/StoreValidator.cs | 4 +- .../Validators/Tax/TaxCategoryValidator.cs | 4 +- .../Vendors/VendorReviewValidator.cs | 4 +- .../Validators/Vendors/VendorValidator.cs | 4 +- .../IRequestTranslationService.cs | 79 +++++++++++++++++++ .../Localization/LocService.cs | 7 +- .../Captcha/CaptchaSettingsExtension.cs | 6 +- .../Startup/StartupApplication.cs | 1 + .../Admin/AdminDeleteConfirmationTagHelper.cs | 8 +- .../TagHelpers/Admin/GridCommandsTagHelper.cs | 16 ++-- .../DatePickerDropDownsTagHelper.cs | 8 +- .../TagHelpers/PageNavigationTagHelper.cs | 8 +- .../Controllers/AddressAttributeController.cs | 2 +- .../Controllers/BlogController.cs | 2 +- .../Controllers/BrandController.cs | 2 +- .../Controllers/CategoryController.cs | 2 +- .../CheckoutAttributeController.cs | 2 +- .../Controllers/CollectionController.cs | 3 +- .../Controllers/ContactAttributeController.cs | 3 +- .../Controllers/CurrencyController.cs | 4 +- .../CustomerAttributeController.cs | 2 +- .../Controllers/CustomerController.cs | 3 +- .../Controllers/DeliveryDateController.cs | 3 +- .../Controllers/DiscountController.cs | 4 +- .../Controllers/EmailAccountController.cs | 4 +- .../Controllers/GiftVoucherController.cs | 4 +- .../Controllers/HomeController.cs | 4 +- .../Controllers/LanguageController.cs | 3 +- .../Controllers/LoginController.cs | 4 +- .../MerchandiseReturnController.cs | 4 +- .../Controllers/MessageTemplateController.cs | 3 +- .../Controllers/NewsController.cs | 3 +- .../Controllers/OnlineCustomerController.cs | 4 +- .../Controllers/OrderController.cs | 4 +- .../Controllers/PageController.cs | 3 +- .../Controllers/PaymentController.cs | 4 +- .../PaymentTransactionController.cs | 3 +- .../Controllers/PickupPointController.cs | 4 +- .../Controllers/ProductAttributeController.cs | 3 +- .../Controllers/ProductController.cs | 2 +- .../Controllers/ProductReviewController.cs | 4 +- .../Controllers/ReportsController.cs | 3 +- .../Controllers/SettingController.cs | 2 +- .../Controllers/ShipmentController.cs | 4 +- .../Controllers/ShippingController.cs | 4 +- .../Controllers/ShippingMethodController.cs | 3 +- .../SpecificationAttributeController.cs | 3 +- .../Controllers/TaxController.cs | 3 +- .../Controllers/WarehouseController.cs | 4 +- .../Controllers/HomeController.cs | 4 +- .../Controllers/LoginController.cs | 4 +- .../MerchandiseReturnController.cs | 4 +- .../Controllers/OrderController.cs | 4 +- .../Controllers/ProductController.cs | 2 +- .../Controllers/ReportsController.cs | 3 +- .../Controllers/ShipmentController.cs | 4 +- .../Controllers/VendorInfoController.cs | 5 +- .../Controllers/VendorReviewController.cs | 4 +- .../Validators/Common/AddressValidator.cs | 4 +- .../Validators/Vendor/VendorValidator.cs | 4 +- .../Newsletter/SubscribeNewsletterHandler.cs | 6 +- .../SubscriptionActivationHandler.cs | 8 +- .../Vendors/ContactVendorCommandHandler.cs | 8 +- .../Controllers/AccountController.cs | 6 +- .../Controllers/ActionCartController.cs | 6 +- .../Grand.Web/Controllers/BlogController.cs | 6 +- .../Controllers/CatalogController.cs | 6 +- .../Controllers/CheckoutController.cs | 6 +- .../Controllers/ContactController.cs | 6 +- .../Controllers/CountryController.cs | 8 +- .../Controllers/DownloadController.cs | 6 +- .../Controllers/KnowledgebaseController.cs | 6 +- .../MerchandiseReturnController.cs | 6 +- .../Grand.Web/Controllers/NewsController.cs | 6 +- .../Grand.Web/Controllers/OrderController.cs | 6 +- .../OutOfStockSubscriptionController.cs | 6 +- .../Grand.Web/Controllers/PageController.cs | 8 +- .../Controllers/ProductController.cs | 6 +- .../Controllers/ShoppingCartController.cs | 6 +- .../Grand.Web/Controllers/VendorController.cs | 6 +- .../Controllers/WishlistController.cs | 6 +- .../Handlers/Blogs/GetBlogPostHandler.cs | 6 +- .../Handlers/Blogs/GetBlogPostListHandler.cs | 6 +- .../Handlers/Blogs/GetHomePageBlogHandler.cs | 6 +- .../Handlers/Catalog/GetBrandAllHandler.cs | 6 +- .../Handlers/Catalog/GetCategoryAllHandler.cs | 6 +- .../GetCategoryFeaturedProductsHandler.cs | 6 +- .../Handlers/Catalog/GetCategoryHandler.cs | 6 +- .../Catalog/GetCollectionAllHandler.cs | 6 +- .../GetCollectionFeaturedProductsHandler.cs | 6 +- .../Catalog/GetFormatBasePriceHandler.cs | 6 +- .../Catalog/GetHomepageBrandsHandler.cs | 6 +- .../Catalog/GetHomepageCategoryHandler.cs | 6 +- .../Catalog/GetHomepageCollectionsHandler.cs | 6 +- .../Handlers/Catalog/GetSearchBoxHandler.cs | 6 +- .../Handlers/Catalog/GetSearchHandler.cs | 6 +- .../Handlers/Catalog/GetVendorAllHandler.cs | 6 +- .../Handlers/Catalog/GetVendorHandler.cs | 6 +- .../Catalog/GetViewSortSizeOptionsHandler.cs | 7 +- .../Checkout/GetShippingAddressHandler.cs | 6 +- .../Handlers/Common/GetAddressModelHandler.cs | 6 +- .../Common/GetStatesProvinceHandler.cs | 6 +- .../Common/GetVendorAddressHandler.cs | 6 +- .../Handlers/Customers/GetInfoHandler.cs | 5 +- .../GetPasswordRecoveryConfirmHandler.cs | 8 +- .../Handlers/Customers/GetRegisterHandler.cs | 6 +- .../Handlers/Customers/GetReviewsHandler.cs | 6 +- .../News/GetHomePageNewsItemsHandler.cs | 6 +- .../Handlers/News/GetNewsItemHandler.cs | 6 +- .../Handlers/News/GetNewsItemListHandler.cs | 6 +- .../Handlers/Orders/GetOrderDetailsHandler.cs | 5 +- ...GetProductDetailsAttributeChangeHandler.cs | 6 +- .../Products/GetProductDetailsPageHandler.cs | 6 +- .../ShoppingCart/GetAddToCartHandler.cs | 6 +- .../GetEstimateShippingHandler.cs | 6 +- .../GetEstimateShippingResultHandler.cs | 6 +- .../GetMiniShoppingCartHandler.cs | 6 +- .../ShoppingCart/GetMiniWishlistHandler.cs | 6 +- .../ShoppingCart/GetShoppingCartHandler.cs | 5 +- .../ShoppingCart/GetWishlistHandler.cs | 5 +- .../Blogs/AddBlogCommentValidator.cs | 4 +- .../ProductAskQuestionSimpleValidator.cs | 4 +- .../Catalog/ProductAskQuestionValidator.cs | 4 +- .../Catalog/ProductEmailAFriendValidator.cs | 4 +- .../Catalog/ProductReviewsValidator.cs | 6 +- .../Validators/Common/AddressValidator.cs | 4 +- .../Validators/Contact/ContactUsValidator.cs | 6 +- .../Customer/AddOrderNoteValidator.cs | 4 +- .../Customer/ChangePasswordValidator.cs | 4 +- .../CheckoutBillingAddressValidator.cs | 4 +- .../CheckoutShippingAddressValidator.cs | 4 +- .../Customer/CustomerAddressEditValidator.cs | 4 +- .../Customer/CustomerInfoValidator.cs | 4 +- .../Customer/DeleteAccountValidator.cs | 4 +- .../Validators/Customer/LoginValidator.cs | 4 +- .../PasswordRecoveryConfirmValidator.cs | 4 +- .../Customer/PasswordRecoveryValidator.cs | 4 +- .../Validators/Customer/RegisterValidator.cs | 4 +- .../Customer/SubAccountCreateValidator.cs | 4 +- .../Customer/SubAccountEditValidator.cs | 4 +- .../KnowledgebaseArticleValidator.cs | 4 +- .../News/AddNewsCommentValidator.cs | 4 +- .../Orders/MerchandiseReturnValidator.cs | 4 +- .../ShoppingCart/DiscountCouponValidator.cs | 4 +- .../GiftVoucherCouponValidator.cs | 4 +- .../WishlistEmailAFriendValidator.cs | 4 +- .../Vendors/ApplyVendorValidator.cs | 4 +- .../Vendors/ContactVendorValidator.cs | 4 +- .../Vendors/VendorAddressValidator.cs | 4 +- .../Vendors/VendorReviewsValidator.cs | 4 +- 530 files changed, 1529 insertions(+), 1347 deletions(-) create mode 100644 src/Tests/Grand.Web.Common.Tests/Localization/RequestTranslationServiceTests.cs create mode 100644 src/Web/Grand.Web.Common/Localization/IRequestTranslationService.cs diff --git a/src/Business/Grand.Business.Common/Services/Localization/TranslationService.cs b/src/Business/Grand.Business.Common/Services/Localization/TranslationService.cs index b4b318204e..1b082981f0 100644 --- a/src/Business/Grand.Business.Common/Services/Localization/TranslationService.cs +++ b/src/Business/Grand.Business.Common/Services/Localization/TranslationService.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Data; using Grand.Domain.Localization; -using Grand.Infrastructure; using Grand.Infrastructure.Extensions; using Grand.SharedKernel.Extensions; using Grand.Mediator; @@ -20,15 +19,12 @@ public class TranslationService : ITranslationService /// /// Ctor /// - /// Work context /// Translate resource repository /// Mediator public TranslationService( - IContextAccessor contextAccessor, IRepository trRepository, IMediator mediator) { - _contextAccessor = contextAccessor; _translationRepository = trRepository; _mediator = mediator; } @@ -40,7 +36,6 @@ public TranslationService( private static readonly ConcurrentDictionary> _cachedResources = new(); private readonly IRepository _translationRepository; - private readonly IContextAccessor _contextAccessor; private readonly IMediator _mediator; #endregion @@ -136,20 +131,6 @@ public virtual async Task DeleteTranslateResource(TranslationResource translateR await _mediator.EntityDeleted(translateResource); } - /// - /// Gets a resource string based on the specified ResourceKey property. - /// - /// A string representing a name. - /// A string representing the requested resource string. - /// - /// Reads the working language of the current request. Code that may run outside a request uses the - /// overload that takes the language. - /// - public virtual string GetResource(string name) - { - return _contextAccessor.WorkContext.WorkingLanguage != null ? GetResource(name, _contextAccessor.WorkContext.WorkingLanguage.Id) : ""; - } - /// /// Gets a resource string based on the specified ResourceKey property. /// diff --git a/src/Business/Grand.Business.Core/Interfaces/Common/Localization/ITranslationService.cs b/src/Business/Grand.Business.Core/Interfaces/Common/Localization/ITranslationService.cs index be8816ed97..c6fdb0f57a 100644 --- a/src/Business/Grand.Business.Core/Interfaces/Common/Localization/ITranslationService.cs +++ b/src/Business/Grand.Business.Core/Interfaces/Common/Localization/ITranslationService.cs @@ -47,17 +47,6 @@ public interface ITranslationService /// Translate resource Task DeleteTranslateResource(TranslationResource translateResource); - /// - /// Gets a resource string based on the specified ResourceKey property. - /// - /// A string representing a name. - /// A string representing the requested resource string. - /// - /// Reads the working language of the current request. Code that may run outside a request uses the - /// overload that takes the language. - /// - string GetResource(string name); - /// /// Gets a resource string based on the specified ResourceKey property. /// diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/BrandValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/BrandValidator.cs index 010c1de0df..fda30793eb 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/BrandValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/BrandValidator.cs @@ -3,6 +3,7 @@ using Grand.Business.Core.Interfaces.Catalog.Brands; using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Storage; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Catalog; @@ -10,12 +11,15 @@ namespace Grand.Module.Api.Validators.Catalog; public class BrandValidator : BaseGrandValidator { public BrandValidator(IEnumerable> validators, - ITranslationService translationService, IPictureService pictureService, IBrandService brandService, + ITranslationService translationService, + IContextAccessor contextAccessor, IPictureService pictureService, IBrandService brandService, IBrandLayoutService brandLayoutService) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x.Name).NotEmpty() - .WithMessage(translationService.GetResource("Api.Catalog.Brand.Fields.Name.Required")); + .WithMessage(translationService.GetResource("Api.Catalog.Brand.Fields.Name.Required", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { if (!string.IsNullOrEmpty(x.PictureId)) @@ -26,7 +30,7 @@ public BrandValidator(IEnumerable> validators, } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Brand.Fields.PictureId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Brand.Fields.PictureId.NotExists", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { @@ -38,7 +42,7 @@ public BrandValidator(IEnumerable> validators, } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Brand.Fields.BrandLayoutId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Brand.Fields.BrandLayoutId.NotExists", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { @@ -50,6 +54,6 @@ public BrandValidator(IEnumerable> validators, } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Brand.Fields.Id.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Brand.Fields.Id.NotExists", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/CategoryValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/CategoryValidator.cs index 36ffc3454e..2a99aad7e1 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/CategoryValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/CategoryValidator.cs @@ -3,6 +3,7 @@ using Grand.Business.Core.Interfaces.Catalog.Categories; using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Storage; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Catalog; @@ -10,12 +11,15 @@ namespace Grand.Module.Api.Validators.Catalog; public class CategoryValidator : BaseGrandValidator { public CategoryValidator(IEnumerable> validators, - ITranslationService translationService, IPictureService pictureService, ICategoryService categoryService, + ITranslationService translationService, + IContextAccessor contextAccessor, IPictureService pictureService, ICategoryService categoryService, ICategoryLayoutService categoryLayoutService) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x.Name).NotEmpty() - .WithMessage(translationService.GetResource("Api.Catalog.Category.Fields.Name.Required")); + .WithMessage(translationService.GetResource("Api.Catalog.Category.Fields.Name.Required", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { if (!string.IsNullOrEmpty(x.PictureId)) @@ -26,7 +30,7 @@ public CategoryValidator(IEnumerable> validators } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Category.Fields.PictureId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Category.Fields.PictureId.NotExists", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { @@ -38,7 +42,7 @@ public CategoryValidator(IEnumerable> validators } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Category.Fields.ParentCategoryId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Category.Fields.ParentCategoryId.NotExists", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { @@ -50,7 +54,7 @@ public CategoryValidator(IEnumerable> validators } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Category.Fields.CategoryLayoutId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Category.Fields.CategoryLayoutId.NotExists", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { @@ -62,6 +66,6 @@ public CategoryValidator(IEnumerable> validators } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Category.Fields.Id.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Category.Fields.Id.NotExists", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/CollectionValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/CollectionValidator.cs index 65c5f2e471..83d9236d6a 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/CollectionValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/CollectionValidator.cs @@ -3,6 +3,7 @@ using Grand.Business.Core.Interfaces.Catalog.Collections; using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Storage; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Catalog; @@ -10,12 +11,15 @@ namespace Grand.Module.Api.Validators.Catalog; public class CollectionValidator : BaseGrandValidator { public CollectionValidator(IEnumerable> validators, - ITranslationService translationService, IPictureService pictureService, ICollectionService collectionService, + ITranslationService translationService, + IContextAccessor contextAccessor, IPictureService pictureService, ICollectionService collectionService, ICollectionLayoutService collectionLayoutService) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x.Name).NotEmpty() - .WithMessage(translationService.GetResource("Api.Catalog.Collection.Fields.Name.Required")); + .WithMessage(translationService.GetResource("Api.Catalog.Collection.Fields.Name.Required", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { if (!string.IsNullOrEmpty(x.PictureId)) @@ -26,7 +30,7 @@ public CollectionValidator(IEnumerable> valida } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Collection.Fields.PictureId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Collection.Fields.PictureId.NotExists", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { @@ -38,7 +42,7 @@ public CollectionValidator(IEnumerable> valida } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Collection.Fields.CollectionLayoutId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Collection.Fields.CollectionLayoutId.NotExists", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { @@ -50,6 +54,6 @@ public CollectionValidator(IEnumerable> valida } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Collection.Fields.Id.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Collection.Fields.Id.NotExists", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeMappingValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeMappingValidator.cs index d45464ecbe..02ca24ae94 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeMappingValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeMappingValidator.cs @@ -2,6 +2,7 @@ using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Catalog; @@ -10,14 +11,17 @@ public class ProductAttributeMappingValidator : BaseGrandValidator> validators, - ITranslationService translationService, IProductAttributeService productAttributeService) + ITranslationService translationService, + IContextAccessor contextAccessor, IProductAttributeService productAttributeService) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x).MustAsync(async (x, _, _) => { var productAttribute = await productAttributeService.GetProductAttributeById(x.ProductAttributeId); return productAttribute != null; }).WithMessage( - translationService.GetResource("Api.Catalog.ProductAttributeMapping.Fields.ProductAttributeId.NotExists")); + translationService.GetResource("Api.Catalog.ProductAttributeMapping.Fields.ProductAttributeId.NotExists", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeValidator.cs index 3e7f3725da..975da2a01b 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeValidator.cs @@ -2,6 +2,7 @@ using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Catalog; @@ -9,11 +10,14 @@ namespace Grand.Module.Api.Validators.Catalog; public class ProductAttributeValidator : BaseGrandValidator { public ProductAttributeValidator(IEnumerable> validators, - ITranslationService translationService, IProductAttributeService productAttributeService) + ITranslationService translationService, + IContextAccessor contextAccessor, IProductAttributeService productAttributeService) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x.Name).NotEmpty() - .WithMessage(translationService.GetResource("Api.Catalog.ProductAttribute.Fields.Name.Required")); + .WithMessage(translationService.GetResource("Api.Catalog.ProductAttribute.Fields.Name.Required", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { if (!string.IsNullOrEmpty(x.Id)) @@ -24,11 +28,11 @@ public ProductAttributeValidator(IEnumerable x).Must((x, _) => { return x.PredefinedProductAttributeValues.All(item => !string.IsNullOrEmpty(item.Name)); }).WithMessage( - translationService.GetResource("Api.Catalog.PredefinedProductAttributeValue.Fields.Name.Required")); + translationService.GetResource("Api.Catalog.PredefinedProductAttributeValue.Fields.Name.Required", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCategoryValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCategoryValidator.cs index 664dae3e91..f1757d8193 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCategoryValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCategoryValidator.cs @@ -2,6 +2,7 @@ using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Categories; using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Catalog; @@ -9,13 +10,16 @@ namespace Grand.Module.Api.Validators.Catalog; public class ProductCategoryValidator : BaseGrandValidator { public ProductCategoryValidator(IEnumerable> validators, - ITranslationService translationService, ICategoryService categoryService) + ITranslationService translationService, + IContextAccessor contextAccessor, ICategoryService categoryService) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x).MustAsync(async (x, _, _) => { var category = await categoryService.GetCategoryById(x.CategoryId); return category != null; - }).WithMessage(translationService.GetResource("Api.Catalog.ProductCategory.Fields.CategoryId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.ProductCategory.Fields.CategoryId.NotExists", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCollectionValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCollectionValidator.cs index 3ca6cc4623..4aa76980e8 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCollectionValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCollectionValidator.cs @@ -2,6 +2,7 @@ using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Collections; using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Catalog; @@ -9,13 +10,16 @@ namespace Grand.Module.Api.Validators.Catalog; public class ProductCollectionValidator : BaseGrandValidator { public ProductCollectionValidator(IEnumerable> validators, - ITranslationService translationService, ICollectionService collectionService) + ITranslationService translationService, + IContextAccessor contextAccessor, ICollectionService collectionService) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x).MustAsync(async (x, _, _) => { var collection = await collectionService.GetCollectionById(x.CollectionId); return collection != null; - }).WithMessage(translationService.GetResource("Api.Catalog.ProductCollection.Fields.CollectionId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.ProductCollection.Fields.CollectionId.NotExists", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductPictureValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductPictureValidator.cs index a59f3bb2be..6639095301 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductPictureValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductPictureValidator.cs @@ -2,6 +2,7 @@ using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Storage; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Catalog; @@ -9,13 +10,16 @@ namespace Grand.Module.Api.Validators.Catalog; public class ProductPictureValidator : BaseGrandValidator { public ProductPictureValidator(IEnumerable> validators, - ITranslationService translationService, IPictureService pictureService) + ITranslationService translationService, + IContextAccessor contextAccessor, IPictureService pictureService) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x).MustAsync(async (x, _, _) => { var picture = await pictureService.GetPictureById(x.PictureId); return picture != null; - }).WithMessage(translationService.GetResource("Api.Catalog.ProductPicture.Fields.PictureId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.ProductPicture.Fields.PictureId.NotExists", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductSpecificationAttributeValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductSpecificationAttributeValidator.cs index 799744fd1e..2d2416e6c8 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductSpecificationAttributeValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductSpecificationAttributeValidator.cs @@ -2,6 +2,7 @@ using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Catalog; @@ -10,17 +11,19 @@ public class ProductSpecificationAttributeValidator : BaseGrandValidator> validators, - ITranslationService translationService, ISpecificationAttributeService specificationAttributeService) + ITranslationService translationService, + IContextAccessor contextAccessor, ISpecificationAttributeService specificationAttributeService) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x).MustAsync(async (x, _, _) => { var specification = await specificationAttributeService.GetSpecificationAttributeById(x.SpecificationAttributeId); return specification != null; }).WithMessage( - translationService.GetResource( - "Api.Catalog.ProductSpecificationAttribute.Fields.SpecificationAttributeId.NotExists")); + translationService.GetResource("Api.Catalog.ProductSpecificationAttribute.Fields.SpecificationAttributeId.NotExists", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { @@ -33,7 +36,6 @@ public ProductSpecificationAttributeValidator( } return true; - }).WithMessage(translationService.GetResource( - "Api.Catalog.ProductSpecificationAttribute.Fields.SpecificationAttributeOptionId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.ProductSpecificationAttribute.Fields.SpecificationAttributeOptionId.NotExists", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductTierPriceValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductTierPriceValidator.cs index cc344097bd..790c3d8286 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductTierPriceValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductTierPriceValidator.cs @@ -3,6 +3,7 @@ using Grand.Business.Core.Interfaces.Common.Directory; using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Catalog; @@ -11,13 +12,16 @@ public class ProductTierPriceValidator : BaseGrandValidator { public ProductTierPriceValidator( IEnumerable> validators, - ITranslationService translationService, IStoreService storeService, IGroupService groupService) + ITranslationService translationService, + IContextAccessor contextAccessor, IStoreService storeService, IGroupService groupService) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x.Quantity).GreaterThan(0) - .WithMessage(translationService.GetResource("Api.Catalog.ProductTierPrice.Fields.Quantity.GreaterThan0")); + .WithMessage(translationService.GetResource("Api.Catalog.ProductTierPrice.Fields.Quantity.GreaterThan0", languageId)); RuleFor(x => x.Price).GreaterThan(0) - .WithMessage(translationService.GetResource("Api.Catalog.ProductTierPrice.Fields.Price.GreaterThan0")); + .WithMessage(translationService.GetResource("Api.Catalog.ProductTierPrice.Fields.Price.GreaterThan0", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { @@ -29,7 +33,7 @@ public ProductTierPriceValidator( } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.ProductTierPrice.Fields.StoreId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.ProductTierPrice.Fields.StoreId.NotExists", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { if (!string.IsNullOrEmpty(x.CustomerGroupId)) @@ -40,6 +44,6 @@ public ProductTierPriceValidator( } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.ProductTierPrice.Fields.CustomerGroupId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.ProductTierPrice.Fields.CustomerGroupId.NotExists", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductValidator.cs index e1f4de9b1d..6f3077517e 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductValidator.cs @@ -6,6 +6,7 @@ using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Catalog; using Grand.Domain.Common; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Catalog; @@ -14,29 +15,32 @@ public class ProductValidator : BaseGrandValidator { public ProductValidator( IEnumerable> validators, - ITranslationService translationService, IProductService productService, + ITranslationService translationService, + IContextAccessor contextAccessor, IProductService productService, IProductLayoutService productLayoutService, IBrandService brandService, IVendorService vendorService, CommonSettings commonSettings) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x.Name).NotEmpty() - .WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.Name.Required")); - //RuleFor(x => x.ProductType).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.ProductType.Required")); - //RuleFor(x => x.BackorderMode).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.BackorderMode.Required")); - //RuleFor(x => x.DownloadActivationType).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.DownloadActivationType.Required")); - //RuleFor(x => x.IntervalUnitType).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.IntervalUnitType.Required")); - //RuleFor(x => x.GiftCardType).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.GiftCardType.Required")); - //RuleFor(x => x.LowStockActivity).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.LowStockActivity.Required")); - //RuleFor(x => x.ManageInventoryMethod).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.ManageInventoryMethod.Required")); - //RuleFor(x => x.RecurringCyclePeriod).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.RecurringCyclePeriod.Required")); + .WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.Name.Required", languageId)); + //RuleFor(x => x.ProductType).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.ProductType.Required", languageId)); + //RuleFor(x => x.BackorderMode).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.BackorderMode.Required", languageId)); + //RuleFor(x => x.DownloadActivationType).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.DownloadActivationType.Required", languageId)); + //RuleFor(x => x.IntervalUnitType).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.IntervalUnitType.Required", languageId)); + //RuleFor(x => x.GiftCardType).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.GiftCardType.Required", languageId)); + //RuleFor(x => x.LowStockActivity).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.LowStockActivity.Required", languageId)); + //RuleFor(x => x.ManageInventoryMethod).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.ManageInventoryMethod.Required", languageId)); + //RuleFor(x => x.RecurringCyclePeriod).IsInEnum().WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.RecurringCyclePeriod.Required", languageId)); if (!commonSettings.AllowEditProductEndedAuction) RuleFor(x => x.AuctionEnded && x.ProductTypeId == ProductType.Auction).Equal(false) - .WithMessage(translationService.GetResource("Api.Catalog.Products.Cannoteditauction")); + .WithMessage(translationService.GetResource("Api.Catalog.Products.Cannoteditauction", languageId)); RuleFor(x => x.ProductTypeId == ProductType.Auction && !x.AvailableEndDateTimeUtc.HasValue).Equal(false) - .WithMessage(translationService.GetResource("Api.Catalog.Products.Fields.AvailableEndDateTime.Required")); + .WithMessage(translationService.GetResource("Api.Catalog.Products.Fields.AvailableEndDateTime.Required", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { @@ -48,7 +52,7 @@ public ProductValidator( } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.ParentGroupedProductId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.ParentGroupedProductId.NotExists", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { @@ -60,7 +64,7 @@ public ProductValidator( } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.ProductLayoutId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.ProductLayoutId.NotExists", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { @@ -72,7 +76,7 @@ public ProductValidator( } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.VendorId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.VendorId.NotExists", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { @@ -84,7 +88,7 @@ public ProductValidator( } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.BrandId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.BrandId.NotExists", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { @@ -96,6 +100,6 @@ public ProductValidator( } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.Id.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.Id.NotExists", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/SpecificationAttributeValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/SpecificationAttributeValidator.cs index ee673538af..1908789440 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/SpecificationAttributeValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/SpecificationAttributeValidator.cs @@ -2,6 +2,7 @@ using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Catalog; @@ -10,11 +11,14 @@ public class SpecificationAttributeValidator : BaseGrandValidator> validators, - ITranslationService translationService, ISpecificationAttributeService specificationAttributeService) + ITranslationService translationService, + IContextAccessor contextAccessor, ISpecificationAttributeService specificationAttributeService) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x.Name).NotEmpty() - .WithMessage(translationService.GetResource("Api.Catalog.SpecificationAttribute.Fields.Name.Required")); + .WithMessage(translationService.GetResource("Api.Catalog.SpecificationAttribute.Fields.Name.Required", languageId)); RuleFor(x => x).MustAsync(async (x, _, _) => { if (!string.IsNullOrEmpty(x.Id)) @@ -25,11 +29,11 @@ public SpecificationAttributeValidator( } return true; - }).WithMessage(translationService.GetResource("Api.Catalog.SpecificationAttribute.Fields.Id.NotExists")); + }).WithMessage(translationService.GetResource("Api.Catalog.SpecificationAttribute.Fields.Id.NotExists", languageId)); RuleFor(x => x).Must((x, _) => { return x.SpecificationAttributeOptions.All(item => !string.IsNullOrEmpty(item.Name)); }).WithMessage( - translationService.GetResource("Api.Catalog.SpecificationAttributeOptions.Fields.Name.Required")); + translationService.GetResource("Api.Catalog.SpecificationAttributeOptions.Fields.Name.Required", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Common/PictureValidator.cs b/src/Modules/Grand.Module.Api/Validators/Common/PictureValidator.cs index ce65b6d5a6..34a8f8a80f 100644 --- a/src/Modules/Grand.Module.Api/Validators/Common/PictureValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Common/PictureValidator.cs @@ -1,6 +1,7 @@ using FluentValidation; using Grand.Module.Api.DTOs.Common; using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Common; @@ -9,15 +10,18 @@ public class PictureValidator : BaseGrandValidator { public PictureValidator( IEnumerable> validators, - ITranslationService translationService) + ITranslationService translationService, + IContextAccessor contextAccessor) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x.MimeType).NotEmpty() - .WithMessage(translationService.GetResource("Api.Common.Picture.Fields.MimeType.Required")); + .WithMessage(translationService.GetResource("Api.Common.Picture.Fields.MimeType.Required", languageId)); RuleFor(x => x.PictureBinary).Must((x, _) => { if (!string.IsNullOrEmpty(x.Id) && (x.PictureBinary == null || x.PictureBinary.Length == 0)) return true; return !string.IsNullOrEmpty(x.Id) || (x.PictureBinary != null && x.PictureBinary.Length != 0); - }).WithMessage(translationService.GetResource("Api.Common.Picture.Fields.PictureBinary.Required")); + }).WithMessage(translationService.GetResource("Api.Common.Picture.Fields.PictureBinary.Required", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Customers/AddressValidator.cs b/src/Modules/Grand.Module.Api/Validators/Customers/AddressValidator.cs index 1b4dfc2e36..9f556a1b96 100644 --- a/src/Modules/Grand.Module.Api/Validators/Customers/AddressValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Customers/AddressValidator.cs @@ -3,6 +3,7 @@ using Grand.Business.Core.Interfaces.Common.Directory; using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Common; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Customers; @@ -11,29 +12,32 @@ public class AddressValidator : BaseGrandValidator { public AddressValidator( IEnumerable> validators, - ITranslationService translationService, ICountryService countryService, AddressSettings addressSettings) + ITranslationService translationService, + IContextAccessor contextAccessor, ICountryService countryService, AddressSettings addressSettings) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x.FirstName) .NotEmpty() - .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.FirstName.Required")); + .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.FirstName.Required", languageId)); RuleFor(x => x.LastName) .NotEmpty() - .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.LastName.Required")); + .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.LastName.Required", languageId)); RuleFor(x => x.Email) .NotEmpty() - .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.Email.Required")); + .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.Email.Required", languageId)); RuleFor(x => x.Email) .EmailAddress() - .WithMessage(translationService.GetResource("Api.Customers.Address.Common.WrongEmail")); + .WithMessage(translationService.GetResource("Api.Customers.Address.Common.WrongEmail", languageId)); if (addressSettings.CountryEnabled) { RuleFor(x => x.CountryId) .NotNull() - .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.Country.Required")); + .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.Country.Required", languageId)); RuleFor(x => x.CountryId) .NotEqual("") - .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.Country.Required")); + .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.Country.Required", languageId)); } if (addressSettings.CountryEnabled && addressSettings.StateProvinceEnabled) @@ -50,30 +54,30 @@ public AddressValidator( } return false; - }).WithMessage(translationService.GetResource("Api.Customers.Address.Fields.StateProvince.Required")); + }).WithMessage(translationService.GetResource("Api.Customers.Address.Fields.StateProvince.Required", languageId)); if (addressSettings.CompanyRequired && addressSettings.CompanyEnabled) RuleFor(x => x.Company).NotEmpty() - .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.Company.Required")); + .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.Company.Required", languageId)); if (addressSettings.VatNumberRequired && addressSettings.VatNumberEnabled) RuleFor(x => x.VatNumber).NotEmpty() - .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.VatNumber.Required")); + .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.VatNumber.Required", languageId)); if (addressSettings.StreetAddressRequired && addressSettings.StreetAddressEnabled) RuleFor(x => x.Address1).NotEmpty() - .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.StreetAddress.Required")); + .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.StreetAddress.Required", languageId)); if (addressSettings.StreetAddress2Required && addressSettings.StreetAddress2Enabled) RuleFor(x => x.Address2).NotEmpty() - .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.StreetAddress2.Required")); + .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.StreetAddress2.Required", languageId)); if (addressSettings.ZipPostalCodeRequired && addressSettings.ZipPostalCodeEnabled) RuleFor(x => x.ZipPostalCode).NotEmpty() - .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.ZipPostalCode.Required")); + .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.ZipPostalCode.Required", languageId)); if (addressSettings.CityRequired && addressSettings.CityEnabled) RuleFor(x => x.City).NotEmpty() - .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.City.Required")); + .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.City.Required", languageId)); if (addressSettings.PhoneRequired && addressSettings.PhoneEnabled) RuleFor(x => x.PhoneNumber).NotEmpty() - .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.Phone.Required")); + .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.Phone.Required", languageId)); if (addressSettings.FaxRequired && addressSettings.FaxEnabled) RuleFor(x => x.FaxNumber).NotEmpty() - .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.Fax.Required")); + .WithMessage(translationService.GetResource("Api.Customers.Address.Fields.Fax.Required", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Customers/CustomerGroupValidator.cs b/src/Modules/Grand.Module.Api/Validators/Customers/CustomerGroupValidator.cs index a9f9b6ee64..99fde50756 100644 --- a/src/Modules/Grand.Module.Api/Validators/Customers/CustomerGroupValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Customers/CustomerGroupValidator.cs @@ -2,6 +2,7 @@ using Grand.Module.Api.DTOs.Customers; using Grand.Business.Core.Interfaces.Common.Directory; using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Customers; @@ -10,11 +11,14 @@ public class CustomerGroupValidator : BaseGrandValidator { public CustomerGroupValidator( IEnumerable> validators, - ITranslationService translationService, IGroupService groupService) + ITranslationService translationService, + IContextAccessor contextAccessor, IGroupService groupService) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x.Name).NotEmpty() - .WithMessage(translationService.GetResource("Api.Customers.CustomerGroup.Fields.Name.Required")); + .WithMessage(translationService.GetResource("Api.Customers.CustomerGroup.Fields.Name.Required", languageId)); RuleFor(x => x).MustAsync(async (x, _) => { @@ -26,7 +30,7 @@ public CustomerGroupValidator( } return true; - }).WithMessage(translationService.GetResource("Api.Customers.CustomerGroup.Fields.Id.NotExists")); + }).WithMessage(translationService.GetResource("Api.Customers.CustomerGroup.Fields.Id.NotExists", languageId)); RuleFor(x => x).MustAsync(async (x, _) => { if (!string.IsNullOrEmpty(x.Id)) @@ -36,7 +40,7 @@ public CustomerGroupValidator( } return true; - }).WithMessage(translationService.GetResource("Api.Customers.CustomerGroup.Fields.Active.CantEditSystem")); + }).WithMessage(translationService.GetResource("Api.Customers.CustomerGroup.Fields.Active.CantEditSystem", languageId)); RuleFor(x => x).MustAsync(async (x, _) => { if (!string.IsNullOrEmpty(x.Id)) @@ -47,6 +51,6 @@ public CustomerGroupValidator( } return true; - }).WithMessage(translationService.GetResource("Api.Customers.CustomerGroup.Fields.SystemName.CantEditSystem")); + }).WithMessage(translationService.GetResource("Api.Customers.CustomerGroup.Fields.SystemName.CantEditSystem", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Customers/CustomerValidator.cs b/src/Modules/Grand.Module.Api/Validators/Customers/CustomerValidator.cs index 3071ae6bdf..ac98172b19 100644 --- a/src/Modules/Grand.Module.Api/Validators/Customers/CustomerValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Customers/CustomerValidator.cs @@ -5,6 +5,7 @@ using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Customers; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Customers; @@ -13,40 +14,43 @@ public class CustomerValidator : BaseGrandValidator { public CustomerValidator( IEnumerable> validators, - ITranslationService translationService, ICountryService countryService, + ITranslationService translationService, + IContextAccessor contextAccessor, ICountryService countryService, ICustomerService customerService, IStoreService storeService, CustomerSettings customerSettings) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x).MustAsync(async (x, _) => { var customer = await customerService.GetCustomerByEmail(x.Email); return customer == null || customer.Id == x.Id; - }).WithMessage(translationService.GetResource("Api.Customers.Customer.Fields.Email.Registered")); + }).WithMessage(translationService.GetResource("Api.Customers.Customer.Fields.Email.Registered", languageId)); RuleFor(x => x).MustAsync(async (x, _) => { var username = await customerService.GetCustomerByUsername(x.Username); return username == null || username.Id == x.Id || !customerSettings.UsernamesEnabled; - }).WithMessage(translationService.GetResource("Api.Customers.Customer.Fields.Username.Registered")); + }).WithMessage(translationService.GetResource("Api.Customers.Customer.Fields.Username.Registered", languageId)); RuleFor(x => x).MustAsync(async (x, _) => { var customer = await customerService.GetCustomerByGuid(x.CustomerGuid); return customer == null || customer.Id == x.Id; - }).WithMessage(translationService.GetResource("Api.Customers.Customer.Fields.Guid.Exists")); + }).WithMessage(translationService.GetResource("Api.Customers.Customer.Fields.Guid.Exists", languageId)); RuleFor(x => x).MustAsync(async (x, _) => { var store = await storeService.GetStoreById(x.StoreId); return store != null; - }).WithMessage(translationService.GetResource("Api.Customers.Customer.Fields.StoreId.NotExists")); + }).WithMessage(translationService.GetResource("Api.Customers.Customer.Fields.StoreId.NotExists", languageId)); //form fields if (customerSettings.CountryEnabled && customerSettings.CountryRequired) RuleFor(x => x.CountryId) .NotEqual("") - .WithMessage(translationService.GetResource("Api.Customers.Customer.Fields.Country.Required")); + .WithMessage(translationService.GetResource("Api.Customers.Customer.Fields.Country.Required", languageId)); if (customerSettings.CountryEnabled && customerSettings.StateProvinceEnabled && customerSettings.StateProvinceRequired) @@ -63,35 +67,31 @@ public CustomerValidator( } return false; - }).WithMessage(translationService.GetResource("pi.Customers.Customer.Fields.StateProvince.Required")); + }).WithMessage(translationService.GetResource("pi.Customers.Customer.Fields.StateProvince.Required", languageId)); if (customerSettings.CompanyRequired && customerSettings.CompanyEnabled) RuleFor(x => x.Company).NotEmpty() .WithMessage( - translationService.GetResource( - "Api.Customers.Customer.Customers.Customers.Fields.Company.Required")); + translationService.GetResource("Api.Customers.Customer.Customers.Customers.Fields.Company.Required", languageId)); if (customerSettings.StreetAddressRequired && customerSettings.StreetAddressEnabled) RuleFor(x => x.StreetAddress).NotEmpty().WithMessage( - translationService.GetResource( - "Api.Customers.Customer.Customers.Customers.Fields.StreetAddress.Required")); + translationService.GetResource("Api.Customers.Customer.Customers.Customers.Fields.StreetAddress.Required", languageId)); if (customerSettings.StreetAddress2Required && customerSettings.StreetAddress2Enabled) RuleFor(x => x.StreetAddress2).NotEmpty().WithMessage( - translationService.GetResource( - "Api.Customers.Customer.Customers.Customers.Fields.StreetAddress2.Required")); + translationService.GetResource("Api.Customers.Customer.Customers.Customers.Fields.StreetAddress2.Required", languageId)); if (customerSettings.ZipPostalCodeRequired && customerSettings.ZipPostalCodeEnabled) RuleFor(x => x.ZipPostalCode).NotEmpty().WithMessage( - translationService.GetResource( - "Api.Customers.Customer.Customers.Customers.Fields.ZipPostalCode.Required")); + translationService.GetResource("Api.Customers.Customer.Customers.Customers.Fields.ZipPostalCode.Required", languageId)); if (customerSettings.CityRequired && customerSettings.CityEnabled) RuleFor(x => x.City).NotEmpty() .WithMessage( - translationService.GetResource("Api.Customers.Customer.Customers.Customers.Fields.City.Required")); + translationService.GetResource("Api.Customers.Customer.Customers.Customers.Fields.City.Required", languageId)); if (customerSettings.PhoneRequired && customerSettings.PhoneEnabled) RuleFor(x => x.Phone).NotEmpty() .WithMessage( - translationService.GetResource("Api.Customers.Customer.Customers.Customers.Fields.Phone.Required")); + translationService.GetResource("Api.Customers.Customer.Customers.Customers.Fields.Phone.Required", languageId)); if (customerSettings.FaxRequired && customerSettings.FaxEnabled) RuleFor(x => x.Fax).NotEmpty() .WithMessage( - translationService.GetResource("Api.Customers.Customer.Customers.Customers.Fields.Fax.Required")); + translationService.GetResource("Api.Customers.Customer.Customers.Customers.Fields.Fax.Required", languageId)); } } \ No newline at end of file diff --git a/src/Modules/Grand.Module.Api/Validators/Customers/PasswordValidator.cs b/src/Modules/Grand.Module.Api/Validators/Customers/PasswordValidator.cs index 2636f3a5e7..48da49538d 100644 --- a/src/Modules/Grand.Module.Api/Validators/Customers/PasswordValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Customers/PasswordValidator.cs @@ -2,6 +2,7 @@ using Grand.Module.Api.DTOs.Customers; using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Customers; +using Grand.Infrastructure; using Grand.Infrastructure.Validators; namespace Grand.Module.Api.Validators.Customers; @@ -11,14 +12,17 @@ public class PasswordValidator : BaseGrandValidator public PasswordValidator( IEnumerable> validators, ITranslationService translationService, + IContextAccessor contextAccessor, CustomerSettings customerSettings) : base(validators) { + var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + RuleFor(x => x.Password).NotEmpty() - .WithMessage(translationService.GetResource("Account.Fields.Password.Required")); + .WithMessage(translationService.GetResource("Account.Fields.Password.Required", languageId)); if (!string.IsNullOrEmpty(customerSettings.PasswordRegularExpression)) RuleFor(x => x.Password).Matches(customerSettings.PasswordRegularExpression) - .WithMessage(string.Format(translationService.GetResource("Account.Fields.Password.Validation"))); + .WithMessage(string.Format(translationService.GetResource("Account.Fields.Password.Validation", languageId))); } } \ No newline at end of file diff --git a/src/Plugins/Authentication.Facebook/Areas/Admin/Controllers/FacebookAuthenticationSettingsController.cs b/src/Plugins/Authentication.Facebook/Areas/Admin/Controllers/FacebookAuthenticationSettingsController.cs index 92559b0e92..ec8164ca10 100644 --- a/src/Plugins/Authentication.Facebook/Areas/Admin/Controllers/FacebookAuthenticationSettingsController.cs +++ b/src/Plugins/Authentication.Facebook/Areas/Admin/Controllers/FacebookAuthenticationSettingsController.cs @@ -1,6 +1,5 @@ using Authentication.Facebook.Models; using Grand.Business.Core.Interfaces.Common.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Domain.Permissions; using Grand.Web.Common.Controllers; @@ -8,6 +7,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; +using Grand.Web.Common.Localization; namespace Authentication.Facebook.Areas.Admin.Controllers; @@ -19,7 +19,7 @@ public class FacebookAuthenticationSettingsController : BasePluginController #region Ctor public FacebookAuthenticationSettingsController(FacebookExternalAuthSettings facebookExternalAuthSettings, - ITranslationService translationService, + IRequestTranslationService translationService, IPermissionService permissionService, ISettingService settingService, IConfiguration configuration) @@ -36,7 +36,7 @@ public FacebookAuthenticationSettingsController(FacebookExternalAuthSettings fac #region Fields private readonly FacebookExternalAuthSettings _facebookExternalAuthSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IPermissionService _permissionService; private readonly ISettingService _settingService; private readonly IConfiguration _configuration; diff --git a/src/Plugins/Authentication.Google/Areas/Admin/Controllers/GoogleAuthenticationSettingsController.cs b/src/Plugins/Authentication.Google/Areas/Admin/Controllers/GoogleAuthenticationSettingsController.cs index 7d362d6b27..8e28609b16 100644 --- a/src/Plugins/Authentication.Google/Areas/Admin/Controllers/GoogleAuthenticationSettingsController.cs +++ b/src/Plugins/Authentication.Google/Areas/Admin/Controllers/GoogleAuthenticationSettingsController.cs @@ -1,12 +1,12 @@ using Authentication.Google.Models; using Grand.Business.Core.Interfaces.Common.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Domain.Permissions; using Grand.Web.Common.Controllers; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; +using Grand.Web.Common.Localization; namespace Authentication.Google.Areas.Admin.Controllers; @@ -17,7 +17,7 @@ public class GoogleAuthenticationSettingsController : BaseAdminPluginController public GoogleAuthenticationSettingsController( GoogleExternalAuthSettings googleExternalAuthSettings, - ITranslationService translationService, + IRequestTranslationService translationService, IPermissionService permissionService, ISettingService settingService, IConfiguration configuration) @@ -34,7 +34,7 @@ public GoogleAuthenticationSettingsController( #region Fields private readonly GoogleExternalAuthSettings _googleExternalAuthSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IPermissionService _permissionService; private readonly ISettingService _settingService; private readonly IConfiguration _configuration; diff --git a/src/Plugins/Authentication.OpenIdConnect/Areas/Admin/Controllers/OidcLoginSettingsController.cs b/src/Plugins/Authentication.OpenIdConnect/Areas/Admin/Controllers/OidcLoginSettingsController.cs index c9ac02be02..ff7f4cfd54 100644 --- a/src/Plugins/Authentication.OpenIdConnect/Areas/Admin/Controllers/OidcLoginSettingsController.cs +++ b/src/Plugins/Authentication.OpenIdConnect/Areas/Admin/Controllers/OidcLoginSettingsController.cs @@ -1,12 +1,12 @@ using Authentication.OpenIdConnect.Models; using Grand.Business.Core.Interfaces.Common.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Domain.Permissions; using Grand.Infrastructure.Configuration; using Grand.Web.Common.Controllers; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Authentication.OpenIdConnect.Areas.Admin.Controllers; @@ -19,7 +19,7 @@ public OidcLoginSettingsController( OidcLoginSettings oidcLoginSettings, OidcResourceServerConfig resourceServerConfig, OidcLoginConfig oidcLoginConfig, - ITranslationService translationService, + IRequestTranslationService translationService, IPermissionService permissionService, ISettingService settingService) { @@ -38,7 +38,7 @@ public OidcLoginSettingsController( private readonly OidcLoginSettings _oidcLoginSettings; private readonly OidcResourceServerConfig _resourceServerConfig; private readonly OidcLoginConfig _oidcLoginConfig; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IPermissionService _permissionService; private readonly ISettingService _settingService; diff --git a/src/Plugins/DiscountRules.Standard/Controllers/DiscountRulesHasAllProductsController.cs b/src/Plugins/DiscountRules.Standard/Controllers/DiscountRulesHasAllProductsController.cs index aaef90d616..a73ec9d378 100644 --- a/src/Plugins/DiscountRules.Standard/Controllers/DiscountRulesHasAllProductsController.cs +++ b/src/Plugins/DiscountRules.Standard/Controllers/DiscountRulesHasAllProductsController.cs @@ -1,7 +1,6 @@ using DiscountRules.Standard.Models; using Grand.Business.Core.Interfaces.Catalog.Discounts; using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; @@ -23,7 +22,7 @@ public class DiscountRulesHasAllProductsController : BaseDiscountRulePluginContr private readonly IPermissionService _permissionService; private readonly IProductService _productService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IVendorService _vendorService; private readonly IContextAccessor _contextAccessor; private readonly IEnumTranslationService _enumTranslationService; @@ -32,7 +31,7 @@ public class DiscountRulesHasAllProductsController : BaseDiscountRulePluginContr public DiscountRulesHasAllProductsController(IDiscountService discountService, IPermissionService permissionService, IContextAccessor contextAccessor, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IVendorService vendorService, IProductService productService, diff --git a/src/Plugins/DiscountRules.Standard/Controllers/DiscountRulesHasOneProductController.cs b/src/Plugins/DiscountRules.Standard/Controllers/DiscountRulesHasOneProductController.cs index ec0de48df5..18ffca75b4 100644 --- a/src/Plugins/DiscountRules.Standard/Controllers/DiscountRulesHasOneProductController.cs +++ b/src/Plugins/DiscountRules.Standard/Controllers/DiscountRulesHasOneProductController.cs @@ -1,7 +1,6 @@ using DiscountRules.Standard.Models; using Grand.Business.Core.Interfaces.Catalog.Discounts; using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; @@ -24,7 +23,7 @@ public class DiscountRulesHasOneProductController : BaseDiscountRulePluginContro private readonly IPermissionService _permissionService; private readonly IProductService _productService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IVendorService _vendorService; private readonly IContextAccessor _contextAccessor; private readonly IEnumTranslationService _enumTranslationService; @@ -35,7 +34,7 @@ public class DiscountRulesHasOneProductController : BaseDiscountRulePluginContro public DiscountRulesHasOneProductController(IDiscountService discountService, IPermissionService permissionService, IContextAccessor contextAccessor, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IVendorService vendorService, IProductService productService, diff --git a/src/Plugins/DiscountRules.Standard/Providers/HadSpentAmountDiscountRule.cs b/src/Plugins/DiscountRules.Standard/Providers/HadSpentAmountDiscountRule.cs index 398948168b..26d57a9034 100644 --- a/src/Plugins/DiscountRules.Standard/Providers/HadSpentAmountDiscountRule.cs +++ b/src/Plugins/DiscountRules.Standard/Providers/HadSpentAmountDiscountRule.cs @@ -1,17 +1,17 @@ using Grand.Business.Core.Interfaces.Catalog.Discounts; using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain.Orders; +using Grand.Web.Common.Localization; namespace DiscountRules.Standard.Providers; public class HadSpentAmountDiscountRule : IDiscountRule { private readonly IOrderService _orderService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; - public HadSpentAmountDiscountRule(IOrderService orderService, ITranslationService translationService) + public HadSpentAmountDiscountRule(IOrderService orderService, IRequestTranslationService translationService) { _orderService = orderService; _translationService = translationService; diff --git a/src/Plugins/Payments.BrainTree/Areas/Admin/Controllers/PaymentBrainTreeController.cs b/src/Plugins/Payments.BrainTree/Areas/Admin/Controllers/PaymentBrainTreeController.cs index 1dbb67f8cd..6f528a5570 100644 --- a/src/Plugins/Payments.BrainTree/Areas/Admin/Controllers/PaymentBrainTreeController.cs +++ b/src/Plugins/Payments.BrainTree/Areas/Admin/Controllers/PaymentBrainTreeController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Permissions; using Grand.Web.Common.Controllers; using Grand.Web.Common.Filters; @@ -7,6 +6,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Payments.BrainTree.Models; +using Grand.Web.Common.Localization; namespace Payments.BrainTree.Areas.Admin.Controllers; @@ -18,7 +18,7 @@ public class PaymentBrainTreeController : BasePaymentController #region Ctor public PaymentBrainTreeController(ISettingService settingService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminStoreService adminStoreService) { _settingService = settingService; @@ -31,7 +31,7 @@ public PaymentBrainTreeController(ISettingService settingService, #region Fields private readonly ISettingService _settingService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IAdminStoreService _adminStoreService; #endregion diff --git a/src/Plugins/Payments.BrainTree/Areas/Store/Controllers/PaymentBrainTreeController.cs b/src/Plugins/Payments.BrainTree/Areas/Store/Controllers/PaymentBrainTreeController.cs index e9d818e9c6..4dc5b9778b 100644 --- a/src/Plugins/Payments.BrainTree/Areas/Store/Controllers/PaymentBrainTreeController.cs +++ b/src/Plugins/Payments.BrainTree/Areas/Store/Controllers/PaymentBrainTreeController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Permissions; using Grand.Infrastructure; using Grand.Web.Common.Controllers; @@ -7,6 +6,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Payments.BrainTree.Models; +using Grand.Web.Common.Localization; namespace Payments.BrainTree.Areas.Store.Controllers; @@ -30,7 +30,7 @@ public class PaymentBrainTreeController : BasePaymentController #region Ctor public PaymentBrainTreeController(ISettingService settingService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor) { _settingService = settingService; @@ -43,7 +43,7 @@ public PaymentBrainTreeController(ISettingService settingService, #region Fields private readonly ISettingService _settingService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; /// diff --git a/src/Plugins/Payments.BrainTree/BrainTreePaymentProvider.cs b/src/Plugins/Payments.BrainTree/BrainTreePaymentProvider.cs index d744eaa64e..dce6645233 100644 --- a/src/Plugins/Payments.BrainTree/BrainTreePaymentProvider.cs +++ b/src/Plugins/Payments.BrainTree/BrainTreePaymentProvider.cs @@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Payments; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Utilities.Checkout; using Grand.Domain.Orders; @@ -15,6 +14,7 @@ using Payments.BrainTree.Validators; using Environment = Braintree.Environment; using TransactionStatus = Grand.Domain.Payments.TransactionStatus; +using Grand.Web.Common.Localization; namespace Payments.BrainTree; @@ -26,10 +26,10 @@ public class BrainTreePaymentProvider : IPaymentProvider private readonly ICustomerService _customerService; private readonly IHttpContextAccessor _httpContextAccessor; private readonly IShoppingCartSubTotalService _shoppingCartSubTotalService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public BrainTreePaymentProvider( - ITranslationService translationService, + IRequestTranslationService translationService, ICustomerService customerService, IHttpContextAccessor httpContextAccessor, IShoppingCartSubTotalService shoppingCartSubTotalService, diff --git a/src/Plugins/Payments.BrainTree/BrainTreeWidgetProvider.cs b/src/Plugins/Payments.BrainTree/BrainTreeWidgetProvider.cs index 6f7fd26ebd..9eac1a40cd 100644 --- a/src/Plugins/Payments.BrainTree/BrainTreeWidgetProvider.cs +++ b/src/Plugins/Payments.BrainTree/BrainTreeWidgetProvider.cs @@ -1,14 +1,14 @@ using Grand.Business.Core.Interfaces.Cms; -using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Web.Common.Localization; namespace Payments.BrainTree; public class BrainTreeWidgetProvider : IWidgetProvider { private readonly BrainTreePaymentSettings _brainTreePaymentSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; - public BrainTreeWidgetProvider(ITranslationService translationService, + public BrainTreeWidgetProvider(IRequestTranslationService translationService, BrainTreePaymentSettings brainTreePaymentSettings) { _translationService = translationService; diff --git a/src/Plugins/Payments.BrainTree/Controllers/PaymentBrainTreeController.cs b/src/Plugins/Payments.BrainTree/Controllers/PaymentBrainTreeController.cs index d79263934b..a28bc3ef27 100644 --- a/src/Plugins/Payments.BrainTree/Controllers/PaymentBrainTreeController.cs +++ b/src/Plugins/Payments.BrainTree/Controllers/PaymentBrainTreeController.cs @@ -1,6 +1,5 @@ using Braintree; using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Utilities.Checkout; using Grand.Domain.Orders; using Grand.Infrastructure; @@ -12,6 +11,7 @@ using System.Net; using Environment = Braintree.Environment; using Grand.Web.Common.Extensions; +using Grand.Web.Common.Localization; namespace Payments.BrainTree.Controllers; @@ -20,14 +20,14 @@ public class PaymentBrainTreeController : BasePaymentController private readonly BrainTreePaymentSettings _brainTreePaymentSettings; private readonly IOrderCalculationService _orderTotalCalculationService; private readonly IShoppingCartService _shoppingCartService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; public PaymentBrainTreeController(BrainTreePaymentSettings brainTreePaymentSettings, IOrderCalculationService orderTotalCalculationService, IShoppingCartService shoppingCartService, IContextAccessor contextAccessor, - ITranslationService translationService) + IRequestTranslationService translationService) { _brainTreePaymentSettings = brainTreePaymentSettings; _orderTotalCalculationService = orderTotalCalculationService; diff --git a/src/Plugins/Payments.BrainTree/Validators/PaymentInfoValidator.cs b/src/Plugins/Payments.BrainTree/Validators/PaymentInfoValidator.cs index 5ebc58b071..54482160f6 100644 --- a/src/Plugins/Payments.BrainTree/Validators/PaymentInfoValidator.cs +++ b/src/Plugins/Payments.BrainTree/Validators/PaymentInfoValidator.cs @@ -1,13 +1,13 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Payments.BrainTree.Models; +using Grand.Web.Common.Localization; namespace Payments.BrainTree.Validators; public class PaymentInfoValidator : AbstractValidator { public PaymentInfoValidator(BrainTreePaymentSettings brainTreePaymentSettings, - ITranslationService translationService) + IRequestTranslationService translationService) { if (brainTreePaymentSettings.Use3DS) return; diff --git a/src/Plugins/Payments.CashOnDelivery/Areas/Admin/Controllers/PaymentCashOnDeliveryController.cs b/src/Plugins/Payments.CashOnDelivery/Areas/Admin/Controllers/PaymentCashOnDeliveryController.cs index dd3536d202..f399d3198f 100644 --- a/src/Plugins/Payments.CashOnDelivery/Areas/Admin/Controllers/PaymentCashOnDeliveryController.cs +++ b/src/Plugins/Payments.CashOnDelivery/Areas/Admin/Controllers/PaymentCashOnDeliveryController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Permissions; using Grand.Web.Common.Controllers; using Grand.Web.Common.Filters; @@ -7,6 +6,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Payments.CashOnDelivery.Models; +using Grand.Web.Common.Localization; namespace Payments.CashOnDelivery.Areas.Admin.Controllers; @@ -16,12 +16,12 @@ namespace Payments.CashOnDelivery.Areas.Admin.Controllers; public class PaymentCashOnDeliveryController : BasePaymentController { private readonly ISettingService _settingService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IAdminStoreService _adminStoreService; public PaymentCashOnDeliveryController( ISettingService settingService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminStoreService adminStoreService) { _settingService = settingService; diff --git a/src/Plugins/Payments.CashOnDelivery/Areas/Store/Controllers/PaymentCashOnDeliveryController.cs b/src/Plugins/Payments.CashOnDelivery/Areas/Store/Controllers/PaymentCashOnDeliveryController.cs index 2f637361b6..a35cf5ed22 100644 --- a/src/Plugins/Payments.CashOnDelivery/Areas/Store/Controllers/PaymentCashOnDeliveryController.cs +++ b/src/Plugins/Payments.CashOnDelivery/Areas/Store/Controllers/PaymentCashOnDeliveryController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Permissions; using Grand.Infrastructure; using Grand.Web.Common.Controllers; @@ -7,6 +6,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Payments.CashOnDelivery.Models; +using Grand.Web.Common.Localization; namespace Payments.CashOnDelivery.Areas.Store.Controllers; @@ -28,11 +28,11 @@ public class PaymentCashOnDeliveryController : BasePaymentController { private readonly IContextAccessor _contextAccessor; private readonly ISettingService _settingService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public PaymentCashOnDeliveryController( ISettingService settingService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor) { _settingService = settingService; diff --git a/src/Plugins/Payments.CashOnDelivery/CashOnDeliveryPaymentProvider.cs b/src/Plugins/Payments.CashOnDelivery/CashOnDeliveryPaymentProvider.cs index 69e432e8df..88b07a5c0e 100644 --- a/src/Plugins/Payments.CashOnDelivery/CashOnDeliveryPaymentProvider.cs +++ b/src/Plugins/Payments.CashOnDelivery/CashOnDeliveryPaymentProvider.cs @@ -2,11 +2,11 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Payments; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Utilities.Checkout; using Grand.Domain.Orders; using Grand.Domain.Payments; using Grand.Infrastructure; +using Grand.Web.Common.Localization; namespace Payments.CashOnDelivery; @@ -17,10 +17,10 @@ public class CashOnDeliveryPaymentProvider : IPaymentProvider private readonly ICurrencyService _currencyService; private readonly IPaymentTransactionService _paymentTransactionService; private readonly IShoppingCartSubTotalService _shoppingCartSubTotalService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public CashOnDeliveryPaymentProvider( - ITranslationService translationService, + IRequestTranslationService translationService, IShoppingCartSubTotalService shoppingCartSubTotalService, ICurrencyService currencyService, IContextAccessor contextAccessor, diff --git a/src/Plugins/Payments.StripeCheckout/Areas/Admin/Controllers/StripeCheckoutController.cs b/src/Plugins/Payments.StripeCheckout/Areas/Admin/Controllers/StripeCheckoutController.cs index cbe85c6a1e..7b20c0a847 100644 --- a/src/Plugins/Payments.StripeCheckout/Areas/Admin/Controllers/StripeCheckoutController.cs +++ b/src/Plugins/Payments.StripeCheckout/Areas/Admin/Controllers/StripeCheckoutController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Domain.Permissions; using Grand.Web.Common.Controllers; @@ -8,6 +7,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Payments.StripeCheckout.Models; +using Grand.Web.Common.Localization; namespace Payments.StripeCheckout.Areas.Admin.Controllers; @@ -18,12 +18,12 @@ public class StripeCheckoutController : BasePaymentController { private readonly IPermissionService _permissionService; private readonly ISettingService _settingService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IAdminStoreService _adminStoreService; public StripeCheckoutController( ISettingService settingService, - ITranslationService translationService, + IRequestTranslationService translationService, IPermissionService permissionService, IAdminStoreService adminStoreService) { diff --git a/src/Plugins/Payments.StripeCheckout/Areas/Store/Controllers/StripeCheckoutController.cs b/src/Plugins/Payments.StripeCheckout/Areas/Store/Controllers/StripeCheckoutController.cs index 5844e9f12f..53ae076b3b 100644 --- a/src/Plugins/Payments.StripeCheckout/Areas/Store/Controllers/StripeCheckoutController.cs +++ b/src/Plugins/Payments.StripeCheckout/Areas/Store/Controllers/StripeCheckoutController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Permissions; using Grand.Infrastructure; @@ -8,6 +7,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Payments.StripeCheckout.Models; +using Grand.Web.Common.Localization; namespace Payments.StripeCheckout.Areas.Store.Controllers; @@ -31,11 +31,11 @@ public class StripeCheckoutController : BasePaymentController private readonly IContextAccessor _contextAccessor; private readonly ISettingService _settingService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public StripeCheckoutController( ISettingService settingService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IContextAccessor contextAccessor) { diff --git a/src/Plugins/Payments.StripeCheckout/StripeCheckoutPaymentProvider.cs b/src/Plugins/Payments.StripeCheckout/StripeCheckoutPaymentProvider.cs index e481f27dbc..724ec1456d 100644 --- a/src/Plugins/Payments.StripeCheckout/StripeCheckoutPaymentProvider.cs +++ b/src/Plugins/Payments.StripeCheckout/StripeCheckoutPaymentProvider.cs @@ -1,12 +1,12 @@ using Grand.Business.Core.Enums.Checkout; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Payments; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Utilities.Checkout; using Grand.Domain.Orders; using Grand.Domain.Payments; using Microsoft.AspNetCore.Http; using Payments.StripeCheckout.Services; +using Grand.Web.Common.Localization; namespace Payments.StripeCheckout; @@ -16,13 +16,13 @@ public class StripeCheckoutPaymentProvider : IPaymentProvider private readonly IOrderService _orderService; private readonly StripeCheckoutPaymentSettings _stripeCheckoutPaymentSettings; private readonly IStripeCheckoutService _stripeCheckoutService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; #region Ctor public StripeCheckoutPaymentProvider( IHttpContextAccessor httpContextAccessor, - ITranslationService translationService, + IRequestTranslationService translationService, IOrderService orderService, StripeCheckoutPaymentSettings stripeCheckoutPaymentSettings, IStripeCheckoutService stripeCheckoutService) { diff --git a/src/Plugins/Shipping.ByWeight/Areas/Admin/Controllers/ShippingByWeightController.cs b/src/Plugins/Shipping.ByWeight/Areas/Admin/Controllers/ShippingByWeightController.cs index 35d5c4cbfe..adae723070 100644 --- a/src/Plugins/Shipping.ByWeight/Areas/Admin/Controllers/ShippingByWeightController.cs +++ b/src/Plugins/Shipping.ByWeight/Areas/Admin/Controllers/ShippingByWeightController.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Permissions; using Grand.Domain.Directory; @@ -15,6 +14,7 @@ using Shipping.ByWeight.Domain; using Shipping.ByWeight.Models; using Shipping.ByWeight.Services; +using Grand.Web.Common.Localization; namespace Shipping.ByWeight.Areas.Admin.Controllers; @@ -33,7 +33,7 @@ public class ShippingByWeightController : BaseShippingController private readonly ByWeightShippingSettings _shippingByWeightSettings; private readonly IShippingMethodService _shippingMethodService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IWarehouseService _warehouseService; public ShippingByWeightController( @@ -44,7 +44,7 @@ public ShippingByWeightController( ByWeightShippingSettings shippingByWeightSettings, IShippingByWeightService shippingByWeightService, ISettingService settingService, - ITranslationService translationService, + IRequestTranslationService translationService, ICurrencyService currencyService, CurrencySettings currencySettings, IMeasureService measureService, diff --git a/src/Plugins/Shipping.ByWeight/Areas/Store/Controllers/ShippingByWeightController.cs b/src/Plugins/Shipping.ByWeight/Areas/Store/Controllers/ShippingByWeightController.cs index c48f82d2dd..913e419aa7 100644 --- a/src/Plugins/Shipping.ByWeight/Areas/Store/Controllers/ShippingByWeightController.cs +++ b/src/Plugins/Shipping.ByWeight/Areas/Store/Controllers/ShippingByWeightController.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Directory; using Grand.Domain.Permissions; using Grand.Infrastructure; @@ -16,6 +15,7 @@ using Shipping.ByWeight.Models; using Shipping.ByWeight.Services; using System.Text; +using Grand.Web.Common.Localization; namespace Shipping.ByWeight.Areas.Store.Controllers; @@ -41,7 +41,7 @@ public class ShippingByWeightController : BaseController private readonly ISettingService _settingService; private readonly IShippingByWeightService _shippingByWeightService; private readonly IShippingMethodService _shippingMethodService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IWarehouseService _warehouseService; public ShippingByWeightController( @@ -50,7 +50,7 @@ public ShippingByWeightController( ICountryService countryService, IShippingByWeightService shippingByWeightService, ISettingService settingService, - ITranslationService translationService, + IRequestTranslationService translationService, ICurrencyService currencyService, CurrencySettings currencySettings, IMeasureService measureService, diff --git a/src/Plugins/Shipping.ByWeight/ByWeightShippingProvider.cs b/src/Plugins/Shipping.ByWeight/ByWeightShippingProvider.cs index 420e75f66d..77b2ca2237 100644 --- a/src/Plugins/Shipping.ByWeight/ByWeightShippingProvider.cs +++ b/src/Plugins/Shipping.ByWeight/ByWeightShippingProvider.cs @@ -5,7 +5,6 @@ using Grand.Business.Core.Interfaces.Checkout.CheckoutAttributes; using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Utilities.Checkout; using Grand.Domain.Catalog; using Grand.Domain.Common; @@ -14,6 +13,7 @@ using Grand.Domain.Shipping; using Grand.Infrastructure; using Shipping.ByWeight.Services; +using Grand.Web.Common.Localization; namespace Shipping.ByWeight; @@ -24,7 +24,7 @@ public class ByWeightShippingCalcPlugin : IShippingRateCalculationProvider public ByWeightShippingCalcPlugin( IShippingMethodService shippingMethodService, IContextAccessor contextAccessor, - ITranslationService translationService, + IRequestTranslationService translationService, IProductService productService, ICheckoutAttributeParser checkoutAttributeParser, ICurrencyService currencyService, @@ -87,7 +87,7 @@ public ByWeightShippingCalcPlugin( private readonly IShippingMethodService _shippingMethodService; private readonly IContextAccessor _contextAccessor; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IProductService _productService; private readonly ICheckoutAttributeParser _checkoutAttributeParser; private readonly ICurrencyService _currencyService; diff --git a/src/Plugins/Shipping.FixedRateShipping/FixedRateShippingProvider.cs b/src/Plugins/Shipping.FixedRateShipping/FixedRateShippingProvider.cs index 87280904aa..2504b38d79 100644 --- a/src/Plugins/Shipping.FixedRateShipping/FixedRateShippingProvider.cs +++ b/src/Plugins/Shipping.FixedRateShipping/FixedRateShippingProvider.cs @@ -3,12 +3,12 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Utilities.Checkout; using Grand.Domain.Orders; using Grand.Domain.Shipping; using Grand.Infrastructure; using Shipping.FixedRateShipping.Models; +using Grand.Web.Common.Localization; namespace Shipping.FixedRateShipping; @@ -19,7 +19,7 @@ public class FixedRateShippingProvider : IShippingRateCalculationProvider private readonly ShippingFixedRateSettings _shippingFixedRateSettings; private readonly IShippingMethodService _shippingMethodService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; @@ -28,7 +28,7 @@ public FixedRateShippingProvider( IContextAccessor contextAccessor, ISettingService settingService, ICurrencyService currencyService, - ITranslationService translationService, + IRequestTranslationService translationService, ShippingFixedRateSettings shippingFixedRateSettings ) { diff --git a/src/Plugins/Shipping.ShippingPoint/Areas/Admin/Controllers/ShippingPointController.cs b/src/Plugins/Shipping.ShippingPoint/Areas/Admin/Controllers/ShippingPointController.cs index c6a0fcfa6c..1da9324954 100644 --- a/src/Plugins/Shipping.ShippingPoint/Areas/Admin/Controllers/ShippingPointController.cs +++ b/src/Plugins/Shipping.ShippingPoint/Areas/Admin/Controllers/ShippingPointController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Permissions; using Grand.Web.Common.Controllers; @@ -10,6 +9,7 @@ using Microsoft.AspNetCore.Mvc.Rendering; using Shipping.ShippingPoint.Models; using Shipping.ShippingPoint.Services; +using Grand.Web.Common.Localization; namespace Shipping.ShippingPoint.Areas.Admin.Controllers; @@ -21,10 +21,10 @@ public class ShippingPointController : BaseShippingController private readonly ICountryService _countryService; private readonly IShippingPointService _shippingPointService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public ShippingPointController( - ITranslationService translationService, + IRequestTranslationService translationService, IShippingPointService shippingPointService, ICountryService countryService, IStoreService storeService diff --git a/src/Plugins/Shipping.ShippingPoint/Areas/Store/Controllers/ShippingPointController.cs b/src/Plugins/Shipping.ShippingPoint/Areas/Store/Controllers/ShippingPointController.cs index fe39d11154..df50f2453e 100644 --- a/src/Plugins/Shipping.ShippingPoint/Areas/Store/Controllers/ShippingPointController.cs +++ b/src/Plugins/Shipping.ShippingPoint/Areas/Store/Controllers/ShippingPointController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Permissions; using Grand.Infrastructure; using Grand.Web.Common.Controllers; @@ -10,6 +9,7 @@ using Microsoft.AspNetCore.Mvc.Rendering; using Shipping.ShippingPoint.Models; using Shipping.ShippingPoint.Services; +using Grand.Web.Common.Localization; namespace Shipping.ShippingPoint.Areas.Store.Controllers; @@ -28,10 +28,10 @@ public class ShippingPointController : BaseController private readonly IContextAccessor _contextAccessor; private readonly ICountryService _countryService; private readonly IShippingPointService _shippingPointService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public ShippingPointController( - ITranslationService translationService, + IRequestTranslationService translationService, IShippingPointService shippingPointService, ICountryService countryService, IContextAccessor contextAccessor diff --git a/src/Plugins/Shipping.ShippingPoint/Controllers/SelectedShippingPointController.cs b/src/Plugins/Shipping.ShippingPoint/Controllers/SelectedShippingPointController.cs index 305f5d3b81..1a0f3b3f11 100644 --- a/src/Plugins/Shipping.ShippingPoint/Controllers/SelectedShippingPointController.cs +++ b/src/Plugins/Shipping.ShippingPoint/Controllers/SelectedShippingPointController.cs @@ -1,11 +1,11 @@ using Grand.Business.Core.Interfaces.Catalog.Prices; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Shipping.ShippingPoint.Models; using Shipping.ShippingPoint.Services; +using Grand.Web.Common.Localization; namespace Shipping.ShippingPoint.Controllers; @@ -15,7 +15,7 @@ public class SelectedShippingPointController : Controller private readonly ICurrencyService _currencyService; private readonly IPriceFormatter _priceFormatter; private readonly IShippingPointService _shippingPointService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; public SelectedShippingPointController( @@ -24,7 +24,7 @@ public SelectedShippingPointController( IPriceFormatter priceFormatter, IContextAccessor contextAccessor, ICurrencyService currencyService, - ITranslationService translationService) + IRequestTranslationService translationService) { _shippingPointService = shippingPointService; _countryService = countryService; diff --git a/src/Plugins/Shipping.ShippingPoint/ShippingPointRateProvider.cs b/src/Plugins/Shipping.ShippingPoint/ShippingPointRateProvider.cs index 8f270a70cf..612b8b08fa 100644 --- a/src/Plugins/Shipping.ShippingPoint/ShippingPointRateProvider.cs +++ b/src/Plugins/Shipping.ShippingPoint/ShippingPointRateProvider.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Enums.Checkout; using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Utilities.Checkout; using Grand.Domain.Common; @@ -12,6 +11,7 @@ using Shipping.ShippingPoint.Domain; using Shipping.ShippingPoint.Services; using System.Xml.Serialization; +using Grand.Web.Common.Localization; namespace Shipping.ShippingPoint; @@ -21,7 +21,7 @@ public class ShippingPointRateProvider : IShippingRateCalculationProvider public ShippingPointRateProvider( IShippingPointService shippingPointService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, ICustomerService customerService, ICountryService countryService, @@ -43,7 +43,7 @@ ShippingPointRateSettings shippingPointRateSettings #region Fields private readonly IShippingPointService _shippingPointService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; private readonly ICustomerService _customerService; private readonly ICountryService _countryService; diff --git a/src/Plugins/Shipping.ShippingPoint/Validators/ShippingPointValidator.cs b/src/Plugins/Shipping.ShippingPoint/Validators/ShippingPointValidator.cs index ffe6a936a0..19506b53e8 100644 --- a/src/Plugins/Shipping.ShippingPoint/Validators/ShippingPointValidator.cs +++ b/src/Plugins/Shipping.ShippingPoint/Validators/ShippingPointValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Shipping.ShippingPoint.Models; +using Grand.Web.Common.Localization; namespace Shipping.ShippingPoint.Validators; @@ -9,7 +9,7 @@ public class ShippingPointValidator : BaseGrandValidator { public ShippingPointValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.ShippingPointName).NotEmpty() diff --git a/src/Plugins/Tax.CountryStateZip/CountryStateZipTaxProvider.cs b/src/Plugins/Tax.CountryStateZip/CountryStateZipTaxProvider.cs index f584cb98e2..c442e17e23 100644 --- a/src/Plugins/Tax.CountryStateZip/CountryStateZipTaxProvider.cs +++ b/src/Plugins/Tax.CountryStateZip/CountryStateZipTaxProvider.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Tax; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Utilities.Catalog; using Grand.Infrastructure.Caching; using Tax.CountryStateZip.Infrastructure.Cache; using Tax.CountryStateZip.Services; +using Grand.Web.Common.Localization; namespace Tax.CountryStateZip; @@ -13,10 +13,10 @@ public class CountryStateZipTaxProvider : ITaxProvider private readonly CountryStateZipTaxSettings _countryStateZipTaxSettings; private readonly ITaxRateService _taxRateService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; - public CountryStateZipTaxProvider(ITranslationService translationService, + public CountryStateZipTaxProvider(IRequestTranslationService translationService, ICacheBase cacheBase, ITaxRateService taxRateService, CountryStateZipTaxSettings countryStateZipTaxSettings) diff --git a/src/Plugins/Tax.FixedRate/FixedRateTaxProvider.cs b/src/Plugins/Tax.FixedRate/FixedRateTaxProvider.cs index a4e49f3c11..aa7126c206 100644 --- a/src/Plugins/Tax.FixedRate/FixedRateTaxProvider.cs +++ b/src/Plugins/Tax.FixedRate/FixedRateTaxProvider.cs @@ -1,17 +1,17 @@ using Grand.Business.Core.Interfaces.Catalog.Tax; using Grand.Business.Core.Interfaces.Common.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Utilities.Catalog; using Tax.FixedRate.Models; +using Grand.Web.Common.Localization; namespace Tax.FixedRate; public class FixedRateTaxProvider : ITaxProvider { private readonly ISettingService _settingService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; - public FixedRateTaxProvider(ISettingService settingService, ITranslationService translationService) + public FixedRateTaxProvider(ISettingService settingService, IRequestTranslationService translationService) { _settingService = settingService; _translationService = translationService; diff --git a/src/Plugins/Widgets.FacebookPixel/Areas/Admin/Controllers/WidgetsFacebookPixelController.cs b/src/Plugins/Widgets.FacebookPixel/Areas/Admin/Controllers/WidgetsFacebookPixelController.cs index 1cf9b0528f..84a4b52c07 100644 --- a/src/Plugins/Widgets.FacebookPixel/Areas/Admin/Controllers/WidgetsFacebookPixelController.cs +++ b/src/Plugins/Widgets.FacebookPixel/Areas/Admin/Controllers/WidgetsFacebookPixelController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Permissions; using Grand.Web.Common.Controllers; using Grand.Web.Common.Filters; @@ -7,6 +6,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Widgets.FacebookPixel.Models; +using Grand.Web.Common.Localization; namespace Widgets.FacebookPixel.Areas.Admin.Controllers; @@ -14,11 +14,11 @@ namespace Widgets.FacebookPixel.Areas.Admin.Controllers; public class WidgetsFacebookPixelController : BaseAdminPluginController { private readonly ISettingService _settingService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IAdminStoreService _adminStoreService; public WidgetsFacebookPixelController( ISettingService settingService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminStoreService adminStoreService) { _settingService = settingService; diff --git a/src/Plugins/Widgets.FacebookPixel/FacebookPixelProvider.cs b/src/Plugins/Widgets.FacebookPixel/FacebookPixelProvider.cs index d132728a4b..f1f7d9cfa2 100644 --- a/src/Plugins/Widgets.FacebookPixel/FacebookPixelProvider.cs +++ b/src/Plugins/Widgets.FacebookPixel/FacebookPixelProvider.cs @@ -1,16 +1,16 @@ using Grand.Business.Core.Interfaces.Cms; -using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Web.Common.Localization; namespace Widgets.FacebookPixel; public class FacebookPixelProvider : IWidgetProvider { private readonly FacebookPixelSettings _facebookPixelSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public FacebookPixelProvider( FacebookPixelSettings facebookPixelSettings, - ITranslationService translationService) + IRequestTranslationService translationService) { _facebookPixelSettings = facebookPixelSettings; _translationService = translationService; diff --git a/src/Plugins/Widgets.GoogleAnalytics/Areas/Admin/Controllers/WidgetsGoogleAnalyticsController.cs b/src/Plugins/Widgets.GoogleAnalytics/Areas/Admin/Controllers/WidgetsGoogleAnalyticsController.cs index a76e25c023..6c546dd292 100644 --- a/src/Plugins/Widgets.GoogleAnalytics/Areas/Admin/Controllers/WidgetsGoogleAnalyticsController.cs +++ b/src/Plugins/Widgets.GoogleAnalytics/Areas/Admin/Controllers/WidgetsGoogleAnalyticsController.cs @@ -1,11 +1,11 @@ using Grand.Business.Core.Interfaces.Common.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Permissions; using Grand.Web.Common.Controllers; using Grand.Web.Common.Helpers; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Widgets.GoogleAnalytics.Models; +using Grand.Web.Common.Localization; namespace Widgets.GoogleAnalytics.Areas.Admin.Controllers; @@ -13,12 +13,12 @@ namespace Widgets.GoogleAnalytics.Areas.Admin.Controllers; public class WidgetsGoogleAnalyticsController : BaseAdminPluginController { private readonly ISettingService _settingService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IAdminStoreService _adminStoreService; public WidgetsGoogleAnalyticsController( ISettingService settingService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminStoreService adminStoreService) { _settingService = settingService; diff --git a/src/Plugins/Widgets.GoogleAnalytics/GoogleAnalyticProvider.cs b/src/Plugins/Widgets.GoogleAnalytics/GoogleAnalyticProvider.cs index a8a1bef975..d87e2d9360 100644 --- a/src/Plugins/Widgets.GoogleAnalytics/GoogleAnalyticProvider.cs +++ b/src/Plugins/Widgets.GoogleAnalytics/GoogleAnalyticProvider.cs @@ -1,5 +1,5 @@ using Grand.Business.Core.Interfaces.Cms; -using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Web.Common.Localization; namespace Widgets.GoogleAnalytics; @@ -9,10 +9,10 @@ namespace Widgets.GoogleAnalytics; public class GoogleAnalyticProvider : IWidgetProvider { private readonly GoogleAnalyticsEcommerceSettings _googleAnalyticsEcommerceSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public GoogleAnalyticProvider( - ITranslationService translationService, + IRequestTranslationService translationService, GoogleAnalyticsEcommerceSettings googleAnalyticsEcommerceSettings) { _translationService = translationService; diff --git a/src/Plugins/Widgets.Slider/Areas/Admin/Controllers/WidgetsSliderController.cs b/src/Plugins/Widgets.Slider/Areas/Admin/Controllers/WidgetsSliderController.cs index cab4a79473..d6ebe71c6c 100644 --- a/src/Plugins/Widgets.Slider/Areas/Admin/Controllers/WidgetsSliderController.cs +++ b/src/Plugins/Widgets.Slider/Areas/Admin/Controllers/WidgetsSliderController.cs @@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Mvc; using Widgets.Slider.Models; using Widgets.Slider.Services; +using Grand.Web.Common.Localization; namespace Widgets.Slider.Areas.Admin.Controllers; @@ -23,11 +24,11 @@ public class WidgetsSliderController : BaseAdminPluginController private readonly ISettingService _settingService; private readonly ISliderService _sliderService; private readonly SliderWidgetSettings _sliderWidgetSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public WidgetsSliderController( IPictureService pictureService, - ITranslationService translationService, + IRequestTranslationService translationService, ISliderService sliderService, ILanguageService languageService, ISettingService settingService, diff --git a/src/Plugins/Widgets.Slider/SliderWidgetProvider.cs b/src/Plugins/Widgets.Slider/SliderWidgetProvider.cs index 65706a61b7..4c48c34b8c 100644 --- a/src/Plugins/Widgets.Slider/SliderWidgetProvider.cs +++ b/src/Plugins/Widgets.Slider/SliderWidgetProvider.cs @@ -1,14 +1,14 @@ using Grand.Business.Core.Interfaces.Cms; -using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Web.Common.Localization; namespace Widgets.Slider; public class SliderWidgetProvider : IWidgetProvider { private readonly SliderWidgetSettings _sliderWidgetSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; - public SliderWidgetProvider(ITranslationService translationService, SliderWidgetSettings sliderWidgetSettings) + public SliderWidgetProvider(IRequestTranslationService translationService, SliderWidgetSettings sliderWidgetSettings) { _translationService = translationService; _sliderWidgetSettings = sliderWidgetSettings; diff --git a/src/Plugins/Widgets.Slider/Validators/SlideValidator.cs b/src/Plugins/Widgets.Slider/Validators/SlideValidator.cs index 3a4a705122..47dd30eba6 100644 --- a/src/Plugins/Widgets.Slider/Validators/SlideValidator.cs +++ b/src/Plugins/Widgets.Slider/Validators/SlideValidator.cs @@ -1,15 +1,15 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Widgets.Slider.Domain; using Widgets.Slider.Models; +using Grand.Web.Common.Localization; namespace Widgets.Slider.Validators; public class SliderValidator : BaseGrandValidator { public SliderValidator(IEnumerable> validators, - ITranslationService translationService) : base(validators) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("Widgets.Slider.Name.Required")); RuleFor(x => x.SliderTypeId == (int)SliderType.Category && string.IsNullOrEmpty(x.CategoryId)).Equal(false) diff --git a/src/Tests/Grand.Business.Common.Tests/Services/Localization/TranslationServiceTests.cs b/src/Tests/Grand.Business.Common.Tests/Services/Localization/TranslationServiceTests.cs index 194d638f16..d4731b9abc 100644 --- a/src/Tests/Grand.Business.Common.Tests/Services/Localization/TranslationServiceTests.cs +++ b/src/Tests/Grand.Business.Common.Tests/Services/Localization/TranslationServiceTests.cs @@ -1,10 +1,7 @@ using Grand.Business.Common.Services.Localization; using Grand.Data; using Grand.Data.Tests.MongoDb; -using Grand.Domain.Customers; using Grand.Domain.Localization; -using Grand.Domain.Stores; -using Grand.Infrastructure; using Grand.Mediator; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -18,7 +15,6 @@ public class TranslationServiceTests private IRepository _repository; private TranslationService _translationService; - private Mock _workContextMock; [TestInitialize] public void Init() @@ -26,12 +22,7 @@ public void Init() _repository = new MongoDBRepositoryTest(); _mediatorMock = new Mock(); - _workContextMock = new Mock(); - _workContextMock.Setup(c => c.StoreContext.CurrentStore).Returns(() => new Store()); - _workContextMock.Setup(c => c.WorkContext.CurrentCustomer).Returns(() => new Customer()); - _workContextMock.Setup(c => c.WorkContext.WorkingLanguage).Returns(() => new Language { Id = "1" }); - - _translationService = new TranslationService(_workContextMock.Object, _repository, _mediatorMock.Object); + _translationService = new TranslationService(_repository, _mediatorMock.Object); } [TestMethod] @@ -137,7 +128,7 @@ await _translationService.InsertTranslateResource(new TranslationResource { Name = "name3", Value = "value3", LanguageId = "2" }); //Act - var result = _translationService.GetResource("name1"); + var result = _translationService.GetResource("name1", "1"); //Assert Assert.AreEqual("value1", result); @@ -174,8 +165,6 @@ await _translationService.ImportResourcesFromXml(new Language { Id = "1", Name = [TestMethod] public async Task ImportResourcesFromXml_WithoutCurrentCustomer_InsertsResources() { - //Arrange - no customer, as outside a request - _workContextMock.Setup(c => c.WorkContext.CurrentCustomer).Returns(() => null); //Act await _translationService.ImportResourcesFromXml(new Language { Id = "1", Name = "en" }, "value2"); diff --git a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeParserTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeParserTests.cs index 9b05b71671..b3d91f4c87 100644 --- a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeParserTests.cs +++ b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerAttributeParserTests.cs @@ -1,5 +1,4 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Business.Core.Interfaces.Customers; +using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Customers.Services; using Grand.Domain.Catalog; using Grand.Domain.Common; @@ -22,11 +21,6 @@ public class CustomerAttributeParserTests public void Init() { _customerAtrServiceMock = new Mock(); - var _translationServiceMock = new Mock(); - { - _translationServiceMock.Setup(x => x.GetResource(It.IsAny())).Returns("Warning{0}"); - } - _parser = new CustomerAttributeParser(_customerAtrServiceMock.Object); customAtr = [ new CustomAttribute { Key = "key1", Value = "value1" }, diff --git a/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactAttributeParserTests.cs b/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactAttributeParserTests.cs index 14064ad672..6630be0520 100644 --- a/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactAttributeParserTests.cs +++ b/src/Tests/Grand.Business.Marketing.Tests/Services/Contacts/ContactAttributeParserTests.cs @@ -1,5 +1,4 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Business.Core.Interfaces.Marketing.Contacts; +using Grand.Business.Core.Interfaces.Marketing.Contacts; using Grand.Business.Core.Utilities.Catalog; using Grand.Business.Marketing.Services.Contacts; using Grand.Domain.Catalog; @@ -25,11 +24,6 @@ public class ContactAttributeParserTests public void Init() { _contactAttributeServiceMock = new Mock(); - var _translationServiceMock = new Mock(); - { - _translationServiceMock.Setup(x => x.GetResource(It.IsAny())).Returns("Warning{0}"); - } - _parser = new ContactAttributeParser(_contactAttributeServiceMock.Object); customAtr = [ new CustomAttribute { Key = "key1", Value = "value1" }, diff --git a/src/Tests/Grand.Modules.Tests/Plugins/Payments/BrainTreePaymentProviderTests.cs b/src/Tests/Grand.Modules.Tests/Plugins/Payments/BrainTreePaymentProviderTests.cs index be98bd1fdc..0dccadfd09 100644 --- a/src/Tests/Grand.Modules.Tests/Plugins/Payments/BrainTreePaymentProviderTests.cs +++ b/src/Tests/Grand.Modules.Tests/Plugins/Payments/BrainTreePaymentProviderTests.cs @@ -12,6 +12,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Payments.BrainTree; +using Grand.Web.Common.Localization; namespace Grand.Modules.Tests.Plugins.Payments; @@ -37,6 +38,7 @@ public void Init() var services = new ServiceCollection(); services.AddSingleton(_settings); services.AddSingleton(Mock.Of()); + services.AddSingleton(Mock.Of()); services.AddSingleton(Mock.Of()); //the card form lives in the session, but no request is running here: HttpContext is null services.AddSingleton(new HttpContextAccessor()); diff --git a/src/Tests/Grand.Modules.Tests/Plugins/Payments/CashOnDeliveryPaymentProviderTests.cs b/src/Tests/Grand.Modules.Tests/Plugins/Payments/CashOnDeliveryPaymentProviderTests.cs index 8edd9bca68..ba8520f497 100644 --- a/src/Tests/Grand.Modules.Tests/Plugins/Payments/CashOnDeliveryPaymentProviderTests.cs +++ b/src/Tests/Grand.Modules.Tests/Plugins/Payments/CashOnDeliveryPaymentProviderTests.cs @@ -12,6 +12,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Payments.CashOnDelivery; +using Grand.Web.Common.Localization; namespace Grand.Modules.Tests.Plugins.Payments; @@ -41,6 +42,7 @@ public void Init() var services = new ServiceCollection(); services.AddSingleton(_settings); services.AddSingleton(Mock.Of()); + services.AddSingleton(Mock.Of()); services.AddSingleton(_subTotalService.Object); services.AddSingleton(_currencyService.Object); services.AddSingleton(_paymentTransactionService.Object); diff --git a/src/Tests/Grand.Modules.Tests/Plugins/PluginDependencyCycleTests.cs b/src/Tests/Grand.Modules.Tests/Plugins/PluginDependencyCycleTests.cs index ce46aa14fe..e1fd739670 100644 --- a/src/Tests/Grand.Modules.Tests/Plugins/PluginDependencyCycleTests.cs +++ b/src/Tests/Grand.Modules.Tests/Plugins/PluginDependencyCycleTests.cs @@ -39,6 +39,7 @@ using Payments.CashOnDelivery; using Shipping.ByWeight; using Shipping.ByWeight.Services; +using Grand.Web.Common.Localization; namespace Grand.Modules.Tests.Plugins; @@ -76,7 +77,7 @@ public void PaymentProviders_DoNotDependBackOnOrderCalculation() typeof(IShippingService), typeof(ICheckoutAttributeParser), typeof(IDiscountService), typeof(IGiftVoucherService), typeof(ILoyaltyPointsService), typeof(IProductService), typeof(ICurrencyService), typeof(IGroupService), typeof(IDiscountValidationService), - typeof(ISettingService), typeof(ITranslationService), typeof(IPaymentTransactionService), + typeof(ISettingService), typeof(ITranslationService), typeof(IRequestTranslationService), typeof(IPaymentTransactionService), typeof(ICustomerService), typeof(IHttpContextAccessor)); services.AddSingleton(new TaxSettings()); services.AddSingleton(new LoyaltyPointsSettings()); @@ -106,7 +107,7 @@ public void StandardDiscountRules_DoNotDependBackOnPricing() AddMocks(services, typeof(IContextAccessor), typeof(IProductService), typeof(IMediator), typeof(ICurrencyService), typeof(IDiscountService), typeof(ICategoryService), typeof(IBrandService), typeof(ICollectionService), typeof(IVendorService), typeof(IRepository), - typeof(IOrderService), typeof(ITranslationService)); + typeof(IOrderService), typeof(ITranslationService), typeof(IRequestTranslationService)); services.AddSingleton(new ShoppingCartSettings()); services.AddSingleton(new CatalogSettings()); @@ -134,7 +135,7 @@ public void ShippingProviders_DoNotDependBackOnShipping() typeof(IContextAccessor), typeof(IProductService), typeof(IMediator), typeof(ICurrencyService), typeof(IDiscountService), typeof(ICategoryService), typeof(IBrandService), typeof(ICollectionService), typeof(IVendorService), typeof(IRepository), typeof(IOrderService), - typeof(ITranslationService)); + typeof(ITranslationService), typeof(IRequestTranslationService)); services.AddSingleton(new ShippingProviderSettings()); services.AddSingleton(new ShippingSettings()); services.AddSingleton(new ByWeightShippingSettings()); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseAddressAttributeControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseAddressAttributeControllerTests.cs index 3f49a32fcd..129a8225aa 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseAddressAttributeControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseAddressAttributeControllerTests.cs @@ -16,6 +16,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -28,7 +29,7 @@ private class TestAddressAttributeController( IAddressAttributeService addressAttributeService, IAddressAttributeViewModelService addressAttributeViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseAddressAttributeController(addressAttributeService, addressAttributeViewModelService, languageService, translationService, scope); @@ -46,7 +47,7 @@ public void Setup() _scope = new Mock>(); _sut = new TestAddressAttributeController( _service.Object, _vmService.Object, - Mock.Of(), Mock.Of(), _scope.Object); + Mock.Of(), Mock.Of(), _scope.Object); var httpContext = new DefaultHttpContext(); var loggerFactoryMock = new Mock(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseBlogControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseBlogControllerTests.cs index 7a7346c5e3..ab7a4ed117 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseBlogControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseBlogControllerTests.cs @@ -19,6 +19,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -29,7 +30,7 @@ private class TestBlogController( IBlogService blogService, IBlogViewModelService blogViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IDateTimeService dateTimeService, IPictureViewModelService pictureViewModelService, @@ -42,7 +43,7 @@ private class TestBlogController( private TestBlogController _controller; private Mock _blogServiceMock; private Mock _blogViewModelServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock> _postScopeMock; private Mock> _categoryScopeMock; @@ -58,7 +59,7 @@ public void Setup() _blogServiceMock = new Mock(); _blogViewModelServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _postScopeMock = new Mock>(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseBrandControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseBrandControllerTests.cs index 6f08b301f4..6f7f809ab6 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseBrandControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseBrandControllerTests.cs @@ -19,6 +19,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -34,7 +35,7 @@ private class TestBrandController( IBrandService brandService, IStoreService storeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IPictureViewModelService pictureViewModelService, IAdminDataScope scope) : BaseBrandController(brandViewModelService, brandService, storeService, languageService, @@ -44,7 +45,7 @@ private class TestBrandController( private Mock _brandServiceMock; private Mock _brandViewModelServiceMock; private Mock _storeServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock> _scopeMock; [TestInitialize] @@ -57,7 +58,7 @@ public void Setup() _brandViewModelServiceMock = new Mock(); _storeServiceMock = new Mock(); _storeServiceMock.Setup(s => s.GetAllStores()).ReturnsAsync(new List()); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _scopeMock = new Mock>(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCategoryControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCategoryControllerTests.cs index e516ff43ac..1e678e971e 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCategoryControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCategoryControllerTests.cs @@ -18,6 +18,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -31,7 +32,7 @@ private class TestCategoryController( ICategoryService categoryService, ICategoryViewModelService categoryViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IPictureViewModelService pictureViewModelService, IProductService productService, IAdminDataScope scope) @@ -41,7 +42,7 @@ private class TestCategoryController( private TestCategoryController _controller; private Mock _categoryServiceMock; private Mock _categoryViewModelServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock> _scopeMock; [TestInitialize] @@ -52,7 +53,7 @@ public void Setup() _categoryServiceMock = new Mock(); _categoryViewModelServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _scopeMock = new Mock>(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCheckoutAttributeControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCheckoutAttributeControllerTests.cs index a3f5c98ca5..9779338ea3 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCheckoutAttributeControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCheckoutAttributeControllerTests.cs @@ -17,6 +17,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -28,7 +29,7 @@ public class BaseCheckoutAttributeControllerTests private class TestCheckoutAttributeController( ICheckoutAttributeService checkoutAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, ICurrencyService currencyService, CurrencySettings currencySettings, IMeasureService measureService, @@ -51,7 +52,7 @@ public void Setup() _vmService = new Mock(); _scope = new Mock>(); _sut = new TestCheckoutAttributeController(_service.Object, Mock.Of(), - Mock.Of(), Mock.Of(), new CurrencySettings(), + Mock.Of(), Mock.Of(), new CurrencySettings(), Mock.Of(), new MeasureSettings(), _vmService.Object, _scope.Object); var httpContext = new DefaultHttpContext(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCollectionControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCollectionControllerTests.cs index 3f67b8c6fd..a618e0f713 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCollectionControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCollectionControllerTests.cs @@ -19,6 +19,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -33,7 +34,7 @@ private class TestCollectionController( ICollectionService collectionService, IStoreService storeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IPictureViewModelService pictureViewModelService, IProductService productService, IAdminDataScope scope) @@ -44,7 +45,7 @@ private class TestCollectionController( private Mock _collectionServiceMock; private Mock _collectionViewModelServiceMock; private Mock _storeServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock> _scopeMock; [TestInitialize] @@ -57,7 +58,7 @@ public void Setup() _collectionViewModelServiceMock = new Mock(); _storeServiceMock = new Mock(); _storeServiceMock.Setup(s => s.GetAllStores()).ReturnsAsync(new List()); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _scopeMock = new Mock>(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseContactAttributeControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseContactAttributeControllerTests.cs index 1eb18d09de..a26850a3ce 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseContactAttributeControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseContactAttributeControllerTests.cs @@ -18,6 +18,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -30,7 +31,7 @@ private class TestContactAttributeController( IContactAttributeViewModelService contactAttributeViewModelService, IContactAttributeService contactAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseContactAttributeController(contactAttributeViewModelService, contactAttributeService, languageService, translationService, scope); @@ -52,7 +53,7 @@ public void Setup() var languageServiceMock = new Mock(); languageServiceMock.Setup(l => l.GetAllLanguages(true, It.IsAny())).ReturnsAsync(new List()); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _sut = new TestContactAttributeController( diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCustomerAttributeControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCustomerAttributeControllerTests.cs index e5c99cd36c..ff4ecf3470 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCustomerAttributeControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCustomerAttributeControllerTests.cs @@ -13,6 +13,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -25,7 +26,7 @@ private class TestCustomerAttributeController( ICustomerAttributeService customerAttributeService, ICustomerAttributeViewModelService customerAttributeViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseCustomerAttributeController(customerAttributeService, customerAttributeViewModelService, languageService, translationService, scope); @@ -42,7 +43,7 @@ public void Setup() _vmService = new Mock(); _scope = new Mock>(); _sut = new TestCustomerAttributeController(_service.Object, _vmService.Object, - Mock.Of(), Mock.Of(), _scope.Object); + Mock.Of(), Mock.Of(), _scope.Object); var httpContext = new DefaultHttpContext(); var loggerFactoryMock = new Mock(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCustomerControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCustomerControllerTests.cs index 7e991cee59..ed51c59742 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCustomerControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCustomerControllerTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Common.Addresses; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Marketing.Customers; @@ -20,6 +19,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -43,7 +43,7 @@ protected class TestCustomerController( IAddressAttributeService addressAttributeService, Grand.Business.Core.Interfaces.Messages.IMessageProviderService messageProviderService, IGroupService groupService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, CustomerSettings customerSettings, IAdminDataScope scope) @@ -62,7 +62,7 @@ protected class TestCustomerController( protected Mock CustomerManagerServiceMock; protected Mock GroupServiceMock; protected Mock> ScopeMock; - protected Mock TranslationServiceMock; + protected Mock TranslationServiceMock; protected Mock AddressAttributeServiceMock; protected Mock ProductReviewServiceMock; protected Mock CustomerProductServiceMock; @@ -76,7 +76,7 @@ public void Setup() GroupServiceMock = new Mock(); ScopeMock = new Mock>(); ScopeMock.Setup(s => s.DefaultStoreId).Returns((string)null); - TranslationServiceMock = new Mock(); + TranslationServiceMock = new Mock(); TranslationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); AddressAttributeServiceMock = new Mock(); AddressAttributeServiceMock.Setup(a => a.GetAllAddressAttributes()) diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCustomerManagementControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCustomerManagementControllerTests.cs index ef46e86325..184df6ed7e 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCustomerManagementControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseCustomerManagementControllerTests.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Addresses; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.ExportImport; @@ -21,6 +20,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -34,7 +34,7 @@ private class TestManagementController( IProductViewModelService productViewModelService, ICustomerAttributeParser customerAttributeParser, ICustomerAttributeService customerAttributeService, IAddressAttributeParser addressAttributeParser, IAddressAttributeService addressAttributeService, IMessageProviderService messageProviderService, - IGroupService groupService, ITranslationService translationService, IContextAccessor contextAccessor, + IGroupService groupService, IRequestTranslationService translationService, IContextAccessor contextAccessor, CustomerSettings customerSettings, IAdminDataScope scope, IPermissionService permissionService, IExportManager exportManager) : BaseCustomerManagementController(customerService, customerViewModelService, customerManagerService, @@ -66,7 +66,7 @@ public void Setup() var scopeMock = new Mock>(); scopeMock.Setup(s => s.HasAccess(It.IsAny())).ReturnsAsync(true); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _controller = new TestManagementController(_customerServiceMock.Object, diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseDeliveryDateControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseDeliveryDateControllerTests.cs index 096d206a46..d5865e20d5 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseDeliveryDateControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseDeliveryDateControllerTests.cs @@ -15,6 +15,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using DeliveryDate = Grand.Domain.Shipping.DeliveryDate; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -24,7 +25,7 @@ public class BaseDeliveryDateControllerTests private Mock _deliveryDateServiceMock; private Mock _languageServiceMock; private Mock _storeServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; [TestInitialize] public void Setup() @@ -38,7 +39,7 @@ public void Setup() .ReturnsAsync(new List()); _storeServiceMock = new Mock(); _storeServiceMock.Setup(s => s.GetAllStores()).ReturnsAsync(new List()); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("msg"); } diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseDiscountControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseDiscountControllerTests.cs index 5e8a751517..6360237765 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseDiscountControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseDiscountControllerTests.cs @@ -6,7 +6,6 @@ using Grand.Business.Core.Interfaces.Catalog.Discounts; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Queries.Catalog; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain; @@ -30,6 +29,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -40,7 +40,7 @@ public class BaseDiscountControllerTests private class TestDiscountController( IDiscountViewModelService discountViewModelService, IDiscountService discountService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, IMediator mediator, IDiscountProviderLoader discountProviderLoader, @@ -67,7 +67,7 @@ public void Setup() _mediator = new Mock(); _loader = new Mock(); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _sut = new TestDiscountController(_vmService.Object, _service.Object, diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseEmailAccountControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseEmailAccountControllerTests.cs index b007b83a04..b00731a298 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseEmailAccountControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseEmailAccountControllerTests.cs @@ -1,6 +1,5 @@ #nullable enable -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Messages; using Grand.Domain.Messages; using Grand.Infrastructure.Mapper; @@ -17,6 +16,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -28,13 +28,13 @@ public class BaseEmailAccountControllerTests private class TestEmailAccountController( IEmailAccountViewModelService emailAccountViewModelService, IEmailAccountService emailAccountService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseEmailAccountController(emailAccountViewModelService, emailAccountService, translationService, scope); private Mock _emailAccountViewModelServiceMock = null!; private Mock _emailAccountServiceMock = null!; - private Mock _translationServiceMock = null!; + private Mock _translationServiceMock = null!; [TestInitialize] public void Setup() @@ -44,7 +44,7 @@ public void Setup() _emailAccountViewModelServiceMock = new Mock(); _emailAccountServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns((string s) => s); } diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseFullReportsControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseFullReportsControllerTests.cs index 977bbd6e19..fd1e32db62 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseFullReportsControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseFullReportsControllerTests.cs @@ -5,7 +5,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; @@ -43,7 +42,7 @@ private class TestFullReportsController( IProductService productService, IProductAttributeFormatter productAttributeFormatter, IStockQuantityService stockQuantityService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, ICountryService countryService, IVendorService vendorService, @@ -82,7 +81,7 @@ public void Setup() var productServiceMock = new Mock(); var productAttributeFormatterMock = new Mock(); var stockQuantityServiceMock = new Mock(); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); var storeServiceMock = new Mock(); var countryServiceMock = new Mock(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseGiftVoucherControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseGiftVoucherControllerTests.cs index 3559e6023f..a5666e89e8 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseGiftVoucherControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseGiftVoucherControllerTests.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Checkout.GiftVouchers; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Orders; using Grand.Web.AdminShared.Controllers; using Grand.Web.AdminShared.Interfaces; @@ -12,6 +11,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -20,13 +20,13 @@ public class BaseGiftVoucherControllerTests { private Mock _viewModelService; private Mock _giftVoucherService; - private Mock _translationService; + private Mock _translationService; private Mock> _scope; private class TestableGiftVoucherController( IGiftVoucherViewModelService viewModelService, IGiftVoucherService giftVoucherService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseGiftVoucherController(viewModelService, giftVoucherService, translationService, scope); @@ -56,7 +56,7 @@ public void Setup() { _viewModelService = new Mock(); _giftVoucherService = new Mock(); - _translationService = new Mock(); + _translationService = new Mock(); _scope = new Mock>(); } diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseHomeControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseHomeControllerTests.cs index 598343998d..fb0ec3e74d 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseHomeControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseHomeControllerTests.cs @@ -15,6 +15,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -23,7 +24,7 @@ public class BaseHomeControllerTests { private class TestHomeController( ICountryService countryService, - ITranslationService translationService, + IRequestTranslationService translationService, string selectStateKey, string logoutRoute) : BaseHomeController(countryService, translationService) @@ -34,7 +35,7 @@ private class TestHomeController( private class TestHomeControllerWithSetLanguage( ICountryService countryService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, string selectStateKey, string logoutRoute, @@ -47,13 +48,13 @@ private class TestHomeControllerWithSetLanguage( } private Mock _countryServiceMock = null!; - private Mock _translationServiceMock = null!; + private Mock _translationServiceMock = null!; [TestInitialize] public void Setup() { _countryServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns((string key) => key); } diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseMerchandiseReturnControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseMerchandiseReturnControllerTests.cs index 61af29ac46..22d003fa85 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseMerchandiseReturnControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseMerchandiseReturnControllerTests.cs @@ -2,7 +2,6 @@ extern alias VendorHost; using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Customers; using Grand.Domain.Orders; using Grand.Domain.Vendors; @@ -19,6 +18,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -30,7 +30,7 @@ public class BaseMerchandiseReturnControllerTests // own override is tested separately in Task 8's tests. protected class TestMerchandiseReturnController( IMerchandiseReturnViewModelService merchandiseReturnViewModelService, - ITranslationService translationService, + IRequestTranslationService translationService, IMerchandiseReturnService merchandiseReturnService, IOrderService orderService, IAdminDataScope scope) @@ -52,7 +52,7 @@ public void Setup() _scopeMock = new Mock>(); _scopeMock.Setup(s => s.DefaultStoreId).Returns((string)null); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _controller = new TestMerchandiseReturnController( @@ -550,7 +550,7 @@ public async Task NotesSelect_NotFoundOrDenied_StoreSubclass_ReturnsEmptyContent { var storeController = new StoreHost::Grand.Web.Store.Controllers.MerchandiseReturnController( _merchandiseReturnViewModelServiceMock.Object, - new Mock().Object, + new Mock().Object, _merchandiseReturnServiceMock.Object, _orderServiceMock.Object, _scopeMock.Object); @@ -571,7 +571,7 @@ public async Task Delete_RealGlobalAdminScope_AlwaysAllows() { var realScope = new GlobalAdminDataScope(); var controller = new TestMerchandiseReturnController(_merchandiseReturnViewModelServiceMock.Object, - new Mock().Object, _merchandiseReturnServiceMock.Object, _orderServiceMock.Object, realScope); + new Mock().Object, _merchandiseReturnServiceMock.Object, _orderServiceMock.Object, realScope); controller.ControllerContext = _controller.ControllerContext; controller.TempData = _controller.TempData; var entity = new MerchandiseReturn { Id = "mr1", StoreId = "any-store", VendorId = "any-vendor", SeId = "any-se" }; @@ -593,7 +593,7 @@ public async Task Delete_RealStoreScope_DeniesCrossStoreEntity() var realScope = new StoreMerchandiseReturnDataScope(contextAccessorMock.Object); var controller = new TestMerchandiseReturnController(_merchandiseReturnViewModelServiceMock.Object, - new Mock().Object, _merchandiseReturnServiceMock.Object, _orderServiceMock.Object, realScope); + new Mock().Object, _merchandiseReturnServiceMock.Object, _orderServiceMock.Object, realScope); controller.ControllerContext = _controller.ControllerContext; controller.TempData = _controller.TempData; var entity = new MerchandiseReturn { Id = "mr1", StoreId = "store-2" }; @@ -615,7 +615,7 @@ public async Task Delete_RealVendorScope_DeniesCrossVendorEntity() var realScope = new VendorMerchandiseReturnDataScope(contextAccessorMock.Object); var controller = new TestMerchandiseReturnController(_merchandiseReturnViewModelServiceMock.Object, - new Mock().Object, _merchandiseReturnServiceMock.Object, _orderServiceMock.Object, realScope); + new Mock().Object, _merchandiseReturnServiceMock.Object, _orderServiceMock.Object, realScope); controller.ControllerContext = _controller.ControllerContext; controller.TempData = _controller.TempData; var entity = new MerchandiseReturn { Id = "mr1", VendorId = "vendor-B" }; @@ -637,7 +637,7 @@ public async Task GoToId_RealStoreScope_PositiveControl_OwnStoreEntityResolves() var realScope = new StoreMerchandiseReturnDataScope(contextAccessorMock.Object); var controller = new TestMerchandiseReturnController(_merchandiseReturnViewModelServiceMock.Object, - new Mock().Object, _merchandiseReturnServiceMock.Object, _orderServiceMock.Object, realScope); + new Mock().Object, _merchandiseReturnServiceMock.Object, _orderServiceMock.Object, realScope); controller.ControllerContext = _controller.ControllerContext; controller.TempData = _controller.TempData; var entity = new MerchandiseReturn { Id = "mr1", StoreId = "store-1" }; diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseMessageTemplateControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseMessageTemplateControllerTests.cs index 877ad69813..46c9d3e7f0 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseMessageTemplateControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseMessageTemplateControllerTests.cs @@ -16,6 +16,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -25,7 +26,7 @@ public class BaseMessageTemplateControllerTests private Mock _messageTemplateService; private Mock _emailAccountService; private Mock _languageService; - private Mock _translationService; + private Mock _translationService; private Mock _messageTokenProvider; private Mock _downloadService; private Mock> _scope; @@ -35,7 +36,7 @@ private class TestableMessageTemplateController( IMessageTemplateService messageTemplateService, IEmailAccountService emailAccountService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IMessageTokenProvider messageTokenProvider, IDownloadService downloadService, IAdminDataScope scope, @@ -73,7 +74,7 @@ public void Setup() _messageTemplateService = new Mock(); _emailAccountService = new Mock(); _languageService = new Mock(); - _translationService = new Mock(); + _translationService = new Mock(); _messageTokenProvider = new Mock(); _downloadService = new Mock(); _scope = new Mock>(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseNewsControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseNewsControllerTests.cs index b8877e66be..e49c04221a 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseNewsControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseNewsControllerTests.cs @@ -18,6 +18,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -28,7 +29,7 @@ private class TestNewsController( INewsViewModelService newsViewModelService, INewsService newsService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IDateTimeService dateTimeService, IAdminDataScope scope) @@ -38,7 +39,7 @@ private class TestNewsController( private TestNewsController _controller; private Mock _newsViewModelServiceMock; private Mock _newsServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock> _scopeMock; [TestInitialize] @@ -49,7 +50,7 @@ public void Setup() _newsViewModelServiceMock = new Mock(); _newsServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _scopeMock = new Mock>(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseOnlineCustomerControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseOnlineCustomerControllerTests.cs index daab348d21..2550285011 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseOnlineCustomerControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseOnlineCustomerControllerTests.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain; using Grand.Domain.Customers; @@ -10,6 +9,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -24,7 +24,7 @@ private class TestOnlineCustomerController( ICustomerService customerService, IDateTimeService dateTimeService, CustomerSettings customerSettings, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor) : BaseOnlineCustomerController(customerService, dateTimeService, customerSettings, translationService, contextAccessor) { @@ -34,7 +34,7 @@ private class TestOnlineCustomerController( private Mock _customerServiceMock = null!; private Mock _dateTimeServiceMock = null!; - private Mock _translationServiceMock = null!; + private Mock _translationServiceMock = null!; private Mock _contextAccessorMock = null!; private CustomerSettings _customerSettings = null!; @@ -46,7 +46,7 @@ public void Setup() _dateTimeServiceMock .Setup(d => d.ConvertToUserTime(It.IsAny(), It.IsAny())) .Returns((DateTime dt, DateTimeKind _) => dt); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns((string s) => s); _customerSettings = new CustomerSettings { OnlineCustomerMinutes = 20, StoreLastVisitedPage = true }; diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseOrderControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseOrderControllerTests.cs index 988bc2e7f7..f24a1ecf29 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseOrderControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseOrderControllerTests.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Pdf; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain.Localization; @@ -16,6 +15,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -26,7 +26,7 @@ public class BaseOrderControllerTests private class TestOrderController( IOrderViewModelService orderViewModelService, IOrderService orderService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IPdfService pdfService, IAdminDataScope scope) @@ -52,7 +52,7 @@ public void Setup() _scopeMock.Setup(s => s.DefaultStoreId).Returns((string)null); _pdfServiceMock = new Mock(); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); var contextAccessorMock = new Mock(); var workContextMock = new Mock(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseOrderManagementControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseOrderManagementControllerTests.cs index f001a5edee..fe80af9e2a 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseOrderManagementControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseOrderManagementControllerTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Commands.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Pdf; using Grand.Business.Core.Queries.Checkout.Orders; using Grand.Domain.Orders; @@ -16,6 +15,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -26,7 +26,7 @@ private class TestOrderManagementController( IOrderViewModelService orderViewModelService, IOrderService orderService, IOrderStatusService orderStatusService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IPdfService pdfService, IMediator mediator, @@ -48,7 +48,7 @@ public void Setup() _mediatorMock = new Mock(); _scopeMock = new Mock>(); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _controller = new TestOrderManagementController( diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BasePageControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BasePageControllerTests.cs index cf32a8b839..344437f8a3 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BasePageControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BasePageControllerTests.cs @@ -17,6 +17,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -27,7 +28,7 @@ private class TestPageController( IPageViewModelService pageViewModelService, IPageService pageService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, IAdminDataScope scope) : BasePageController(pageViewModelService, pageService, languageService, translationService, @@ -36,7 +37,7 @@ private class TestPageController( private TestPageController _controller; private Mock _pageViewModelServiceMock; private Mock _pageServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock> _scopeMock; [TestInitialize] @@ -47,7 +48,7 @@ public void Setup() _pageViewModelServiceMock = new Mock(); _pageServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _scopeMock = new Mock>(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BasePaymentTransactionControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BasePaymentTransactionControllerTests.cs index 2b0710ace8..b5f884801b 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BasePaymentTransactionControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BasePaymentTransactionControllerTests.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Payments; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain; using Grand.Domain.Orders; using Grand.Domain.Payments; @@ -29,7 +28,7 @@ public class BasePaymentTransactionControllerTests private class TestPaymentTransactionController( IPaymentTransactionService paymentTransactionService, IOrderService orderService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, IMediator mediator, IEnumTranslationService enumTranslationService, @@ -54,7 +53,7 @@ public void Setup() _scopeMock = new Mock>(); _scopeMock.Setup(s => s.HasAccess(It.IsAny())).ReturnsAsync(true); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); var dateTimeServiceMock = new Mock(); dateTimeServiceMock.Setup(d => d.ConvertToUserTime(It.IsAny(), It.IsAny())) diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BasePickupPointControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BasePickupPointControllerTests.cs index 0592d04771..fbe060a324 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BasePickupPointControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BasePickupPointControllerTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain; using Grand.Domain.Directory; @@ -18,6 +17,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using PickupPoint = Grand.Domain.Shipping.PickupPoint; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -28,7 +28,7 @@ public class BasePickupPointControllerTests private Mock _warehouseServiceMock; private Mock _countryServiceMock; private Mock _storeServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; [TestInitialize] public void Setup() @@ -45,7 +45,7 @@ public void Setup() .ReturnsAsync(new List()); _storeServiceMock = new Mock(); _storeServiceMock.Setup(s => s.GetAllStores()).ReturnsAsync(new List()); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("msg"); } diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseProductAttributeControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseProductAttributeControllerTests.cs index 5614344c59..af9cc38907 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseProductAttributeControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseProductAttributeControllerTests.cs @@ -16,6 +16,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -28,7 +29,7 @@ private class TestProductAttributeController( IProductService productService, IProductAttributeService productAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, SeoSettings seoSettings, IAdminDataScope scope) : BaseProductAttributeController(productService, productAttributeService, languageService, @@ -46,7 +47,7 @@ public void Setup() _attributeService = new Mock(); _scope = new Mock>(); _sut = new TestProductAttributeController(_productService.Object, _attributeService.Object, - Mock.Of(), Mock.Of(), new SeoSettings(), _scope.Object); + Mock.Of(), Mock.Of(), new SeoSettings(), _scope.Object); var httpContext = new DefaultHttpContext(); var loggerFactoryMock = new Mock(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseProductControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseProductControllerTests.cs index 26a1fe9d63..6c86fc48d2 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseProductControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseProductControllerTests.cs @@ -40,7 +40,7 @@ private class TestProductController( IProductService productService, IInventoryManageService inventoryManageService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductReservationService productReservationService, IAuctionService auctionService, IDateTimeService dateTimeService, @@ -54,7 +54,7 @@ private class TestProductController( private TestProductController _controller; private Mock _productServiceMock; private Mock _productViewModelServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock> _scopeMock; private Mock _permissionServiceMock; private Mock _productReservationServiceMock; @@ -72,7 +72,7 @@ public void Setup() _productServiceMock = new Mock(); _productViewModelServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _scopeMock = new Mock>(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseProductReviewControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseProductReviewControllerTests.cs index d80d4997b6..b6f5eeeefb 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseProductReviewControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseProductReviewControllerTests.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain.Catalog; using Grand.Web.AdminShared.Controllers; @@ -13,6 +12,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -21,13 +21,13 @@ public class BaseProductReviewControllerTests { private Mock _viewModelService; private Mock _productReviewService; - private Mock _translationService; + private Mock _translationService; private Mock> _scope; private class TestableProductReviewController( IProductReviewViewModelService viewModelService, IProductReviewService productReviewService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseProductReviewController(viewModelService, productReviewService, translationService, scope); @@ -56,7 +56,7 @@ public void Setup() { _viewModelService = new Mock(); _productReviewService = new Mock(); - _translationService = new Mock(); + _translationService = new Mock(); _scope = new Mock>(); } diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseReportsControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseReportsControllerTests.cs index dee78901ae..19adf55fa1 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseReportsControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseReportsControllerTests.cs @@ -5,7 +5,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.System.Reports; @@ -40,7 +39,7 @@ private class TestReportsController( IProductService productService, IProductAttributeFormatter productAttributeFormatter, IStockQuantityService stockQuantityService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, ICountryService countryService, IVendorService vendorService, @@ -77,7 +76,7 @@ public void Setup() _productServiceMock = new Mock(); var productAttributeFormatterMock = new Mock(); var stockQuantityServiceMock = new Mock(); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _storeServiceMock = new Mock(); _storeServiceMock.Setup(s => s.GetAllStores()).ReturnsAsync(new List()); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseShipmentControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseShipmentControllerTests.cs index 558211ecf1..f6064f1760 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseShipmentControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseShipmentControllerTests.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Pdf; using Grand.Domain.Common; using Grand.Domain.Localization; @@ -21,6 +20,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -31,7 +31,7 @@ public class BaseShipmentControllerTests private class TestShipmentController( IShipmentViewModelService shipmentViewModelService, IOrderService orderService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IPdfService pdfService, IShipmentService shipmentService, @@ -67,7 +67,7 @@ public void Setup() _orderScopeMock = new Mock>(); _orderScopeMock.Setup(s => s.HasAccess(It.IsAny())).ReturnsAsync(true); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); var contextAccessorMock = new Mock(); var workContextMock = new Mock(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseShippingMethodControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseShippingMethodControllerTests.cs index 75c35ac16c..0df7cff569 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseShippingMethodControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseShippingMethodControllerTests.cs @@ -15,6 +15,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using ShippingMethod = Grand.Domain.Shipping.ShippingMethod; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -24,7 +25,7 @@ public class BaseShippingMethodControllerTests private Mock _shippingMethodServiceMock; private Mock _languageServiceMock; private Mock _storeServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; [TestInitialize] public void Setup() @@ -38,7 +39,7 @@ public void Setup() .ReturnsAsync(new List()); _storeServiceMock = new Mock(); _storeServiceMock.Setup(s => s.GetAllStores()).ReturnsAsync(new List()); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("msg"); } diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseSpecificationAttributeControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseSpecificationAttributeControllerTests.cs index 8e763df5b1..5fc3f587a3 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseSpecificationAttributeControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseSpecificationAttributeControllerTests.cs @@ -16,6 +16,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using System.Collections.Generic; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -27,7 +28,7 @@ public class BaseSpecificationAttributeControllerTests private class TestSpecificationAttributeController( ISpecificationAttributeService specificationAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductService productService, SeoSettings seoSettings, IAdminDataScope scope) @@ -46,7 +47,7 @@ public void Setup() _productService = new Mock(); _scope = new Mock>(); _sut = new TestSpecificationAttributeController(_service.Object, Mock.Of(), - Mock.Of(), _productService.Object, new SeoSettings(), _scope.Object); + Mock.Of(), _productService.Object, new SeoSettings(), _scope.Object); var httpContext = new DefaultHttpContext(); var loggerFactoryMock = new Mock(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseTaxCategoryControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseTaxCategoryControllerTests.cs index 28c1fc6483..b55550c9c6 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseTaxCategoryControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseTaxCategoryControllerTests.cs @@ -1,7 +1,6 @@ #nullable enable using Grand.Business.Core.Interfaces.Catalog.Tax; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Stores; using Grand.Domain.Tax; @@ -20,6 +19,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -31,13 +31,13 @@ public class BaseTaxCategoryControllerTests private class TestTaxCategoryController( ITaxCategoryService taxCategoryService, IStoreService storeService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseTaxCategoryController(taxCategoryService, storeService, translationService, scope); private Mock _taxCategoryServiceMock = null!; private Mock _storeServiceMock = null!; - private Mock _translationServiceMock = null!; + private Mock _translationServiceMock = null!; [TestInitialize] public void Setup() @@ -48,7 +48,7 @@ public void Setup() _taxCategoryServiceMock = new Mock(); _storeServiceMock = new Mock(); _storeServiceMock.Setup(s => s.GetAllStores()).ReturnsAsync(new List()); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns((string s) => s); } diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseVendorReviewControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseVendorReviewControllerTests.cs index d88f6ccacb..51a06cfe73 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseVendorReviewControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseVendorReviewControllerTests.cs @@ -1,4 +1,3 @@ -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Vendors; using Grand.Web.AdminShared.Controllers; @@ -12,6 +11,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -22,7 +22,7 @@ public class BaseVendorReviewControllerTests private class TestVendorReviewController( IVendorViewModelService vendorViewModelService, IVendorService vendorService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseVendorReviewController(vendorViewModelService, vendorService, translationService, scope); @@ -39,7 +39,7 @@ public void Setup() _scopeMock = new Mock>(); _scopeMock.Setup(s => s.DefaultVendorId).Returns((string)null); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _controller = new TestVendorReviewController( diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseWarehouseControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseWarehouseControllerTests.cs index c850299bf4..6a6b76cc0f 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseWarehouseControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/BaseWarehouseControllerTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Directory; using Grand.Domain.Stores; @@ -13,6 +12,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Warehouse = Grand.Domain.Shipping.Warehouse; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -22,7 +22,7 @@ public class BaseWarehouseControllerTests private Mock _warehouseServiceMock; private Mock _countryServiceMock; private Mock _storeServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; [TestInitialize] public void Setup() @@ -33,7 +33,7 @@ public void Setup() .ReturnsAsync(new List()); _storeServiceMock = new Mock(); _storeServiceMock.Setup(s => s.GetAllStores()).ReturnsAsync(new List()); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("msg"); } diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/CustomerReportViewModelServiceTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/CustomerReportViewModelServiceTests.cs index 56a7635484..9231944a51 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/CustomerReportViewModelServiceTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/CustomerReportViewModelServiceTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.System.Reports; using Grand.Business.Core.Utilities.System; @@ -25,7 +24,7 @@ public class CustomerReportViewModelServiceTests public void Setup() { var customerServiceMock = new Mock(); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _customerReportServiceMock = new Mock(); var dateTimeServiceMock = new Mock(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/DiscountControllerVendorTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/DiscountControllerVendorTests.cs index 279923d99c..5e4721ac85 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/DiscountControllerVendorTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/DiscountControllerVendorTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Catalog.Discounts; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain; using Grand.Domain.Discounts; @@ -18,6 +17,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -46,7 +46,7 @@ public void Setup() _scope.Setup(x => x.HasAccess(It.IsAny())).ReturnsAsync(true); _scope.Setup(x => x.CanView(It.IsAny())).ReturnsAsync(true); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _sut = new DiscountController( diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/LoginControllerExternalSignInTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/LoginControllerExternalSignInTests.cs index e16c8d1879..b214fbc41a 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/LoginControllerExternalSignInTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/LoginControllerExternalSignInTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; using Grand.Domain.Common; @@ -16,6 +15,7 @@ using Microsoft.AspNetCore.Routing; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -32,7 +32,7 @@ public void Setup() _externalAuthenticationService = new Mock(); _groupService = new Mock(); _controller = new LoginController(new CustomerSettings(), new CaptchaSettings(), - new Mock().Object, new Mock().Object, + new Mock().Object, new Mock().Object, new Mock().Object, new Mock().Object, new Mock().Object, new Mock { DefaultValue = DefaultValue.Mock }.Object, new Mock().Object); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/LoginControllerProviderOnlyTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/LoginControllerProviderOnlyTests.cs index ac8ce24d61..103bacd203 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/LoginControllerProviderOnlyTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/LoginControllerProviderOnlyTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; using Grand.Domain.Common; @@ -16,6 +15,7 @@ using Microsoft.AspNetCore.Routing; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -42,7 +42,7 @@ public void Setup() private LoginController CreateController(string area) { var controller = new LoginController(new CustomerSettings(), new CaptchaSettings(), - new Mock().Object, _customerManagerService.Object, + new Mock().Object, _customerManagerService.Object, new Mock().Object, new Mock().Object, new Mock().Object, _contextAccessor.Object, new Mock().Object); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/MerchandiseReturnViewModelServiceTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/MerchandiseReturnViewModelServiceTests.cs index 0b8725ee5b..f1c2bbfb1b 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/MerchandiseReturnViewModelServiceTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/MerchandiseReturnViewModelServiceTests.cs @@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Addresses; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; using Grand.Business.Core.Interfaces.Storage; @@ -122,7 +121,7 @@ private static MerchandiseReturnViewModelService Build(ICustomerService customer var productServiceMock = new Mock(); var dateTimeServiceMock = new Mock(); dateTimeServiceMock.Setup(d => d.CurrentTimeZone).Returns(TimeZoneInfo.Utc); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); var messageProviderServiceMock = new Mock(); var languageSettings = new LanguageSettings(); var merchandiseReturnServiceMock = new Mock(); @@ -176,7 +175,7 @@ private static MerchandiseReturnViewModelService BuildWithCustomMocks( var customerServiceMock = new Mock(); var dateTimeServiceMock = new Mock(); dateTimeServiceMock.Setup(d => d.CurrentTimeZone).Returns(TimeZoneInfo.Utc); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); var messageProviderServiceMock = new Mock(); var languageSettings = new LanguageSettings(); var priceFormatterMock = new Mock(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Controllers/PaymentControllerTests.cs b/src/Tests/Grand.Web.Admin.Tests/Controllers/PaymentControllerTests.cs index 17b1740bb0..ca836c3fd2 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Controllers/PaymentControllerTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Controllers/PaymentControllerTests.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Directory; using Grand.Domain.Shipping; using Grand.Infrastructure; @@ -19,6 +18,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Controllers; @@ -32,7 +32,7 @@ public class PaymentControllerTests private Mock _paymentServiceMock; private Mock _settingServiceMock; private Mock _shippingMethodServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; [TestInitialize] public void Setup() @@ -48,7 +48,7 @@ public void Setup() _settingServiceMock = new Mock(); _countryServiceMock = new Mock(); _shippingMethodServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _controller = new PaymentController( diff --git a/src/Tests/Grand.Web.Admin.Tests/Services/CheckoutAttributeViewModelServiceTests.cs b/src/Tests/Grand.Web.Admin.Tests/Services/CheckoutAttributeViewModelServiceTests.cs index 16564e2f88..bb26e62fbc 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Services/CheckoutAttributeViewModelServiceTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Services/CheckoutAttributeViewModelServiceTests.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Catalog.Tax; using Grand.Business.Core.Interfaces.Checkout.CheckoutAttributes; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain.Catalog; using Grand.Domain.Common; @@ -34,7 +33,7 @@ public void Setup() .ReturnsAsync(new List()); _service = new CheckoutAttributeViewModelService(_checkoutAttributeServiceMock.Object, parserMock.Object, - new Mock().Object, new Mock().Object, + new Mock().Object, new Mock().Object, new Mock().Object, new CurrencySettings(), new Mock().Object, new MeasureSettings(), new Mock().Object); } diff --git a/src/Tests/Grand.Web.Admin.Tests/Services/CurrencyViewModelServiceTests.cs b/src/Tests/Grand.Web.Admin.Tests/Services/CurrencyViewModelServiceTests.cs index e0504913a3..2ccbf132f4 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Services/CurrencyViewModelServiceTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Services/CurrencyViewModelServiceTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Directory; using Grand.Domain.Stores; @@ -10,6 +9,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Services; @@ -20,7 +20,7 @@ public class CurrencyViewModelServiceTests private Mock _storeServiceMock; private CurrencySettings _currencySettings; private Mock _settingServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock _cacheBaseMock; private CurrencyViewModelService _service; @@ -31,7 +31,7 @@ public void Setup() _storeServiceMock = new Mock(); _currencySettings = new CurrencySettings(); _settingServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _cacheBaseMock = new Mock(); _service = new CurrencyViewModelService( diff --git a/src/Tests/Grand.Web.Admin.Tests/Services/CustomerViewModelServiceTests.cs b/src/Tests/Grand.Web.Admin.Tests/Services/CustomerViewModelServiceTests.cs index 7fbd5b0a99..3e710e180f 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Services/CustomerViewModelServiceTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Services/CustomerViewModelServiceTests.cs @@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Addresses; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Marketing.Contacts; @@ -51,7 +50,7 @@ public class CustomerViewModelServiceTests private Mock _dateTimeServiceMock; private Mock _downloadServiceMock; private Mock _newsLetterSubscriptionServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Customer _currentCustomer; private CustomerViewModelService _customerViewModelService; @@ -72,7 +71,7 @@ public void Setup() _dateTimeServiceMock = new Mock(); _downloadServiceMock = new Mock(); _newsLetterSubscriptionServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns(k => k); _dateTimeServiceMock.Setup(d => d.ConvertToUserTime(It.IsAny(), It.IsAny())) diff --git a/src/Tests/Grand.Web.Admin.Tests/Services/LanguageViewModelServiceTests.cs b/src/Tests/Grand.Web.Admin.Tests/Services/LanguageViewModelServiceTests.cs index d30fdb93cc..7c5a10d736 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Services/LanguageViewModelServiceTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Services/LanguageViewModelServiceTests.cs @@ -6,6 +6,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Services; @@ -13,7 +14,7 @@ namespace Grand.Web.Admin.Tests.Services; public class LanguageViewModelServiceTests { private Mock _languageServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock _currencyServiceMock; private Mock _hostingEnvironmentMock; private LanguageViewModelService _service; @@ -22,7 +23,7 @@ public class LanguageViewModelServiceTests public void Setup() { _languageServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _currencyServiceMock = new Mock(); _hostingEnvironmentMock = new Mock(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Services/PanelPasswordRecoveryServiceTests.cs b/src/Tests/Grand.Web.Admin.Tests/Services/PanelPasswordRecoveryServiceTests.cs index 2d5745107f..881588f89f 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Services/PanelPasswordRecoveryServiceTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Services/PanelPasswordRecoveryServiceTests.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Utilities.Authentication; using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; @@ -16,6 +15,7 @@ using Grand.Web.AdminShared.Services; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Services; @@ -54,7 +54,7 @@ public void Init() _signInPolicy.Setup(x => x.PasswordSignIn(It.IsAny(), It.IsAny())) .ReturnsAsync(PasswordSignInDecision.Password); - var translationService = new Mock(); + var translationService = new Mock(); translationService.Setup(x => x.GetResource(It.IsAny())).Returns((string key) => key); var workContext = new Mock(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Services/ProductViewModelServiceTests.cs b/src/Tests/Grand.Web.Admin.Tests/Services/ProductViewModelServiceTests.cs index bbca32b343..994504124a 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Services/ProductViewModelServiceTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Services/ProductViewModelServiceTests.cs @@ -54,7 +54,7 @@ public class ProductViewModelServiceTests private Mock> _scopeMock; private Mock _storeServiceMock; private Mock _taxCategoryServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock _vendorServiceMock; private Mock _warehouseServiceMock; @@ -71,7 +71,7 @@ public void Setup() _productServiceMock = new Mock(); _storeServiceMock = new Mock(); _taxCategoryServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _vendorServiceMock = new Mock(); _warehouseServiceMock = new Mock(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Services/ShipmentViewModelServiceTests.cs b/src/Tests/Grand.Web.Admin.Tests/Services/ShipmentViewModelServiceTests.cs index 3d9cf5d433..b6af2e3f50 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Services/ShipmentViewModelServiceTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Services/ShipmentViewModelServiceTests.cs @@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Storage; using Grand.Domain.Catalog; using Grand.Domain.Directory; @@ -16,6 +15,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Services; @@ -60,7 +60,7 @@ public void Setup() _measureServiceMock.Object, new Mock().Object, new Mock().Object, - new Mock().Object, + new Mock().Object, new Mock().Object, new Mock().Object, new Mock().Object, diff --git a/src/Tests/Grand.Web.Admin.Tests/Services/VendorViewModelServiceTests.cs b/src/Tests/Grand.Web.Admin.Tests/Services/VendorViewModelServiceTests.cs index 02d634d196..190a7a59a8 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Services/VendorViewModelServiceTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Services/VendorViewModelServiceTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Catalog.Discounts; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Seo; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; @@ -16,6 +15,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using Assert = Microsoft.VisualStudio.TestTools.UnitTesting.Assert; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Services; @@ -25,7 +25,7 @@ public class VendorViewModelServiceTests private Mock _discountServiceMock; private Mock _vendorServiceMock; private Mock _customerServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock _dateTimeServiceMock; private Mock _countryServiceMock; private Mock _storeServiceMock; @@ -39,7 +39,7 @@ public void Setup() _discountServiceMock = new Mock(); _vendorServiceMock = new Mock(); _customerServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _dateTimeServiceMock = new Mock(); _countryServiceMock = new Mock(); _storeServiceMock = new Mock(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Validators/CustomerValidatorTests.cs b/src/Tests/Grand.Web.Admin.Tests/Validators/CustomerValidatorTests.cs index 9cf0644de1..c3666870fb 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Validators/CustomerValidatorTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Validators/CustomerValidatorTests.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain; using Grand.Domain.Customers; @@ -11,6 +10,7 @@ using Grand.Web.AdminShared.Validators.Customers; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Validators; @@ -27,7 +27,7 @@ public class CustomerValidatorTests [TestInitialize] public void Setup() { - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns(k => k); _groupServiceMock = new Mock(); diff --git a/src/Tests/Grand.Web.Admin.Tests/Validators/LoginValidatorExternalSignInTests.cs b/src/Tests/Grand.Web.Admin.Tests/Validators/LoginValidatorExternalSignInTests.cs index 4f92b72150..92e3cd4dff 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Validators/LoginValidatorExternalSignInTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Validators/LoginValidatorExternalSignInTests.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Utilities.Authentication; using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Common; @@ -16,6 +15,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Validators; @@ -28,7 +28,7 @@ public class LoginValidatorExternalSignInTests private Mock _groups; private Mock _policy; private Mock _provider; - private Mock _translation; + private Mock _translation; [TestInitialize] public void Init() @@ -47,7 +47,7 @@ public void Init() It.IsAny(), It.IsAny())) .Returns((string entered, PasswordFormat _, string stored, string _, HashedPasswordFormat _) => entered == stored); - _translation = new Mock(); + _translation = new Mock(); _translation.Setup(t => t.GetResource(It.IsAny())).Returns(k => k); _translation.Setup(t => t.GetResource("Account.Login.WrongCredentials.ExternalSignInRequired")) .Returns("Sign in with {0}"); diff --git a/src/Tests/Grand.Web.Admin.Tests/Validators/RobotsTxtValidatorTests.cs b/src/Tests/Grand.Web.Admin.Tests/Validators/RobotsTxtValidatorTests.cs index af512d8017..e1dcb20736 100644 --- a/src/Tests/Grand.Web.Admin.Tests/Validators/RobotsTxtValidatorTests.cs +++ b/src/Tests/Grand.Web.Admin.Tests/Validators/RobotsTxtValidatorTests.cs @@ -1,9 +1,9 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Infrastructure.Validators; +using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Directory; using Grand.Web.AdminShared.Validators.Directory; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Tests.Validators; @@ -12,9 +12,9 @@ public class RobotsTxtValidatorTests { private readonly RobotsTxtValidator _validator = new(new List>(), Translations()); - private static ITranslationService Translations() + private static IRequestTranslationService Translations() { - var mock = new Mock(); + var mock = new Mock(); mock.Setup(t => t.GetResource(It.IsAny())).Returns("message"); return mock.Object; } diff --git a/src/Tests/Grand.Web.Common.Tests/Localization/RequestTranslationServiceTests.cs b/src/Tests/Grand.Web.Common.Tests/Localization/RequestTranslationServiceTests.cs new file mode 100644 index 0000000000..86453f2ef7 --- /dev/null +++ b/src/Tests/Grand.Web.Common.Tests/Localization/RequestTranslationServiceTests.cs @@ -0,0 +1,59 @@ +using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Domain.Localization; +using Grand.Infrastructure; +using Grand.Web.Common.Localization; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Moq; + +namespace Grand.Web.Common.Tests.Localization; + +[TestClass] +public class RequestTranslationServiceTests +{ + private Mock _contextAccessorMock; + private RequestTranslationService _service; + private Mock _translationServiceMock; + + [TestInitialize] + public void Init() + { + _translationServiceMock = new Mock(); + _contextAccessorMock = new Mock(); + _service = new RequestTranslationService(_translationServiceMock.Object, _contextAccessorMock.Object); + } + + [TestMethod] + public void GetResource_UsesWorkingLanguageOfTheRequest() + { + _contextAccessorMock.Setup(c => c.WorkContext.WorkingLanguage).Returns(new Language { Id = "pl" }); + _translationServiceMock.Setup(x => x.GetResource("name", "pl", "", false)).Returns("nazwa"); + + var result = _service.GetResource("name"); + + Assert.AreEqual("nazwa", result); + } + + [TestMethod] + public void GetResource_WithoutWorkingLanguage_ReturnsEmpty() + { + _contextAccessorMock.Setup(c => c.WorkContext.WorkingLanguage).Returns((Language)null); + + var result = _service.GetResource("name"); + + Assert.AreEqual("", result); + _translationServiceMock.Verify( + x => x.GetResource(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), + Times.Never); + } + + [TestMethod] + public void GetResource_WithLanguage_DoesNotReadTheRequest() + { + _translationServiceMock.Setup(x => x.GetResource("name", "en", "default", true)).Returns("value"); + + var result = _service.GetResource("name", "en", "default", true); + + Assert.AreEqual("value", result); + _contextAccessorMock.VerifyNoOtherCalls(); + } +} diff --git a/src/Tests/Grand.Web.Common.Tests/TagHelpers/AdminGridTagHelperTests.cs b/src/Tests/Grand.Web.Common.Tests/TagHelpers/AdminGridTagHelperTests.cs index dd0c2a5e73..33036697b3 100644 --- a/src/Tests/Grand.Web.Common.Tests/TagHelpers/AdminGridTagHelperTests.cs +++ b/src/Tests/Grand.Web.Common.Tests/TagHelpers/AdminGridTagHelperTests.cs @@ -1,7 +1,6 @@ using System.Globalization; using System.Text.Encodings.Web; using System.Text.Json; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Common; using Grand.Domain.Localization; using Grand.Infrastructure; @@ -15,6 +14,7 @@ using Microsoft.AspNetCore.Routing; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Common.Tests.TagHelpers; @@ -24,7 +24,7 @@ public class AdminGridTagHelperTests private AdminAreaSettings _adminAreaSettings; private LanguageSettings _languageSettings; private Mock _contextAccessorMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock _urlHelperMock; private Mock _urlHelperFactoryMock; private Language _workingLanguage; @@ -43,7 +43,7 @@ public void Init() workContextMock.Setup(x => x.WorkingLanguage).Returns(() => _workingLanguage); _contextAccessorMock = new Mock(); _contextAccessorMock.Setup(x => x.WorkContext).Returns(workContextMock.Object); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(x => x.GetResource(It.IsAny())).Returns((string key) => $"[{key}]"); _translationServiceMock .Setup(x => x.GetResource(It.IsAny(), "lang1", string.Empty, true)) diff --git a/src/Tests/Grand.Web.Store.Tests/Controllers/BlogControllerTests.cs b/src/Tests/Grand.Web.Store.Tests/Controllers/BlogControllerTests.cs index d4c8bfdadd..e7b36d5d35 100644 --- a/src/Tests/Grand.Web.Store.Tests/Controllers/BlogControllerTests.cs +++ b/src/Tests/Grand.Web.Store.Tests/Controllers/BlogControllerTests.cs @@ -19,6 +19,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Tests.Controllers; @@ -46,7 +47,7 @@ public void Setup() _blogServiceMock.Object, new Mock().Object, new Mock().Object, - new Mock().Object, + new Mock().Object, new Mock().Object, new Mock().Object, new Mock().Object, @@ -132,7 +133,7 @@ public class EditWarningCheckTests private BlogController _controller; private Mock _blogServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock> _postScopeMock; [TestInitialize] @@ -146,7 +147,7 @@ public void Setup() AutoMapperConfig.Init(mapperConfig); _blogServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _postScopeMock = new Mock>(); diff --git a/src/Tests/Grand.Web.Store.Tests/Controllers/BrandControllerTests.cs b/src/Tests/Grand.Web.Store.Tests/Controllers/BrandControllerTests.cs index 1adc0c6a4f..32b23bf3b8 100644 --- a/src/Tests/Grand.Web.Store.Tests/Controllers/BrandControllerTests.cs +++ b/src/Tests/Grand.Web.Store.Tests/Controllers/BrandControllerTests.cs @@ -17,6 +17,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Tests.Controllers; @@ -48,7 +49,7 @@ public class EditWarningCheckTests private BrandController _controller; private Mock _brandServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock> _scopeMock; [TestInitialize] @@ -58,7 +59,7 @@ public void Setup() AutoMapperConfig.Init(mapperConfig); _brandServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _scopeMock = new Mock>(); diff --git a/src/Tests/Grand.Web.Store.Tests/Controllers/CurrencyControllerTests.cs b/src/Tests/Grand.Web.Store.Tests/Controllers/CurrencyControllerTests.cs index 6850d38479..72dbc9c79d 100644 --- a/src/Tests/Grand.Web.Store.Tests/Controllers/CurrencyControllerTests.cs +++ b/src/Tests/Grand.Web.Store.Tests/Controllers/CurrencyControllerTests.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Customers; using Grand.Domain.Directory; @@ -12,6 +11,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using DomainStore = Grand.Domain.Stores.Store; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Tests.Controllers; @@ -23,7 +23,7 @@ public class CurrencyControllerTests private CurrencyController _controller; private Mock _currencyServiceMock; private Mock _storeServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private CurrencySettings _currencySettings; [TestInitialize] @@ -31,7 +31,7 @@ public void Setup() { _currencyServiceMock = new Mock(); _storeServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns(x => x); _currencySettings = new CurrencySettings(); diff --git a/src/Tests/Grand.Web.Store.Tests/Controllers/CustomerControllerTests.cs b/src/Tests/Grand.Web.Store.Tests/Controllers/CustomerControllerTests.cs index e3348c1f3b..c6689bd14e 100644 --- a/src/Tests/Grand.Web.Store.Tests/Controllers/CustomerControllerTests.cs +++ b/src/Tests/Grand.Web.Store.Tests/Controllers/CustomerControllerTests.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Addresses; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Marketing.Customers; using Grand.Business.Core.Interfaces.Messages; @@ -22,6 +21,7 @@ using Microsoft.AspNetCore.Routing; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Tests.Controllers; @@ -40,7 +40,7 @@ public class CustomerControllerTests private Mock _customerManagerServiceMock; private Mock _customerAttributeServiceMock; private Mock _groupServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock _contextAccessorMock; private Mock> _scopeMock; @@ -52,7 +52,7 @@ public void Setup() _customerManagerServiceMock = new Mock(); _customerAttributeServiceMock = new Mock(); _groupServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); var workContextMock = new Mock(); @@ -81,7 +81,7 @@ private class TestableCustomerController( IAddressAttributeService addressAttributeService, IMessageProviderService messageProviderService, IGroupService groupService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, CustomerSettings customerSettings, IAdminDataScope scope, diff --git a/src/Tests/Grand.Web.Store.Tests/Controllers/GiftVoucherControllerAttributeTests.cs b/src/Tests/Grand.Web.Store.Tests/Controllers/GiftVoucherControllerAttributeTests.cs index 81681034a4..7aac7397b4 100644 --- a/src/Tests/Grand.Web.Store.Tests/Controllers/GiftVoucherControllerAttributeTests.cs +++ b/src/Tests/Grand.Web.Store.Tests/Controllers/GiftVoucherControllerAttributeTests.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Checkout.GiftVouchers; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Orders; using Grand.Web.AdminShared.Controllers; using Grand.Web.AdminShared.Interfaces; @@ -13,6 +12,7 @@ using Microsoft.Extensions.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Tests.Controllers; @@ -71,7 +71,7 @@ public class EditWarningCheckTests private GiftVoucherController _controller; private Mock _viewModelServiceMock; private Mock _giftVoucherServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; private Mock> _scopeMock; [TestInitialize] @@ -81,7 +81,7 @@ public void Setup() _viewModelServiceMock.Setup(s => s.PrepareGiftVoucherModel(It.IsAny())) .ReturnsAsync(new Grand.Web.AdminShared.Models.Orders.GiftVoucherModel()); _giftVoucherServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); _scopeMock = new Mock>(); diff --git a/src/Tests/Grand.Web.Store.Tests/Controllers/NewsControllerTests.cs b/src/Tests/Grand.Web.Store.Tests/Controllers/NewsControllerTests.cs index f3e230887c..74b0e85c56 100644 --- a/src/Tests/Grand.Web.Store.Tests/Controllers/NewsControllerTests.cs +++ b/src/Tests/Grand.Web.Store.Tests/Controllers/NewsControllerTests.cs @@ -16,6 +16,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using System.Reflection; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Tests.Controllers; @@ -44,7 +45,7 @@ public void Setup() new Mock().Object, _newsServiceMock.Object, languageServiceMock.Object, - new Mock().Object, + new Mock().Object, new Mock().Object, new Mock().Object, _scopeMock.Object); diff --git a/src/Tests/Grand.Web.Store.Tests/Controllers/PageControllerTests.cs b/src/Tests/Grand.Web.Store.Tests/Controllers/PageControllerTests.cs index d08315db13..f77f500716 100644 --- a/src/Tests/Grand.Web.Store.Tests/Controllers/PageControllerTests.cs +++ b/src/Tests/Grand.Web.Store.Tests/Controllers/PageControllerTests.cs @@ -19,6 +19,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; using System.Reflection; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Tests.Controllers; @@ -50,7 +51,7 @@ public void Setup() new Mock().Object, _pageServiceMock.Object, _languageServiceMock.Object, - new Mock().Object, + new Mock().Object, new Mock().Object, _scopeMock.Object); @@ -203,7 +204,7 @@ public async Task Copy_DuplicateSystemNameInTargetStore_RedirectsToEditWithoutIn var pageViewModelServiceMock = new Mock(); var controller = new PageController( pageViewModelServiceMock.Object, _pageServiceMock.Object, - _languageServiceMock.Object, new Mock().Object, + _languageServiceMock.Object, new Mock().Object, new Mock().Object, _scopeMock.Object); controller.ControllerContext = _controller.ControllerContext; controller.TempData = _controller.TempData; @@ -235,7 +236,7 @@ public async Task Copy_SharedPage_InsertsCopyScopedToCurrentStore() var controller = new PageController( pageViewModelServiceMock.Object, _pageServiceMock.Object, - _languageServiceMock.Object, new Mock().Object, + _languageServiceMock.Object, new Mock().Object, new Mock().Object, _scopeMock.Object); controller.ControllerContext = _controller.ControllerContext; controller.TempData = _controller.TempData; diff --git a/src/Tests/Grand.Web.Store.Tests/Controllers/PaymentControllerTests.cs b/src/Tests/Grand.Web.Store.Tests/Controllers/PaymentControllerTests.cs index 981523139b..5653d94282 100644 --- a/src/Tests/Grand.Web.Store.Tests/Controllers/PaymentControllerTests.cs +++ b/src/Tests/Grand.Web.Store.Tests/Controllers/PaymentControllerTests.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Customers; using Grand.Domain.Directory; using Grand.Domain.Payments; @@ -20,6 +19,7 @@ using Microsoft.Extensions.Primitives; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Tests.Controllers; @@ -34,7 +34,7 @@ public class PaymentControllerTests private Mock _paymentServiceMock; private Mock _settingServiceMock; private Mock _shippingMethodServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; [TestInitialize] public void Setup() @@ -51,7 +51,7 @@ public void Setup() _settingServiceMock = new Mock(); _countryServiceMock = new Mock(); _shippingMethodServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); var workContextMock = new Mock(); diff --git a/src/Tests/Grand.Web.Store.Tests/Controllers/ProductControllerTests.cs b/src/Tests/Grand.Web.Store.Tests/Controllers/ProductControllerTests.cs index e3616cc10f..bbcdd4d690 100644 --- a/src/Tests/Grand.Web.Store.Tests/Controllers/ProductControllerTests.cs +++ b/src/Tests/Grand.Web.Store.Tests/Controllers/ProductControllerTests.cs @@ -29,7 +29,7 @@ public void Setup() { _productServiceMock = new Mock(); var productViewModelServiceMock = new Mock(); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); var workContextMock = new Mock(); diff --git a/src/Tests/Grand.Web.Store.Tests/Controllers/ShippingControllerTests.cs b/src/Tests/Grand.Web.Store.Tests/Controllers/ShippingControllerTests.cs index b6fc0f1a6b..05e6d5c75b 100644 --- a/src/Tests/Grand.Web.Store.Tests/Controllers/ShippingControllerTests.cs +++ b/src/Tests/Grand.Web.Store.Tests/Controllers/ShippingControllerTests.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain; using Grand.Domain.Customers; using Grand.Domain.Directory; @@ -15,6 +14,7 @@ using Microsoft.Extensions.Primitives; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Tests.Controllers; @@ -28,7 +28,7 @@ public class ShippingControllerTests private Mock _countryServiceMock; private Mock _groupServiceMock; private Mock _shippingMethodServiceMock; - private Mock _translationServiceMock; + private Mock _translationServiceMock; [TestInitialize] public void Setup() @@ -36,7 +36,7 @@ public void Setup() _shippingMethodServiceMock = new Mock(); _countryServiceMock = new Mock(); _groupServiceMock = new Mock(); - _translationServiceMock = new Mock(); + _translationServiceMock = new Mock(); _translationServiceMock.Setup(t => t.GetResource(It.IsAny())).Returns("resource"); var workContextMock = new Mock(); diff --git a/src/Tests/Grand.Web.Tests/Controllers/AccountControllerExternalRegisterTests.cs b/src/Tests/Grand.Web.Tests/Controllers/AccountControllerExternalRegisterTests.cs index 84cd7f97d9..74f3b7679c 100644 --- a/src/Tests/Grand.Web.Tests/Controllers/AccountControllerExternalRegisterTests.cs +++ b/src/Tests/Grand.Web.Tests/Controllers/AccountControllerExternalRegisterTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; using Grand.Business.Core.Utilities.Authentication; @@ -21,6 +20,7 @@ using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Controllers; @@ -63,7 +63,7 @@ public void Init() groups.Setup(g => g.IsRegistered(It.IsAny())).ReturnsAsync(false); _controller = new AccountController(new Mock().Object, - new Mock().Object, context.Object, new Mock().Object, + new Mock().Object, context.Object, new Mock().Object, groups.Object, _manager.Object, new Mock().Object, mediator.Object, _messages.Object, new CaptchaSettings(), _settings, new CustomerConfig()); _controller.ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext() }; diff --git a/src/Tests/Grand.Web.Tests/Controllers/AccountControllerProviderOnlyTests.cs b/src/Tests/Grand.Web.Tests/Controllers/AccountControllerProviderOnlyTests.cs index 70aac40696..2e5b9f4def 100644 --- a/src/Tests/Grand.Web.Tests/Controllers/AccountControllerProviderOnlyTests.cs +++ b/src/Tests/Grand.Web.Tests/Controllers/AccountControllerProviderOnlyTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; using Grand.Business.Core.Utilities.Customers; @@ -20,6 +19,7 @@ using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Controllers; @@ -70,7 +70,7 @@ public void Init() _customerManager = new Mock(); _customers = new Mock(); _controller = new AccountController(new Mock().Object, - new Mock().Object, context.Object, _customers.Object, + new Mock().Object, context.Object, _customers.Object, _groups.Object, _customerManager.Object, new Mock().Object, mediator.Object, new Mock().Object, new CaptchaSettings(), _customerSettings = new CustomerSettings { diff --git a/src/Tests/Grand.Web.Tests/Controllers/AccountControllerTwoFactorReturnUrlTests.cs b/src/Tests/Grand.Web.Tests/Controllers/AccountControllerTwoFactorReturnUrlTests.cs index 3073dd5c97..f9ebadfae0 100644 --- a/src/Tests/Grand.Web.Tests/Controllers/AccountControllerTwoFactorReturnUrlTests.cs +++ b/src/Tests/Grand.Web.Tests/Controllers/AccountControllerTwoFactorReturnUrlTests.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Events.Customers; using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; using Grand.Business.Core.Utilities.Customers; @@ -17,6 +16,7 @@ using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Controllers; @@ -52,7 +52,7 @@ public void Init() context.Setup(x => x.StoreContext.CurrentStore).Returns(new Domain.Stores.Store { Id = "store" }); context.Setup(x => x.WorkContext.CurrentCustomer).Returns(new Customer()); var settings = new CustomerSettings { TwoFactorAuthenticationEnabled = true }; - _controller = new AccountController(new Mock().Object, new Mock().Object, + _controller = new AccountController(new Mock().Object, new Mock().Object, context.Object, _customers.Object, new Mock().Object, _manager.Object, new Mock().Object, new Mock().Object, new Mock().Object, new CaptchaSettings(), settings, new CustomerConfig()); diff --git a/src/Tests/Grand.Web.Tests/Controllers/ContentPreviewTests.cs b/src/Tests/Grand.Web.Tests/Controllers/ContentPreviewTests.cs index f0673dca09..19350d6d3c 100644 --- a/src/Tests/Grand.Web.Tests/Controllers/ContentPreviewTests.cs +++ b/src/Tests/Grand.Web.Tests/Controllers/ContentPreviewTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; @@ -26,6 +25,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Controllers; @@ -80,7 +80,7 @@ private NewsController NewsController(NewsItem newsItem) var newsServiceMock = new Mock(); newsServiceMock.Setup(x => x.GetNewsById(newsItem.Id)).ReturnsAsync(newsItem); return new NewsController(newsServiceMock.Object, _contextAccessorMock.Object, - new Mock().Object, _aclServiceMock.Object, _permissionServiceMock.Object, + new Mock().Object, _aclServiceMock.Object, _permissionServiceMock.Object, _mediatorMock.Object, new NewsSettings { Enabled = true }) { ControllerContext = GetContext() }; } @@ -89,7 +89,7 @@ private BlogController BlogController(BlogPost blogPost) var blogServiceMock = new Mock(); blogServiceMock.Setup(x => x.GetBlogPostById(blogPost.Id)).ReturnsAsync(blogPost); return new BlogController(_mediatorMock.Object, blogServiceMock.Object, - new Mock().Object, _contextAccessorMock.Object, + new Mock().Object, _contextAccessorMock.Object, new BlogSettings { Enabled = true }) { ControllerContext = GetContext() }; } @@ -101,7 +101,7 @@ private KnowledgebaseController KnowledgebaseController(KnowledgebaseArticle art .ReturnsAsync(new List()); return new KnowledgebaseController(new KnowledgebaseSettings { Enabled = true }, knowledgebaseServiceMock.Object, _contextAccessorMock.Object, new Mock().Object, - _aclServiceMock.Object, new Mock().Object, + _aclServiceMock.Object, new Mock().Object, new Mock().Object, new Mock().Object, _permissionServiceMock.Object, new CustomerSettings(), new CaptchaSettings(), new LanguageSettings()) { ControllerContext = GetContext() diff --git a/src/Tests/Grand.Web.Tests/Controllers/ProductControllerPreviewTests.cs b/src/Tests/Grand.Web.Tests/Controllers/ProductControllerPreviewTests.cs index 6c1854c494..ad4f83fe3d 100644 --- a/src/Tests/Grand.Web.Tests/Controllers/ProductControllerPreviewTests.cs +++ b/src/Tests/Grand.Web.Tests/Controllers/ProductControllerPreviewTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Domain.Catalog; using Grand.Domain.Common; @@ -17,6 +16,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Controllers; @@ -71,7 +71,7 @@ public void Init() _controller = new ProductController( _productServiceMock.Object, contextAccessorMock.Object, - new Mock().Object, + new Mock().Object, _recentlyViewedMock.Object, new Mock().Object, _aclServiceMock.Object, diff --git a/src/Tests/Grand.Web.Tests/Features/Handlers/Catalog/GetHomepageBrandsHandlerTests.cs b/src/Tests/Grand.Web.Tests/Features/Handlers/Catalog/GetHomepageBrandsHandlerTests.cs index 7714288a9b..2b1dd700ed 100644 --- a/src/Tests/Grand.Web.Tests/Features/Handlers/Catalog/GetHomepageBrandsHandlerTests.cs +++ b/src/Tests/Grand.Web.Tests/Features/Handlers/Catalog/GetHomepageBrandsHandlerTests.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Catalog.Brands; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Storage; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain; @@ -15,6 +14,7 @@ using Microsoft.Extensions.Caching.Memory; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Features.Handlers.Catalog; @@ -37,7 +37,7 @@ public void Init() return new PagedList(brands, 0, int.MaxValue); }); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(s => s.GetResource(It.IsAny())).Returns("{0}"); var cacheBase = new MemoryCacheBase(new MemoryCache(new MemoryCacheOptions()), new Mock().Object, diff --git a/src/Tests/Grand.Web.Tests/Features/Handlers/Catalog/GetHomepageCollectionsHandlerTests.cs b/src/Tests/Grand.Web.Tests/Features/Handlers/Catalog/GetHomepageCollectionsHandlerTests.cs index bf3ad4cfd1..fd037124a5 100644 --- a/src/Tests/Grand.Web.Tests/Features/Handlers/Catalog/GetHomepageCollectionsHandlerTests.cs +++ b/src/Tests/Grand.Web.Tests/Features/Handlers/Catalog/GetHomepageCollectionsHandlerTests.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Catalog.Collections; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Storage; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain; @@ -15,6 +14,7 @@ using Microsoft.Extensions.Caching.Memory; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Features.Handlers.Catalog; @@ -37,7 +37,7 @@ public void Init() return new PagedList(collections, 0, int.MaxValue); }); - var translationServiceMock = new Mock(); + var translationServiceMock = new Mock(); translationServiceMock.Setup(s => s.GetResource(It.IsAny())).Returns("{0}"); var cacheBase = new MemoryCacheBase(new MemoryCache(new MemoryCacheOptions()), new Mock().Object, diff --git a/src/Tests/Grand.Web.Tests/Features/Handlers/Common/GetAddressModelHandlerTests.cs b/src/Tests/Grand.Web.Tests/Features/Handlers/Common/GetAddressModelHandlerTests.cs index 5987ecb74d..3f13bc0a56 100644 --- a/src/Tests/Grand.Web.Tests/Features/Handlers/Common/GetAddressModelHandlerTests.cs +++ b/src/Tests/Grand.Web.Tests/Features/Handlers/Common/GetAddressModelHandlerTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Common.Addresses; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Common; using Grand.Domain.Directory; using Grand.Domain.Localization; @@ -8,6 +7,7 @@ using Grand.Web.Features.Models.Common; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Features.Handlers.Common; @@ -32,7 +32,7 @@ public void Init() addressAttributeServiceMock.Setup(s => s.GetAllAddressAttributes(It.IsAny())) .ReturnsAsync(new List()); - _handler = new GetAddressModelHandler(_countryServiceMock.Object, new Mock().Object, + _handler = new GetAddressModelHandler(_countryServiceMock.Object, new Mock().Object, addressAttributeServiceMock.Object, new Mock().Object, new Mock().Object, new AddressSettings { CountryEnabled = true, StateProvinceEnabled = true }); diff --git a/src/Tests/Grand.Web.Tests/Features/Handlers/Customers/GetInfoHandlerTests.cs b/src/Tests/Grand.Web.Tests/Features/Handlers/Customers/GetInfoHandlerTests.cs index 45db0fbf5f..dfc2561834 100644 --- a/src/Tests/Grand.Web.Tests/Features/Handlers/Customers/GetInfoHandlerTests.cs +++ b/src/Tests/Grand.Web.Tests/Features/Handlers/Customers/GetInfoHandlerTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Marketing.Newsletters; using Grand.Domain.Customers; using Grand.Domain.Localization; @@ -45,7 +44,7 @@ private static async Task Handle(OidcLoginConfig config) newsletterCategories.Setup(s => s.GetAllNewsletterCategory()).ReturnsAsync(new List()); var handler = new GetInfoHandler(new Mock().Object, - newsletterCategories.Object, new Mock().Object, new Mock().Object, + newsletterCategories.Object, new Mock().Object, new Mock().Object, external.Object, mediator.Object, new CustomerSettings { AllowUsersToChangeEmail = true, TwoFactorAuthenticationEnabled = true }, new TaxSettings(), new Mock().Object, config); diff --git a/src/Tests/Grand.Web.Tests/Features/Handlers/Customers/GetRegisterHandlerTests.cs b/src/Tests/Grand.Web.Tests/Features/Handlers/Customers/GetRegisterHandlerTests.cs index 38c767f436..d250737293 100644 --- a/src/Tests/Grand.Web.Tests/Features/Handlers/Customers/GetRegisterHandlerTests.cs +++ b/src/Tests/Grand.Web.Tests/Features/Handlers/Customers/GetRegisterHandlerTests.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Marketing.Newsletters; using Grand.Domain.Common; using Grand.Domain.Customers; @@ -13,6 +12,7 @@ using Grand.Web.Models.Customer; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Features.Handlers.Customers; @@ -36,7 +36,7 @@ public void Init() newsletterCategoryServiceMock.Setup(s => s.GetNewsletterCategoriesByStore(It.IsAny())) .ReturnsAsync(new List()); - _handler = new GetRegisterHandler(newsletterCategoryServiceMock.Object, new Mock().Object, + _handler = new GetRegisterHandler(newsletterCategoryServiceMock.Object, new Mock().Object, countryServiceMock.Object, mediatorMock.Object, new CustomerSettings { CountryEnabled = true, StateProvinceEnabled = true }, new TaxSettings(), new CaptchaSettings()); diff --git a/src/Tests/Grand.Web.Tests/Features/Handlers/News/GetHomePageNewsItemsHandlerTests.cs b/src/Tests/Grand.Web.Tests/Features/Handlers/News/GetHomePageNewsItemsHandlerTests.cs index ac1997a196..3d17ed4e0d 100644 --- a/src/Tests/Grand.Web.Tests/Features/Handlers/News/GetHomePageNewsItemsHandlerTests.cs +++ b/src/Tests/Grand.Web.Tests/Features/Handlers/News/GetHomePageNewsItemsHandlerTests.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Storage; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain; @@ -17,6 +16,7 @@ using Microsoft.Extensions.Caching.Memory; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Features.Handlers.News; @@ -51,7 +51,7 @@ public void Init() _handler = new GetHomePageNewsItemsHandler(cacheBase, contextAccessorMock.Object, _newsServiceMock.Object, new Mock().Object, new Mock().Object, - new Mock().Object, new NewsSettings(), new MediaSettings(), + new Mock().Object, new NewsSettings(), new MediaSettings(), _accessControlConfig); } diff --git a/src/Tests/Grand.Web.Tests/Validators/Catalog/ProductEmailAFriendValidatorTests.cs b/src/Tests/Grand.Web.Tests/Validators/Catalog/ProductEmailAFriendValidatorTests.cs index 7ccb4082a6..44b006f03a 100644 --- a/src/Tests/Grand.Web.Tests/Validators/Catalog/ProductEmailAFriendValidatorTests.cs +++ b/src/Tests/Grand.Web.Tests/Validators/Catalog/ProductEmailAFriendValidatorTests.cs @@ -1,7 +1,6 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Domain.Common; using Grand.Domain.Customers; @@ -14,6 +13,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Validators.Catalog; @@ -23,7 +23,7 @@ public class ProductEmailAFriendValidatorTests [TestMethod] public async Task Validate_UnpublishedProduct_UsesProductDisabledTranslation() { - var translationService = new Mock(); + var translationService = new Mock(); translationService.Setup(translation => translation.GetResource(It.IsAny())) .Returns(key => key); var workContext = new Mock(); diff --git a/src/Tests/Grand.Web.Tests/Validators/Customer/CustomerValidatorsStoreScopingTests.cs b/src/Tests/Grand.Web.Tests/Validators/Customer/CustomerValidatorsStoreScopingTests.cs index 3a7c8dc16b..2bdfc98ec0 100644 --- a/src/Tests/Grand.Web.Tests/Validators/Customer/CustomerValidatorsStoreScopingTests.cs +++ b/src/Tests/Grand.Web.Tests/Validators/Customer/CustomerValidatorsStoreScopingTests.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Common; @@ -16,6 +15,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Validators.Customers; @@ -28,9 +28,9 @@ public class CustomerValidatorsStoreScopingTests { private const string StoreId = "store-1"; - private static Mock Translation() + private static Mock Translation() { - var m = new Mock(); + var m = new Mock(); m.Setup(t => t.GetResource(It.IsAny())).Returns(k => k); return m; } diff --git a/src/Tests/Grand.Web.Tests/Validators/Customer/DeleteAccountValidatorTests.cs b/src/Tests/Grand.Web.Tests/Validators/Customer/DeleteAccountValidatorTests.cs index 2c01e0f248..570aff2161 100644 --- a/src/Tests/Grand.Web.Tests/Validators/Customer/DeleteAccountValidatorTests.cs +++ b/src/Tests/Grand.Web.Tests/Validators/Customer/DeleteAccountValidatorTests.cs @@ -1,4 +1,3 @@ -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Domain.Customers; using Grand.Infrastructure; @@ -8,6 +7,7 @@ using Grand.Web.Validators.Customer; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Validators.Customers; @@ -24,7 +24,7 @@ private static DeleteAccountValidator Validator(OidcLoginConfig config, bool pas work.Setup(w => w.CurrentCustomer).Returns(new Customer { Password = "pw" }); var context = new Mock(); context.Setup(c => c.WorkContext).Returns(work.Object); - var translation = new Mock(); + var translation = new Mock(); translation.Setup(t => t.GetResource(It.IsAny())).Returns(k => k); return new DeleteAccountValidator(new List>(), encryption.Object, new CustomerSettings(), context.Object, translation.Object, config); diff --git a/src/Tests/Grand.Web.Tests/Validators/Customer/LoginValidatorExternalSignInTests.cs b/src/Tests/Grand.Web.Tests/Validators/Customer/LoginValidatorExternalSignInTests.cs index e372500391..c5687e1c81 100644 --- a/src/Tests/Grand.Web.Tests/Validators/Customer/LoginValidatorExternalSignInTests.cs +++ b/src/Tests/Grand.Web.Tests/Validators/Customer/LoginValidatorExternalSignInTests.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Utilities.Authentication; using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Common; @@ -18,6 +17,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Validators.Customers; @@ -30,7 +30,7 @@ public class LoginValidatorExternalSignInTests private Mock _groups; private Mock _policy; private Mock _provider; - private Mock _translation; + private Mock _translation; [TestInitialize] public void Init() @@ -49,7 +49,7 @@ public void Init() It.IsAny(), It.IsAny())) .Returns((string entered, PasswordFormat _, string stored, string _, HashedPasswordFormat _) => entered == stored); - _translation = new Mock(); + _translation = new Mock(); _translation.Setup(t => t.GetResource(It.IsAny())).Returns(k => k); _translation.Setup(t => t.GetResource("Account.Login.WrongCredentials.ExternalSignInRequired")) .Returns("Sign in with {0}"); diff --git a/src/Tests/Grand.Web.Tests/Validators/Customer/PasswordRecoveryConfirmValidatorExternalSignInTests.cs b/src/Tests/Grand.Web.Tests/Validators/Customer/PasswordRecoveryConfirmValidatorExternalSignInTests.cs index 184dac503b..109a914900 100644 --- a/src/Tests/Grand.Web.Tests/Validators/Customer/PasswordRecoveryConfirmValidatorExternalSignInTests.cs +++ b/src/Tests/Grand.Web.Tests/Validators/Customer/PasswordRecoveryConfirmValidatorExternalSignInTests.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Utilities.Authentication; using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Common; using Grand.Domain.Customers; @@ -12,6 +11,7 @@ using Grand.Web.Validators.Customer; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Validators.Customers; @@ -39,7 +39,7 @@ public void Init() customerService.Setup(x => x.GetCustomerByEmail("u@x.com", It.IsAny())).ReturnsAsync(_customer); var groupService = new Mock(); groupService.Setup(x => x.IsRegistered(_customer)).ReturnsAsync(true); - var translation = new Mock(); + var translation = new Mock(); translation.Setup(t => t.GetResource(It.IsAny())).Returns(k => k); _signInPolicy = new Mock(); _signInPolicy.Setup(x => x.PasswordSignIn(It.IsAny(), SignInSurface.Storefront)) diff --git a/src/Tests/Grand.Web.Tests/Validators/Customer/RegisterValidatorExternalTests.cs b/src/Tests/Grand.Web.Tests/Validators/Customer/RegisterValidatorExternalTests.cs index 09e5d84034..6d9917352d 100644 --- a/src/Tests/Grand.Web.Tests/Validators/Customer/RegisterValidatorExternalTests.cs +++ b/src/Tests/Grand.Web.Tests/Validators/Customer/RegisterValidatorExternalTests.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Common; using Grand.Domain.Customers; @@ -16,6 +15,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; +using Grand.Web.Common.Localization; namespace Grand.Web.Tests.Validators.Customers; @@ -37,7 +37,7 @@ public void Init() private RegisterValidator Validator() { - var translation = new Mock(); + var translation = new Mock(); translation.Setup(t => t.GetResource(It.IsAny())).Returns(k => k); var groupService = new Mock(); groupService.Setup(g => g.IsRegistered(It.IsAny())).ReturnsAsync(false); diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Affiliate/Partials/CreateOrUpdate.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Affiliate/Partials/CreateOrUpdate.cshtml index 3c118567c7..3135e0f58a 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Affiliate/Partials/CreateOrUpdate.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Affiliate/Partials/CreateOrUpdate.cshtml @@ -8,7 +8,7 @@ @model AffiliateModel @inject IOrderStatusService orderStatusService; -@inject ITranslationService translationService; +@inject Grand.Web.Common.Localization.IRequestTranslationService translationService;
diff --git a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Document/List.cshtml b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Document/List.cshtml index 9977f5f48d..4a1a516805 100644 --- a/src/Web/Grand.Web.Admin/Areas/Admin/Views/Document/List.cshtml +++ b/src/Web/Grand.Web.Admin/Areas/Admin/Views/Document/List.cshtml @@ -1,6 +1,6 @@ @using Grand.Business.Core.Interfaces.Common.Localization @model DocumentListModel -@inject ITranslationService translationService +@inject Grand.Web.Common.Localization.IRequestTranslationService translationService @{ //page title ViewBag.Title = Loc["Admin.Documents.Document.Manage"]; diff --git a/src/Web/Grand.Web.Admin/Components/StoreScope.cs b/src/Web/Grand.Web.Admin/Components/StoreScope.cs index 200b5ae38a..084caf4d59 100644 --- a/src/Web/Grand.Web.Admin/Components/StoreScope.cs +++ b/src/Web/Grand.Web.Admin/Components/StoreScope.cs @@ -1,10 +1,10 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Business.Core.Interfaces.Common.Stores; +using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Web.AdminShared.Models.Settings; using Grand.Web.Common.Components; using Grand.Web.Common.Helpers; using Grand.Web.Common.Models; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Components; @@ -15,7 +15,7 @@ public class StoreScopeViewComponent : BaseAdminViewComponent private readonly IStoreService _storeService; private readonly IAdminStoreService _adminStoreService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; #endregion @@ -24,7 +24,7 @@ public class StoreScopeViewComponent : BaseAdminViewComponent public StoreScopeViewComponent( IStoreService storeService, IAdminStoreService adminStoreService, - ITranslationService translationService) + IRequestTranslationService translationService) { _adminStoreService = adminStoreService; _storeService = storeService; diff --git a/src/Web/Grand.Web.Admin/Controllers/AddressAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/AddressAttributeController.cs index 4fd1392b93..2b9dae9acd 100644 --- a/src/Web/Grand.Web.Admin/Controllers/AddressAttributeController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/AddressAttributeController.cs @@ -22,7 +22,7 @@ public class AddressAttributeController( IAddressAttributeService addressAttributeService, IAddressAttributeViewModelService addressAttributeViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseAddressAttributeController(addressAttributeService, addressAttributeViewModelService, languageService, translationService, scope) diff --git a/src/Web/Grand.Web.Admin/Controllers/AffiliateController.cs b/src/Web/Grand.Web.Admin/Controllers/AffiliateController.cs index e8671dd2de..ff4d6b13e4 100644 --- a/src/Web/Grand.Web.Admin/Controllers/AffiliateController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/AffiliateController.cs @@ -1,5 +1,4 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Business.Core.Interfaces.Common.Security; +using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Permissions; using Grand.Web.AdminShared.Interfaces; @@ -8,6 +7,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -16,7 +16,7 @@ public class AffiliateController : BaseAdminController { #region Constructors - public AffiliateController(ITranslationService translationService, + public AffiliateController(IRequestTranslationService translationService, IAffiliateService affiliateService, IAffiliateViewModelService affiliateViewModelService, IPermissionService permissionService) { @@ -30,7 +30,7 @@ public AffiliateController(ITranslationService translationService, #region Fields - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IAffiliateService _affiliateService; private readonly IAffiliateViewModelService _affiliateViewModelService; private readonly IPermissionService _permissionService; diff --git a/src/Web/Grand.Web.Admin/Controllers/BlogController.cs b/src/Web/Grand.Web.Admin/Controllers/BlogController.cs index df0afdcb36..af31347885 100644 --- a/src/Web/Grand.Web.Admin/Controllers/BlogController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/BlogController.cs @@ -21,7 +21,7 @@ public class BlogController( IBlogService blogService, IBlogViewModelService blogViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IDateTimeService dateTimeService, IPictureViewModelService pictureViewModelService, diff --git a/src/Web/Grand.Web.Admin/Controllers/BrandController.cs b/src/Web/Grand.Web.Admin/Controllers/BrandController.cs index aea6961045..9543ceecce 100644 --- a/src/Web/Grand.Web.Admin/Controllers/BrandController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/BrandController.cs @@ -20,7 +20,7 @@ public class BrandController( IBrandService brandService, IStoreService storeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IPictureViewModelService pictureViewModelService, IAdminDataScope scope) : BaseBrandController(brandViewModelService, brandService, storeService, languageService, diff --git a/src/Web/Grand.Web.Admin/Controllers/CampaignController.cs b/src/Web/Grand.Web.Admin/Controllers/CampaignController.cs index 506dcce1e3..86a9920ff0 100644 --- a/src/Web/Grand.Web.Admin/Controllers/CampaignController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/CampaignController.cs @@ -1,5 +1,4 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Business.Core.Interfaces.Common.Stores; +using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Marketing.Campaigns; using Grand.Business.Core.Interfaces.Marketing.Newsletters; using Grand.Business.Core.Interfaces.Messages; @@ -14,6 +13,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -26,13 +26,13 @@ public class CampaignController : BaseAdminController private readonly EmailAccountSettings _emailAccountSettings; private readonly INewsLetterSubscriptionService _newsLetterSubscriptionService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; public CampaignController(ICampaignService campaignService, ICampaignViewModelService campaignViewModelService, IEmailAccountService emailAccountService, INewsLetterSubscriptionService newsLetterSubscriptionService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IStoreService storeService, EmailAccountSettings emailAccountSettings) diff --git a/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs b/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs index 2197a07353..fa0daffe76 100644 --- a/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/CategoryController.cs @@ -19,7 +19,7 @@ public class CategoryController( ICategoryService categoryService, ICategoryViewModelService categoryViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IPictureViewModelService pictureViewModelService, IProductService productService, IAdminDataScope scope) diff --git a/src/Web/Grand.Web.Admin/Controllers/CheckoutAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/CheckoutAttributeController.cs index b79e17f07a..9f4b276af8 100644 --- a/src/Web/Grand.Web.Admin/Controllers/CheckoutAttributeController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/CheckoutAttributeController.cs @@ -20,7 +20,7 @@ namespace Grand.Web.Admin.Controllers; public class CheckoutAttributeController( ICheckoutAttributeService checkoutAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, ICurrencyService currencyService, CurrencySettings currencySettings, IMeasureService measureService, diff --git a/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs b/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs index 59d89baf4b..36d410948f 100644 --- a/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/CollectionController.cs @@ -21,7 +21,7 @@ public class CollectionController( ICollectionService collectionService, IStoreService storeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IPictureViewModelService pictureViewModelService, IProductService productService, IAdminDataScope scope) diff --git a/src/Web/Grand.Web.Admin/Controllers/ContactAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/ContactAttributeController.cs index 59f60991bc..8b71c2eefb 100644 --- a/src/Web/Grand.Web.Admin/Controllers/ContactAttributeController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/ContactAttributeController.cs @@ -9,6 +9,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -20,7 +21,7 @@ public class ContactAttributeController( IContactAttributeViewModelService contactAttributeViewModelService, IContactAttributeService contactAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseContactAttributeController(contactAttributeViewModelService, contactAttributeService, languageService, translationService, scope); \ No newline at end of file diff --git a/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs b/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs index 7cd57f65b6..4b882911c4 100644 --- a/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/ContactFormController.cs @@ -1,11 +1,11 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Business.Core.Interfaces.Marketing.Contacts; +using Grand.Business.Core.Interfaces.Marketing.Contacts; using Grand.Domain.Permissions; using Grand.Web.AdminShared.Interfaces; using Grand.Web.AdminShared.Models.Messages; using Grand.Web.Common.DataSource; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -14,11 +14,11 @@ public class ContactFormController : BaseAdminController { private readonly IContactFormViewModelService _contactFormViewModelService; private readonly IContactUsService _contactUsService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public ContactFormController(IContactUsService contactUsService, IContactFormViewModelService contactFormViewModelService, - ITranslationService translationService) + IRequestTranslationService translationService) { _contactUsService = contactUsService; _contactFormViewModelService = contactFormViewModelService; diff --git a/src/Web/Grand.Web.Admin/Controllers/CountryController.cs b/src/Web/Grand.Web.Admin/Controllers/CountryController.cs index 9ea0306c67..bbf07c90ba 100644 --- a/src/Web/Grand.Web.Admin/Controllers/CountryController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/CountryController.cs @@ -12,6 +12,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -22,7 +23,7 @@ public class CountryController : BaseAdminController public CountryController(ICountryService countryService, ICountryViewModelService countryViewModelService, - ITranslationService translationService, + IRequestTranslationService translationService, ILanguageService languageService, IExportManager exportManager, IImportManager importManager) @@ -41,7 +42,7 @@ public CountryController(ICountryService countryService, private readonly ICountryService _countryService; private readonly ICountryViewModelService _countryViewModelService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly ILanguageService _languageService; private readonly IExportManager _exportManager; private readonly IImportManager _importManager; diff --git a/src/Web/Grand.Web.Admin/Controllers/CourseController.cs b/src/Web/Grand.Web.Admin/Controllers/CourseController.cs index e075756491..f15c3edbe7 100644 --- a/src/Web/Grand.Web.Admin/Controllers/CourseController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/CourseController.cs @@ -15,6 +15,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Grand.Web.AdminShared.Extensions; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -28,11 +29,11 @@ public class CourseController : BaseAdminController private readonly ICourseViewModelService _courseViewModelService; private readonly ILanguageService _languageService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; public CourseController( - ITranslationService translationService, + IRequestTranslationService translationService, ICourseLevelService courseLevelService, ICourseService courseService, ICourseSubjectService courseSubjectService, diff --git a/src/Web/Grand.Web.Admin/Controllers/CurrencyController.cs b/src/Web/Grand.Web.Admin/Controllers/CurrencyController.cs index ac62df16c4..906f75bc04 100644 --- a/src/Web/Grand.Web.Admin/Controllers/CurrencyController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/CurrencyController.cs @@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using System.Globalization; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -29,7 +30,7 @@ public CurrencyController( CurrencySettings currencySettings, ISettingService settingService, IDateTimeService dateTimeService, - ITranslationService translationService, + IRequestTranslationService translationService, ILanguageService languageService) { _currencyService = currencyService; @@ -52,7 +53,7 @@ public CurrencyController( private readonly CurrencySettings _currencySettings; private readonly ISettingService _settingService; private readonly IDateTimeService _dateTimeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly ILanguageService _languageService; #endregion diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerAttributeController.cs index 6d1859df0b..cab5c3a3be 100644 --- a/src/Web/Grand.Web.Admin/Controllers/CustomerAttributeController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/CustomerAttributeController.cs @@ -22,7 +22,7 @@ public class CustomerAttributeController( ICustomerAttributeService customerAttributeService, ICustomerAttributeViewModelService customerAttributeViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseCustomerAttributeController(customerAttributeService, customerAttributeViewModelService, languageService, translationService, scope) diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs index f2fd982bd6..83ddf8dbc3 100644 --- a/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/CustomerController.cs @@ -2,6 +2,7 @@ using Grand.Web.AdminShared.Controllers; using Grand.Web.Common.Filters; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -23,7 +24,7 @@ public class CustomerController( Grand.Business.Core.Interfaces.Common.Addresses.IAddressAttributeService addressAttributeService, Grand.Business.Core.Interfaces.Messages.IMessageProviderService messageProviderService, Grand.Business.Core.Interfaces.Common.Directory.IGroupService groupService, - Grand.Business.Core.Interfaces.Common.Localization.ITranslationService translationService, + Grand.Web.Common.Localization.IRequestTranslationService translationService, Grand.Infrastructure.IContextAccessor contextAccessor, Grand.Domain.Customers.CustomerSettings customerSettings, Grand.Web.AdminShared.Interfaces.IAdminDataScope scope, diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerGroupController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerGroupController.cs index f770079de0..a4a3eefa81 100644 --- a/src/Web/Grand.Web.Admin/Controllers/CustomerGroupController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/CustomerGroupController.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Extensions; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Domain.Permissions; using Grand.Infrastructure; @@ -12,6 +11,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -23,7 +23,7 @@ public class CustomerGroupController : BaseAdminController public CustomerGroupController( ICustomerGroupViewModelService customerGroupViewModelService, IGroupService groupService, - ITranslationService translationService, + IRequestTranslationService translationService, IPermissionService permissionService, IContextAccessor contextAccessor, ICustomerGroupProductService customerGroupProductService) @@ -42,7 +42,7 @@ public CustomerGroupController( private readonly ICustomerGroupViewModelService _customerGroupViewModelService; private readonly IGroupService _groupService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IPermissionService _permissionService; private readonly IContextAccessor _contextAccessor; private readonly ICustomerGroupProductService _customerGroupProductService; diff --git a/src/Web/Grand.Web.Admin/Controllers/CustomerTagController.cs b/src/Web/Grand.Web.Admin/Controllers/CustomerTagController.cs index 2975d5e615..2dd7c93cf4 100644 --- a/src/Web/Grand.Web.Admin/Controllers/CustomerTagController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/CustomerTagController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Marketing.Customers; using Grand.Domain.Permissions; using Grand.Web.AdminShared.Extensions.Mapping; @@ -9,6 +8,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -19,7 +19,7 @@ public class CustomerTagController : BaseAdminController public CustomerTagController( ICustomerTagViewModelService customerTagViewModelService, - ITranslationService translationService, + IRequestTranslationService translationService, ICustomerTagService customerTagService) { _customerTagViewModelService = customerTagViewModelService; @@ -32,7 +32,7 @@ public CustomerTagController( #region Fields private readonly ICustomerTagViewModelService _customerTagViewModelService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly ICustomerTagService _customerTagService; #endregion diff --git a/src/Web/Grand.Web.Admin/Controllers/DeliveryDateController.cs b/src/Web/Grand.Web.Admin/Controllers/DeliveryDateController.cs index c827d14d04..735bb85488 100644 --- a/src/Web/Grand.Web.Admin/Controllers/DeliveryDateController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/DeliveryDateController.cs @@ -10,6 +10,7 @@ using Grand.Web.Admin.Extensions; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -23,7 +24,7 @@ public class DeliveryDateController( IDeliveryDateService deliveryDateService, ILanguageService languageService, IStoreService storeService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseDeliveryDateController(deliveryDateService, languageService, storeService, translationService, scope) { diff --git a/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs b/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs index e24620fe95..db73deccab 100644 --- a/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/DiscountController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Catalog.Discounts; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain; using Grand.Domain.Discounts; @@ -16,6 +15,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -26,7 +26,7 @@ namespace Grand.Web.Admin.Controllers; public class DiscountController( IDiscountViewModelService discountViewModelService, IDiscountService discountService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, IMediator mediator, IDiscountProviderLoader discountProviderLoader, diff --git a/src/Web/Grand.Web.Admin/Controllers/DocumentController.cs b/src/Web/Grand.Web.Admin/Controllers/DocumentController.cs index a9ab6cbf2b..53ab4bfd93 100644 --- a/src/Web/Grand.Web.Admin/Controllers/DocumentController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/DocumentController.cs @@ -1,5 +1,4 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Business.Core.Interfaces.Customers; +using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Marketing.Documents; using Grand.Domain.Permissions; using Grand.Web.AdminShared.Extensions.Mapping; @@ -9,6 +8,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -19,12 +19,12 @@ public class DocumentController : BaseAdminController private readonly IDocumentService _documentService; private readonly IDocumentTypeService _documentTypeService; private readonly IDocumentViewModelService _documentViewModelService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public DocumentController(IDocumentViewModelService documentViewModelService, IDocumentService documentService, IDocumentTypeService documentTypeService, - ITranslationService translationService, + IRequestTranslationService translationService, ICustomerService customerService) { _documentViewModelService = documentViewModelService; diff --git a/src/Web/Grand.Web.Admin/Controllers/EmailAccountController.cs b/src/Web/Grand.Web.Admin/Controllers/EmailAccountController.cs index e020ae7750..bd0b9c0a3e 100644 --- a/src/Web/Grand.Web.Admin/Controllers/EmailAccountController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/EmailAccountController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Messages; using Grand.Domain.Messages; using Grand.Domain.Permissions; @@ -12,6 +11,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -22,7 +22,7 @@ namespace Grand.Web.Admin.Controllers; public class EmailAccountController( IEmailAccountViewModelService emailAccountViewModelService, IEmailAccountService emailAccountService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope, ISettingService settingService, EmailAccountSettings emailAccountSettings, diff --git a/src/Web/Grand.Web.Admin/Controllers/ExternalAuthenticationController.cs b/src/Web/Grand.Web.Admin/Controllers/ExternalAuthenticationController.cs index d8f6f20202..079c5a5a6c 100644 --- a/src/Web/Grand.Web.Admin/Controllers/ExternalAuthenticationController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/ExternalAuthenticationController.cs @@ -4,13 +4,13 @@ using Grand.Domain.Permissions; using Grand.Domain.Customers; using Grand.Infrastructure.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Plugins; using Grand.Web.AdminShared.Extensions.Mapping; using Grand.Web.AdminShared.Models.ExternalAuthentication; using Grand.Web.Common.DataSource; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -64,7 +64,7 @@ public async Task Methods([FromServices] OidcResourceServerConfig [HttpPost] [AutoValidateAntiforgeryToken] public async Task RemoveOidcLinks([FromServices] IOidcLinkService linkService, - [FromServices] ITranslationService translationService, [FromServices] OidcResourceServerConfig resourceServerConfig) + [FromServices] IRequestTranslationService translationService, [FromServices] OidcResourceServerConfig resourceServerConfig) { //the links are recorded for the configured provider: without one there is nothing to record them for if (!ResourceServerConfigured(resourceServerConfig)) @@ -80,7 +80,7 @@ public async Task RemoveOidcLinks([FromServices] IOidcLinkService [HttpPost] [AutoValidateAntiforgeryToken] public async Task KeepOidcLinks([FromServices] IOidcLinkService linkService, - [FromServices] ITranslationService translationService, [FromServices] OidcResourceServerConfig resourceServerConfig) + [FromServices] IRequestTranslationService translationService, [FromServices] OidcResourceServerConfig resourceServerConfig) { if (!ResourceServerConfigured(resourceServerConfig)) return RedirectToAction("Methods"); diff --git a/src/Web/Grand.Web.Admin/Controllers/GiftVoucherController.cs b/src/Web/Grand.Web.Admin/Controllers/GiftVoucherController.cs index bd8c53f152..89ef0ed585 100644 --- a/src/Web/Grand.Web.Admin/Controllers/GiftVoucherController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/GiftVoucherController.cs @@ -1,11 +1,11 @@ using Grand.Business.Core.Interfaces.Checkout.GiftVouchers; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Orders; using Grand.Web.Admin.Extensions; using Grand.Web.AdminShared.Controllers; using Grand.Web.AdminShared.Interfaces; using Grand.Web.Common.Filters; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -16,6 +16,6 @@ namespace Grand.Web.Admin.Controllers; public class GiftVoucherController( IGiftVoucherViewModelService giftVoucherViewModelService, IGiftVoucherService giftVoucherService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseGiftVoucherController(giftVoucherViewModelService, giftVoucherService, translationService, scope); diff --git a/src/Web/Grand.Web.Admin/Controllers/HomeController.cs b/src/Web/Grand.Web.Admin/Controllers/HomeController.cs index b119c9919d..6f37d39940 100644 --- a/src/Web/Grand.Web.Admin/Controllers/HomeController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/HomeController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.System.Reports; @@ -15,6 +14,7 @@ using Grand.Mediator; using Grand.Web.Common.Filters; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -28,7 +28,7 @@ public class HomeController : BaseHomeControllerWithSetLanguage public HomeController( ICountryService countryService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IStoreService storeService, ICustomerService customerService, diff --git a/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs b/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs index 918ddd9402..fbdc13fda6 100644 --- a/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/KnowledgebaseController.cs @@ -10,6 +10,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -19,11 +20,11 @@ public class KnowledgebaseController : BaseAdminController private readonly IKnowledgebaseService _knowledgebaseService; private readonly IKnowledgebaseViewModelService _knowledgebaseViewModelService; private readonly ILanguageService _languageService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public KnowledgebaseController( IKnowledgebaseViewModelService knowledgebaseViewModelService, - ITranslationService translationService, + IRequestTranslationService translationService, IKnowledgebaseService knowledgebaseService, ILanguageService languageService) { diff --git a/src/Web/Grand.Web.Admin/Controllers/LanguageController.cs b/src/Web/Grand.Web.Admin/Controllers/LanguageController.cs index e2025e40ca..86a580eab9 100644 --- a/src/Web/Grand.Web.Admin/Controllers/LanguageController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/LanguageController.cs @@ -8,6 +8,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -19,7 +20,7 @@ public class LanguageController : BaseAdminController public LanguageController( ILanguageViewModelService languageViewModelService, ILanguageService languageService, - ITranslationService translationService) + IRequestTranslationService translationService) { _languageViewModelService = languageViewModelService; _translationService = translationService; @@ -32,7 +33,7 @@ public LanguageController( private readonly ILanguageViewModelService _languageViewModelService; private readonly ILanguageService _languageService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; #endregion diff --git a/src/Web/Grand.Web.Admin/Controllers/LoginController.cs b/src/Web/Grand.Web.Admin/Controllers/LoginController.cs index 91df581fb8..e5844fb6ab 100644 --- a/src/Web/Grand.Web.Admin/Controllers/LoginController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/LoginController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Authentication; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; using Grand.Domain.Common; @@ -9,13 +8,14 @@ using Grand.Web.AdminShared.Controllers; using Grand.Mediator; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; [Area(Constants.AreaAdmin)] public class LoginController : BaseLoginController { - public LoginController(CustomerSettings customerSettings, CaptchaSettings captchaSettings, ITranslationService translationService, ICustomerManagerService customerManagerService, ICustomerService customerService, IGrandAuthenticationService authenticationService, IMessageProviderService messageProviderService, IContextAccessor contextAccessor, IMediator mediator) : base(customerSettings, captchaSettings, translationService, customerManagerService, customerService, authenticationService, messageProviderService, contextAccessor, mediator) + public LoginController(CustomerSettings customerSettings, CaptchaSettings captchaSettings, IRequestTranslationService translationService, ICustomerManagerService customerManagerService, ICustomerService customerService, IGrandAuthenticationService authenticationService, IMessageProviderService messageProviderService, IContextAccessor contextAccessor, IMediator mediator) : base(customerSettings, captchaSettings, translationService, customerManagerService, customerService, authenticationService, messageProviderService, contextAccessor, mediator) { } } diff --git a/src/Web/Grand.Web.Admin/Controllers/MaintenanceController.cs b/src/Web/Grand.Web.Admin/Controllers/MaintenanceController.cs index 2f0d826619..0bfe6e712f 100644 --- a/src/Web/Grand.Web.Admin/Controllers/MaintenanceController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/MaintenanceController.cs @@ -17,6 +17,7 @@ using Grand.Mediator; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -30,7 +31,7 @@ public MaintenanceController( ISlugService slugService, IDateTimeService dateTimeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IRobotsTxtService robotsTxtService, IMediator mediator, IMediaFileStore mediaFileStore) @@ -53,7 +54,7 @@ public MaintenanceController( private readonly ISlugService _slugService; private readonly IDateTimeService _dateTimeService; private readonly ILanguageService _languageService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IRobotsTxtService _robotsTxtService; private readonly IMediator _mediator; private readonly IMediaFileStore _mediaFileStore; diff --git a/src/Web/Grand.Web.Admin/Controllers/MeasureController.cs b/src/Web/Grand.Web.Admin/Controllers/MeasureController.cs index 4aa49ee158..d5ac70d5e8 100644 --- a/src/Web/Grand.Web.Admin/Controllers/MeasureController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/MeasureController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Catalog.Directory; using Grand.Business.Core.Interfaces.Common.Configuration; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Permissions; using Grand.Domain.Directory; using Grand.Infrastructure.Caching; @@ -10,6 +9,7 @@ using Grand.Web.Common.Extensions; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -20,7 +20,7 @@ public class MeasureController : BaseAdminController public MeasureController(IMeasureService measureService, ISettingService settingService, - ITranslationService translationService, + IRequestTranslationService translationService, MeasureSettings measureSettings, ICacheBase cacheBase) { @@ -37,7 +37,7 @@ public MeasureController(IMeasureService measureService, private readonly IMeasureService _measureService; private readonly ISettingService _settingService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly MeasureSettings _measureSettings; private readonly ICacheBase _cacheBase; diff --git a/src/Web/Grand.Web.Admin/Controllers/MenuController.cs b/src/Web/Grand.Web.Admin/Controllers/MenuController.cs index 5389236a18..48942988df 100644 --- a/src/Web/Grand.Web.Admin/Controllers/MenuController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/MenuController.cs @@ -1,5 +1,4 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Domain.Permissions; +using Grand.Domain.Permissions; using Grand.Web.AdminShared.Extensions.Mapping; using Grand.Web.AdminShared.Interfaces; using Grand.Web.AdminShared.Models.Menu; @@ -7,6 +6,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -17,7 +17,7 @@ public class MenuController : BaseAdminController public MenuController( IMenuViewModelService menuViewModelService, - ITranslationService translationService) + IRequestTranslationService translationService) { _menuViewModelService = menuViewModelService; _translationService = translationService; @@ -28,7 +28,7 @@ public MenuController( #region Fields private readonly IMenuViewModelService _menuViewModelService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; #endregion diff --git a/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs b/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs index f383aca4a3..c8e24a132b 100644 --- a/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/MerchandiseReturnController.cs @@ -1,11 +1,11 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Orders; using Grand.Web.Admin.Extensions; using Grand.Web.AdminShared.Controllers; using Grand.Web.AdminShared.Interfaces; using Grand.Web.Common.Filters; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -15,7 +15,7 @@ namespace Grand.Web.Admin.Controllers; [AuthorizeMenu] public class MerchandiseReturnController( IMerchandiseReturnViewModelService merchandiseReturnViewModelService, - ITranslationService translationService, + IRequestTranslationService translationService, IMerchandiseReturnService merchandiseReturnService, IOrderService orderService, IAdminDataScope scope) diff --git a/src/Web/Grand.Web.Admin/Controllers/MessageTemplateController.cs b/src/Web/Grand.Web.Admin/Controllers/MessageTemplateController.cs index b064f4e6ad..42c40b1d1d 100644 --- a/src/Web/Grand.Web.Admin/Controllers/MessageTemplateController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/MessageTemplateController.cs @@ -14,6 +14,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -25,7 +26,7 @@ public class MessageTemplateController( IMessageTemplateService messageTemplateService, IEmailAccountService emailAccountService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IMessageTokenProvider messageTokenProvider, IDownloadService downloadService, IAdminDataScope scope, diff --git a/src/Web/Grand.Web.Admin/Controllers/NewsController.cs b/src/Web/Grand.Web.Admin/Controllers/NewsController.cs index 51a1014fa6..53f6d1b4ed 100644 --- a/src/Web/Grand.Web.Admin/Controllers/NewsController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/NewsController.cs @@ -20,7 +20,7 @@ public class NewsController( INewsViewModelService newsViewModelService, INewsService newsService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IDateTimeService dateTimeService, IAdminDataScope scope) diff --git a/src/Web/Grand.Web.Admin/Controllers/NewsLetterCategoryController.cs b/src/Web/Grand.Web.Admin/Controllers/NewsLetterCategoryController.cs index 44c9e81965..af77d23113 100644 --- a/src/Web/Grand.Web.Admin/Controllers/NewsLetterCategoryController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/NewsLetterCategoryController.cs @@ -8,6 +8,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -19,7 +20,7 @@ public class NewsletterCategoryController : BaseAdminController public NewsletterCategoryController( INewsletterCategoryService newsletterCategoryService, ILanguageService languageService, - ITranslationService translationService) + IRequestTranslationService translationService) { _newsletterCategoryService = newsletterCategoryService; _languageService = languageService; @@ -32,7 +33,7 @@ public NewsletterCategoryController( private readonly INewsletterCategoryService _newsletterCategoryService; private readonly ILanguageService _languageService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; #endregion diff --git a/src/Web/Grand.Web.Admin/Controllers/NewsLetterSubscriptionController.cs b/src/Web/Grand.Web.Admin/Controllers/NewsLetterSubscriptionController.cs index 409f1f01f1..af38315326 100644 --- a/src/Web/Grand.Web.Admin/Controllers/NewsLetterSubscriptionController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/NewsLetterSubscriptionController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Marketing.Newsletters; using Grand.Domain.Permissions; @@ -13,6 +12,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using System.Globalization; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -23,13 +23,13 @@ public class NewsLetterSubscriptionController : BaseAdminController private readonly INewsletterCategoryService _newsletterCategoryService; private readonly INewsLetterSubscriptionService _newsLetterSubscriptionService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; public NewsLetterSubscriptionController(INewsLetterSubscriptionService newsLetterSubscriptionService, INewsletterCategoryService newsletterCategoryService, IDateTimeService dateTimeService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IContextAccessor contextAccessor) { diff --git a/src/Web/Grand.Web.Admin/Controllers/OnlineCustomerController.cs b/src/Web/Grand.Web.Admin/Controllers/OnlineCustomerController.cs index ab43dd5780..873ab86be9 100644 --- a/src/Web/Grand.Web.Admin/Controllers/OnlineCustomerController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/OnlineCustomerController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Customers; using Grand.Infrastructure; @@ -7,6 +6,7 @@ using Grand.Web.AdminShared.Controllers; using Grand.Web.Common.Filters; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -18,7 +18,7 @@ public class OnlineCustomerController( ICustomerService customerService, IDateTimeService dateTimeService, CustomerSettings customerSettings, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor) : BaseOnlineCustomerController(customerService, dateTimeService, customerSettings, translationService, contextAccessor) { diff --git a/src/Web/Grand.Web.Admin/Controllers/OrderController.cs b/src/Web/Grand.Web.Admin/Controllers/OrderController.cs index 64cffab750..7c18ac079c 100644 --- a/src/Web/Grand.Web.Admin/Controllers/OrderController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/OrderController.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Shipping; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Pdf; using Grand.Business.Core.Interfaces.ExportImport; using Grand.Domain.Orders; @@ -16,6 +15,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -27,7 +27,7 @@ public class OrderController( IOrderViewModelService orderViewModelService, IOrderService orderService, IOrderStatusService orderStatusService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IPdfService pdfService, IMediator mediator, diff --git a/src/Web/Grand.Web.Admin/Controllers/PageController.cs b/src/Web/Grand.Web.Admin/Controllers/PageController.cs index 4a38f56c31..5c0eb20d98 100644 --- a/src/Web/Grand.Web.Admin/Controllers/PageController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/PageController.cs @@ -19,7 +19,7 @@ public class PageController( IPageViewModelService pageViewModelService, IPageService pageService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, IAdminDataScope scope) : BasePageController(pageViewModelService, pageService, languageService, translationService, diff --git a/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs b/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs index cc8b90cf76..e0bf5d671e 100644 --- a/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/PaymentController.cs @@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Permissions; using Grand.Domain.Payments; using Grand.Infrastructure.Plugins; @@ -15,6 +14,7 @@ using Grand.Web.Common.DataSource; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -27,7 +27,7 @@ public PaymentController(IPaymentService paymentService, ISettingService settingService, ICountryService countryService, IShippingMethodService shippingMethodService, - ITranslationService translationService, + IRequestTranslationService translationService, IServiceProvider serviceProvider) { _paymentService = paymentService; @@ -46,7 +46,7 @@ public PaymentController(IPaymentService paymentService, private readonly ISettingService _settingService; private readonly ICountryService _countryService; private readonly IShippingMethodService _shippingMethodService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IServiceProvider _serviceProvider; #endregion diff --git a/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs b/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs index 308b6e5d50..06238608d0 100644 --- a/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/PaymentTransactionController.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Payments; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Payments; using Grand.Mediator; using Grand.Web.Admin.Extensions; @@ -20,7 +19,7 @@ namespace Grand.Web.Admin.Controllers; public class PaymentTransactionController( IPaymentTransactionService paymentTransactionService, IOrderService orderService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, IMediator mediator, IEnumTranslationService enumTranslationService, diff --git a/src/Web/Grand.Web.Admin/Controllers/PermissionController.cs b/src/Web/Grand.Web.Admin/Controllers/PermissionController.cs index b3bb72221b..72bfd78168 100644 --- a/src/Web/Grand.Web.Admin/Controllers/PermissionController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/PermissionController.cs @@ -1,7 +1,6 @@ using DotLiquid.Util; using Grand.Business.Core.Extensions; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Domain.Permissions; using Grand.Infrastructure; @@ -10,6 +9,7 @@ using Grand.Web.Common.Models; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -21,7 +21,7 @@ public class PermissionController : BaseAdminController public PermissionController(IContextAccessor contextAccessor, IPermissionService permissionService, IGroupService groupService, - ITranslationService translationService) + IRequestTranslationService translationService) { _contextAccessor = contextAccessor; _permissionService = permissionService; @@ -36,7 +36,7 @@ public PermissionController(IContextAccessor contextAccessor, private readonly IContextAccessor _contextAccessor; private readonly IPermissionService _permissionService; private readonly IGroupService _groupService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; #endregion diff --git a/src/Web/Grand.Web.Admin/Controllers/PickupPointController.cs b/src/Web/Grand.Web.Admin/Controllers/PickupPointController.cs index 158985dc85..265766716d 100644 --- a/src/Web/Grand.Web.Admin/Controllers/PickupPointController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/PickupPointController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Permissions; using Grand.Web.AdminShared.Controllers; @@ -11,6 +10,7 @@ using Grand.Web.Admin.Extensions; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -25,7 +25,7 @@ public class PickupPointController( IWarehouseService warehouseService, ICountryService countryService, IStoreService storeService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BasePickupPointController(pickupPointService, warehouseService, countryService, storeService, translationService, scope) { diff --git a/src/Web/Grand.Web.Admin/Controllers/PluginController.cs b/src/Web/Grand.Web.Admin/Controllers/PluginController.cs index 8508ebb7f1..43722646be 100644 --- a/src/Web/Grand.Web.Admin/Controllers/PluginController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/PluginController.cs @@ -1,5 +1,4 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Domain.Permissions; +using Grand.Domain.Permissions; using Grand.Infrastructure; using Grand.Infrastructure.Configuration; using Grand.Infrastructure.Plugins; @@ -19,7 +18,7 @@ namespace Grand.Web.Admin.Controllers; [PermissionAuthorize(PermissionSystemName.Plugins)] public class PluginController( - ITranslationService translationService, + IRequestTranslationService translationService, ILogger logger, IHostApplicationLifetime applicationLifetime, IContextAccessor contextAccessor, diff --git a/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs index b4c80e9691..893030d882 100644 --- a/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/ProductAttributeController.cs @@ -7,6 +7,7 @@ using Grand.Web.AdminShared.Interfaces; using Grand.Web.Common.Filters; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -18,7 +19,7 @@ public class ProductAttributeController( IProductService productService, IProductAttributeService productAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, SeoSettings seoSettings, IAdminDataScope scope) : BaseProductAttributeController(productService, productAttributeService, languageService, diff --git a/src/Web/Grand.Web.Admin/Controllers/ProductController.cs b/src/Web/Grand.Web.Admin/Controllers/ProductController.cs index 3288c4aac9..c55a0b4bfb 100644 --- a/src/Web/Grand.Web.Admin/Controllers/ProductController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/ProductController.cs @@ -21,7 +21,7 @@ public class ProductController( IProductService productService, IInventoryManageService inventoryManageService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductReservationService productReservationService, IAuctionService auctionService, IDateTimeService dateTimeService, diff --git a/src/Web/Grand.Web.Admin/Controllers/ProductReviewController.cs b/src/Web/Grand.Web.Admin/Controllers/ProductReviewController.cs index 55c6976334..f4156582e3 100644 --- a/src/Web/Grand.Web.Admin/Controllers/ProductReviewController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/ProductReviewController.cs @@ -1,11 +1,11 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Web.Admin.Extensions; using Grand.Web.AdminShared.Controllers; using Grand.Web.AdminShared.Interfaces; using Grand.Web.Common.Filters; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -16,6 +16,6 @@ namespace Grand.Web.Admin.Controllers; public class ProductReviewController( IProductReviewViewModelService productReviewViewModelService, IProductReviewService productReviewService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseProductReviewController(productReviewViewModelService, productReviewService, translationService, scope); diff --git a/src/Web/Grand.Web.Admin/Controllers/ProductTagsController.cs b/src/Web/Grand.Web.Admin/Controllers/ProductTagsController.cs index 1572e71d95..1248dbe85a 100644 --- a/src/Web/Grand.Web.Admin/Controllers/ProductTagsController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/ProductTagsController.cs @@ -11,6 +11,7 @@ using Grand.Web.Common.Extensions; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -22,14 +23,14 @@ public class ProductTagsController : BaseAdminController private readonly IProductTagService _productTagService; private readonly SeoSettings _seoSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; public ProductTagsController( IProductTagService productTagService, IProductService productService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, SeoSettings seoSettings, IContextAccessor contextAccessor) { diff --git a/src/Web/Grand.Web.Admin/Controllers/PushNotificationsController.cs b/src/Web/Grand.Web.Admin/Controllers/PushNotificationsController.cs index 1d94fcaaa4..9972d8ab3a 100644 --- a/src/Web/Grand.Web.Admin/Controllers/PushNotificationsController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/PushNotificationsController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Marketing.PushNotifications; using Grand.Business.Core.Interfaces.Storage; @@ -10,13 +9,14 @@ using Grand.Web.Common.DataSource; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; [PermissionAuthorize(PermissionSystemName.PushNotifications)] public class PushNotificationsController( PushNotificationsSettings pushNotificationsSettings, - ITranslationService translationService, + IRequestTranslationService translationService, ISettingService settingService, IPushNotificationsService pushNotificationsService, ICustomerService customerService, diff --git a/src/Web/Grand.Web.Admin/Controllers/QueuedEmailController.cs b/src/Web/Grand.Web.Admin/Controllers/QueuedEmailController.cs index 33d4eecd81..fd9df8225c 100644 --- a/src/Web/Grand.Web.Admin/Controllers/QueuedEmailController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/QueuedEmailController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Messages; using Grand.Domain.Permissions; using Grand.Domain; @@ -21,13 +20,13 @@ public class QueuedEmailController : BaseAdminController private readonly IDateTimeService _dateTimeService; private readonly IEmailAccountService _emailAccountService; private readonly IQueuedEmailService _queuedEmailService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IEnumTranslationService _enumTranslationService; public QueuedEmailController(IQueuedEmailService queuedEmailService, IEmailAccountService emailAccountService, IDateTimeService dateTimeService, - ITranslationService translationService, + IRequestTranslationService translationService, IEnumTranslationService enumTranslationService) { _queuedEmailService = queuedEmailService; diff --git a/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs b/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs index 8869c81fc4..c6dd9214bd 100644 --- a/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/ReportsController.cs @@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; @@ -36,7 +35,7 @@ public class ReportsController( IProductService productService, IProductAttributeFormatter productAttributeFormatter, IStockQuantityService stockQuantityService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, ICountryService countryService, IVendorService vendorService, diff --git a/src/Web/Grand.Web.Admin/Controllers/ScheduleTaskController.cs b/src/Web/Grand.Web.Admin/Controllers/ScheduleTaskController.cs index e1a45a3af3..fe58ebf1bb 100644 --- a/src/Web/Grand.Web.Admin/Controllers/ScheduleTaskController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/ScheduleTaskController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.System.ScheduleTasks; using Grand.Domain.Permissions; @@ -11,6 +10,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -21,7 +21,7 @@ public class ScheduleTaskController : BaseAdminController public ScheduleTaskController( IScheduleTaskService scheduleTaskService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, IStoreService storeService) { @@ -36,7 +36,7 @@ public ScheduleTaskController( #region Fields private readonly IScheduleTaskService _scheduleTaskService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IDateTimeService _dateTimeService; private readonly IStoreService _storeService; diff --git a/src/Web/Grand.Web.Admin/Controllers/SearchController.cs b/src/Web/Grand.Web.Admin/Controllers/SearchController.cs index 777679219e..f66c984511 100644 --- a/src/Web/Grand.Web.Admin/Controllers/SearchController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/SearchController.cs @@ -5,7 +5,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Utilities.Catalog; @@ -20,6 +19,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Helpers; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -40,7 +40,7 @@ public class SearchController : BaseSearchController private readonly IPageService _pageService; private readonly IProductService _productService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IVendorService _vendorService; private readonly IContextAccessor _contextAccessor; @@ -48,7 +48,7 @@ public SearchController(IProductService productService, ICategoryService categor IBrandService brandService, ICollectionService collectionService, IPageService pageService, INewsService newsService, IBlogService blogService, ICustomerService customerService, IOrderService orderService, - AdminSearchSettings adminSearchSettings, ITranslationService translationService, IContextAccessor contextAccessor, + AdminSearchSettings adminSearchSettings, IRequestTranslationService translationService, IContextAccessor contextAccessor, IGroupService groupService, IStoreService storeService, IVendorService vendorService) : base(categoryService, brandService, collectionService, adminSearchSettings, contextAccessor) diff --git a/src/Web/Grand.Web.Admin/Controllers/SettingController.cs b/src/Web/Grand.Web.Admin/Controllers/SettingController.cs index 775218bef6..010a364798 100644 --- a/src/Web/Grand.Web.Admin/Controllers/SettingController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/SettingController.cs @@ -45,7 +45,7 @@ namespace Grand.Web.Admin.Controllers; public class SettingController( ISettingService settingService, IPictureService pictureService, - ITranslationService translationService, + IRequestTranslationService translationService, IMerchandiseReturnService merchandiseReturnService, ILanguageService languageService, ICacheBase cacheBase, diff --git a/src/Web/Grand.Web.Admin/Controllers/ShipmentController.cs b/src/Web/Grand.Web.Admin/Controllers/ShipmentController.cs index 65992c9ffa..0a8b8adb27 100644 --- a/src/Web/Grand.Web.Admin/Controllers/ShipmentController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/ShipmentController.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Pdf; using Grand.Domain.Orders; using Grand.Domain.Shipping; @@ -13,6 +12,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -23,7 +23,7 @@ namespace Grand.Web.Admin.Controllers; public class ShipmentController( IShipmentViewModelService shipmentViewModelService, IOrderService orderService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IPdfService pdfService, IShipmentService shipmentService, diff --git a/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs b/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs index 7067bd7377..b0efdde91d 100644 --- a/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/ShippingController.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Permissions; using Grand.Domain; @@ -20,6 +19,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -33,7 +33,7 @@ public ShippingController( IShippingMethodService shippingMethodService, ISettingService settingService, ICountryService countryService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IGroupService groupService) { @@ -54,7 +54,7 @@ public ShippingController( private readonly IShippingMethodService _shippingMethodService; private readonly ISettingService _settingService; private readonly ICountryService _countryService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IStoreService _storeService; private readonly IGroupService _groupService; diff --git a/src/Web/Grand.Web.Admin/Controllers/ShippingMethodController.cs b/src/Web/Grand.Web.Admin/Controllers/ShippingMethodController.cs index fd7b11e781..8edf953793 100644 --- a/src/Web/Grand.Web.Admin/Controllers/ShippingMethodController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/ShippingMethodController.cs @@ -10,6 +10,7 @@ using Grand.Web.Admin.Extensions; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -23,7 +24,7 @@ public class ShippingMethodController( IShippingMethodService shippingMethodService, ILanguageService languageService, IStoreService storeService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseShippingMethodController(shippingMethodService, languageService, storeService, translationService, scope) { diff --git a/src/Web/Grand.Web.Admin/Controllers/ShoppingCartController.cs b/src/Web/Grand.Web.Admin/Controllers/ShoppingCartController.cs index c5bb98aa72..1640cf1428 100644 --- a/src/Web/Grand.Web.Admin/Controllers/ShoppingCartController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/ShoppingCartController.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Catalog.Tax; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Permissions; @@ -14,6 +13,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Grand.Web.Common.Extensions; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -28,7 +28,7 @@ public ShoppingCartController(ICustomerService customerService, IStoreService storeService, ITaxService taxService, IPricingService priceCalculationService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductAttributeFormatter productAttributeFormatter, IProductService productService, IContextAccessor contextAccessor) @@ -55,7 +55,7 @@ public ShoppingCartController(ICustomerService customerService, private readonly IStoreService _storeService; private readonly ITaxService _taxService; private readonly IPricingService _pricingService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IProductAttributeFormatter _productAttributeFormatter; private readonly IProductService _productService; private readonly IContextAccessor _contextAccessor; diff --git a/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs b/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs index 7d28ec6bfd..417ee6516c 100644 --- a/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/SpecificationAttributeController.cs @@ -9,6 +9,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -19,7 +20,7 @@ namespace Grand.Web.Admin.Controllers; public class SpecificationAttributeController( ISpecificationAttributeService specificationAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductService productService, SeoSettings seoSettings, IAdminDataScope scope) diff --git a/src/Web/Grand.Web.Admin/Controllers/StoreController.cs b/src/Web/Grand.Web.Admin/Controllers/StoreController.cs index c3acf13aea..551e40ca75 100644 --- a/src/Web/Grand.Web.Admin/Controllers/StoreController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/StoreController.cs @@ -9,6 +9,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -18,13 +19,13 @@ public class StoreController : BaseAdminController private readonly ILanguageService _languageService; private readonly IStoreService _storeService; private readonly IStoreViewModelService _storeViewModelService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public StoreController( IStoreViewModelService storeViewModelService, IStoreService storeService, ILanguageService languageService, - ITranslationService translationService) + IRequestTranslationService translationService) { _storeViewModelService = storeViewModelService; _storeService = storeService; diff --git a/src/Web/Grand.Web.Admin/Controllers/SystemController.cs b/src/Web/Grand.Web.Admin/Controllers/SystemController.cs index c924b7df95..99a78c15a1 100644 --- a/src/Web/Grand.Web.Admin/Controllers/SystemController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/SystemController.cs @@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Checkout.Payments; using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Permissions; using Grand.Domain.Directory; using Grand.Infrastructure; @@ -16,6 +15,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using System.Runtime.InteropServices; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -30,7 +30,7 @@ public SystemController(IPaymentService paymentService, IMeasureService measureService, IDateTimeService dateTimeService, IContextAccessor contextAccessor, - ITranslationService translationService, + IRequestTranslationService translationService, IHostApplicationLifetime applicationLifetime, IWebHostEnvironment webHostEnvironment, ILogger logger, @@ -64,7 +64,7 @@ public SystemController(IPaymentService paymentService, private readonly IMeasureService _measureService; private readonly IDateTimeService _dateTimeService; private readonly IContextAccessor _contextAccessor; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IHostApplicationLifetime _applicationLifetime; private readonly IWebHostEnvironment _webHostEnvironment; private readonly ILogger _logger; diff --git a/src/Web/Grand.Web.Admin/Controllers/TaxController.cs b/src/Web/Grand.Web.Admin/Controllers/TaxController.cs index 7038a96299..17667d87a5 100644 --- a/src/Web/Grand.Web.Admin/Controllers/TaxController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/TaxController.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Catalog.Tax; using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Directory; using Grand.Domain.Tax; @@ -33,7 +32,7 @@ public class TaxController( ISettingService settingService, IServiceProvider serviceProvider, ICacheBase cacheBase, - ITranslationService translationService, + IRequestTranslationService translationService, ICountryService countryService, IStoreService storeService, IEnumTranslationService enumTranslationService, diff --git a/src/Web/Grand.Web.Admin/Controllers/VendorController.cs b/src/Web/Grand.Web.Admin/Controllers/VendorController.cs index f289b60643..57e55ae919 100644 --- a/src/Web/Grand.Web.Admin/Controllers/VendorController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/VendorController.cs @@ -11,6 +11,7 @@ using Grand.Web.Common.Security.Authorization; using Grand.Mediator; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -21,7 +22,7 @@ public class VendorController : BaseAdminController public VendorController( IVendorViewModelService vendorViewModelService, - ITranslationService translationService, + IRequestTranslationService translationService, IVendorService vendorService, ILanguageService languageService, IMediator mediator) @@ -68,7 +69,7 @@ public async Task Reviews(DataSourceRequest command, string vendo #region Fields private readonly IVendorViewModelService _vendorViewModelService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IVendorService _vendorService; private readonly ILanguageService _languageService; private readonly IMediator _mediator; diff --git a/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs b/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs index 0bd2af55ec..5a00b11d2e 100644 --- a/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/VendorReviewController.cs @@ -1,4 +1,3 @@ -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Permissions; using Grand.Web.AdminShared.Controllers; @@ -8,6 +7,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Admin.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -19,7 +19,7 @@ namespace Grand.Web.Admin.Controllers; public class VendorReviewController( IVendorViewModelService vendorViewModelService, IVendorService vendorService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseVendorReviewController(vendorViewModelService, vendorService, translationService, scope) { diff --git a/src/Web/Grand.Web.Admin/Controllers/WarehouseController.cs b/src/Web/Grand.Web.Admin/Controllers/WarehouseController.cs index 918f979a5e..19811fd3e1 100644 --- a/src/Web/Grand.Web.Admin/Controllers/WarehouseController.cs +++ b/src/Web/Grand.Web.Admin/Controllers/WarehouseController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Permissions; using Grand.Web.AdminShared.Controllers; @@ -11,6 +10,7 @@ using Grand.Web.Admin.Extensions; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Admin.Controllers; @@ -24,7 +24,7 @@ public class WarehouseController( IWarehouseService warehouseService, ICountryService countryService, IStoreService storeService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseWarehouseController(warehouseService, countryService, storeService, translationService, scope) { diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseAddressAttributeController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseAddressAttributeController.cs index dcc7c1388b..e54c710df4 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseAddressAttributeController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseAddressAttributeController.cs @@ -10,6 +10,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -19,7 +20,7 @@ public abstract class BaseAddressAttributeController( IAddressAttributeService addressAttributeService, IAddressAttributeViewModelService addressAttributeViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseController { #region Address attributes diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseBlogController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseBlogController.cs index 49e32ed2d3..3634c6c571 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseBlogController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseBlogController.cs @@ -16,6 +16,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -29,7 +30,7 @@ public abstract class BaseBlogController( IBlogService blogService, IBlogViewModelService blogViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IDateTimeService dateTimeService, IPictureViewModelService pictureViewModelService, @@ -52,7 +53,7 @@ protected virtual void EditWarningCheck(BlogPost blogPost) { } // by name in C#. protected IBlogService BlogService => blogService; protected IDateTimeService DateTimeService => dateTimeService; - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IAdminDataScope PostScope => postScope; protected IAdminDataScope CategoryScope => categoryScope; diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseBrandController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseBrandController.cs index 324fa0cb14..c201373d49 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseBrandController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseBrandController.cs @@ -18,6 +18,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -34,7 +35,7 @@ public abstract class BaseBrandController( IBrandService brandService, IStoreService storeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IPictureViewModelService pictureViewModelService, IAdminDataScope scope) : BaseController @@ -46,7 +47,7 @@ protected virtual void EditWarningCheck(Brand brand) { } // Exposed for host subclasses: primary-constructor parameters are not visible to derived // classes by name in C#, so Store's EditWarningCheck override needs these. - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IAdminDataScope Scope => scope; #region List diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseCategoryController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseCategoryController.cs index ddb196c258..cc1f1c413e 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseCategoryController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseCategoryController.cs @@ -18,6 +18,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -32,7 +33,7 @@ public abstract class BaseCategoryController( ICategoryService categoryService, ICategoryViewModelService categoryViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IPictureViewModelService pictureViewModelService, IProductService productService, IAdminDataScope scope) @@ -45,7 +46,7 @@ protected virtual void EditWarningCheck(Category category) { } // Exposed for host subclasses: primary-constructor parameters are not visible to derived // classes by name in C#, so Store's EditWarningCheck override needs this. - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IAdminDataScope Scope => scope; #region List diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseCheckoutAttributeController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseCheckoutAttributeController.cs index a31ff7e46c..50b0d2a5ee 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseCheckoutAttributeController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseCheckoutAttributeController.cs @@ -14,6 +14,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -22,7 +23,7 @@ namespace Grand.Web.AdminShared.Controllers; public abstract class BaseCheckoutAttributeController( ICheckoutAttributeService checkoutAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, ICurrencyService currencyService, CurrencySettings currencySettings, IMeasureService measureService, diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseCollectionController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseCollectionController.cs index b1d616f546..14f6cc2a6a 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseCollectionController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseCollectionController.cs @@ -20,6 +20,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -36,7 +37,7 @@ public abstract class BaseCollectionController( ICollectionService collectionService, IStoreService storeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IPictureViewModelService pictureViewModelService, IProductService productService, IAdminDataScope scope) @@ -49,7 +50,7 @@ protected virtual void EditWarningCheck(Collection collection) { } // Exposed for host subclasses: primary-constructor parameters are not visible to derived // classes by name in C#, so Store's EditWarningCheck override needs this. - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IAdminDataScope Scope => scope; #region List diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseContactAttributeController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseContactAttributeController.cs index e5d5118188..bb48f8518a 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseContactAttributeController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseContactAttributeController.cs @@ -12,6 +12,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -21,7 +22,7 @@ public abstract class BaseContactAttributeController( IContactAttributeViewModelService contactAttributeViewModelService, IContactAttributeService contactAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseController { #region Contact attributes diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseCustomerAttributeController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseCustomerAttributeController.cs index fcc58b639d..3095d94977 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseCustomerAttributeController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseCustomerAttributeController.cs @@ -10,6 +10,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -18,7 +19,7 @@ public abstract class BaseCustomerAttributeController( ICustomerAttributeService customerAttributeService, ICustomerAttributeViewModelService customerAttributeViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseController { #region Customer attributes diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseCustomerController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseCustomerController.cs index 3e43ec32c9..edfb9063fe 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseCustomerController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseCustomerController.cs @@ -4,7 +4,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Addresses; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Marketing.Customers; @@ -25,6 +24,7 @@ using Grand.Web.Common.Models; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -44,7 +44,7 @@ public abstract class BaseCustomerController( IAddressAttributeService addressAttributeService, IMessageProviderService messageProviderService, IGroupService groupService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, CustomerSettings customerSettings, IAdminDataScope scope) @@ -65,7 +65,7 @@ public abstract class BaseCustomerController( protected IAddressAttributeService AddressAttributeService => addressAttributeService; protected IMessageProviderService MessageProviderService => messageProviderService; protected IGroupService GroupService => groupService; - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IContextAccessor ContextAccessor => contextAccessor; protected CustomerSettings CustomerSettings => customerSettings; protected IAdminDataScope Scope => scope; diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseCustomerManagementController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseCustomerManagementController.cs index cf27fb1a13..d27404cd47 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseCustomerManagementController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseCustomerManagementController.cs @@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Addresses; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.ExportImport; @@ -18,6 +17,7 @@ using Grand.Web.Common.DataSource; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -35,7 +35,7 @@ public abstract class BaseCustomerManagementController( IAddressAttributeService addressAttributeService, IMessageProviderService messageProviderService, IGroupService groupService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, CustomerSettings customerSettings, IAdminDataScope scope, diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseDeliveryDateController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseDeliveryDateController.cs index 7227c3c32b..722b57e7f3 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseDeliveryDateController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseDeliveryDateController.cs @@ -10,6 +10,7 @@ using Grand.Web.Common.DataSource; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -18,7 +19,7 @@ public abstract class BaseDeliveryDateController( IDeliveryDateService deliveryDateService, ILanguageService languageService, IStoreService storeService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseController { protected virtual async Task PrepareDeliveryDateModel(DeliveryDateModel model) diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseDiscountController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseDiscountController.cs index cf9a530881..4c5c9b6d78 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseDiscountController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseDiscountController.cs @@ -4,7 +4,6 @@ using Grand.Business.Core.Interfaces.Catalog.Discounts; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Queries.Catalog; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain.Discounts; @@ -19,6 +18,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -27,7 +27,7 @@ namespace Grand.Web.AdminShared.Controllers; public abstract class BaseDiscountController( IDiscountViewModelService discountViewModelService, IDiscountService discountService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, IMediator mediator, IDiscountProviderLoader discountProviderLoader, diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseEmailAccountController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseEmailAccountController.cs index e04e73d5fd..a2ccbafb3e 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseEmailAccountController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseEmailAccountController.cs @@ -1,4 +1,3 @@ -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Messages; using Grand.Domain.Messages; using Grand.Domain.Permissions; @@ -10,6 +9,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -18,7 +18,7 @@ namespace Grand.Web.AdminShared.Controllers; public abstract class BaseEmailAccountController( IEmailAccountViewModelService emailAccountViewModelService, IEmailAccountService emailAccountService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseController { diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseFullReportsController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseFullReportsController.cs index e81513bcb5..c97e670b5e 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseFullReportsController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseFullReportsController.cs @@ -5,7 +5,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; @@ -35,7 +34,7 @@ public abstract class BaseFullReportsController( IProductService productService, IProductAttributeFormatter productAttributeFormatter, IStockQuantityService stockQuantityService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, ICountryService countryService, IVendorService vendorService, diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseGiftVoucherController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseGiftVoucherController.cs index 8a18c09d1d..baf3442cf9 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseGiftVoucherController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseGiftVoucherController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Checkout.GiftVouchers; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Orders; using Grand.Domain.Permissions; using Grand.Web.AdminShared.Interfaces; @@ -9,6 +8,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -17,7 +17,7 @@ namespace Grand.Web.AdminShared.Controllers; public abstract class BaseGiftVoucherController( IGiftVoucherViewModelService giftVoucherViewModelService, IGiftVoucherService giftVoucherService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseController { @@ -28,7 +28,7 @@ protected virtual void EditWarningCheck(GiftVoucher giftVoucher) { } // Exposed for host subclasses: primary-constructor parameters are not visible to derived // classes by name in C#, so Store's EditWarningCheck override needs this. - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IAdminDataScope Scope => scope; #region List diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseHomeController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseHomeController.cs index 778a75232e..62ec37bf1d 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseHomeController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseHomeController.cs @@ -1,14 +1,14 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Web.Common.Controllers; using Grand.Web.Common.Security.ExternalRegistration; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; public abstract class BaseHomeController( ICountryService countryService, - ITranslationService translationService) + IRequestTranslationService translationService) : BaseController { /// diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseHomeControllerWithSetLanguage.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseHomeControllerWithSetLanguage.cs index a6c7e84a82..3da0e57b36 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseHomeControllerWithSetLanguage.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseHomeControllerWithSetLanguage.cs @@ -4,12 +4,13 @@ using Grand.Domain.Customers; using Grand.Infrastructure; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; public abstract class BaseHomeControllerWithSetLanguage( ICountryService countryService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor) : BaseHomeController(countryService, translationService) { diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseLoginController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseLoginController.cs index 57e0912557..c8a990e4cd 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseLoginController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseLoginController.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Events.Customers; using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; using Grand.Domain.Common; @@ -15,6 +14,7 @@ using Grand.Mediator; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -27,13 +27,13 @@ public abstract class BaseLoginController : BaseController private readonly CustomerSettings _customerSettings; private readonly IMediator _mediator; private readonly IMessageProviderService _messageProviderService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; public BaseLoginController( CustomerSettings customerSettings, CaptchaSettings captchaSettings, - ITranslationService translationService, + IRequestTranslationService translationService, ICustomerManagerService customerManagerService, ICustomerService customerService, IGrandAuthenticationService authenticationService, diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseMerchandiseReturnController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseMerchandiseReturnController.cs index a82e6a4fc9..1bd5ee46a3 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseMerchandiseReturnController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseMerchandiseReturnController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Orders; using Grand.Domain.Permissions; using Grand.Web.AdminShared.Extensions; @@ -9,6 +8,7 @@ using Grand.Web.Common.DataSource; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -16,7 +16,7 @@ namespace Grand.Web.AdminShared.Controllers; [AutoValidateAntiforgeryToken] public abstract class BaseMerchandiseReturnController( IMerchandiseReturnViewModelService merchandiseReturnViewModelService, - ITranslationService translationService, + IRequestTranslationService translationService, IMerchandiseReturnService merchandiseReturnService, IOrderService orderService, IAdminDataScope scope) @@ -25,7 +25,7 @@ public abstract class BaseMerchandiseReturnController( // Exposed for host subclasses: primary-constructor parameters aren't visible to derived classes // by name in C#. protected IMerchandiseReturnViewModelService MerchandiseReturnViewModelService => merchandiseReturnViewModelService; - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IMerchandiseReturnService MerchandiseReturnService => merchandiseReturnService; protected IOrderService OrderService => orderService; protected IAdminDataScope Scope => scope; diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseMessageTemplateController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseMessageTemplateController.cs index 7029562e48..cba903c8c4 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseMessageTemplateController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseMessageTemplateController.cs @@ -11,6 +11,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -20,7 +21,7 @@ public abstract class BaseMessageTemplateController( IMessageTemplateService messageTemplateService, IEmailAccountService emailAccountService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IMessageTokenProvider messageTokenProvider, IDownloadService downloadService, IAdminDataScope scope, @@ -34,7 +35,7 @@ public abstract class BaseMessageTemplateController( protected IMessageTemplateService MessageTemplateService => messageTemplateService; /// See . - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; public IActionResult Index() => RedirectToAction("List"); diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseNewsController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseNewsController.cs index be7eefaf7d..6acfef0a72 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseNewsController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseNewsController.cs @@ -14,6 +14,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -23,7 +24,7 @@ public abstract class BaseNewsController( INewsViewModelService newsViewModelService, INewsService newsService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IDateTimeService dateTimeService, IAdminDataScope scope) @@ -35,7 +36,7 @@ protected virtual void EditWarningCheck(NewsItem newsItem) { } // by name in C#. protected INewsService NewsService => newsService; protected IDateTimeService DateTimeService => dateTimeService; - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IAdminDataScope Scope => scope; #region News items diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseOnlineCustomerController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseOnlineCustomerController.cs index ebc3f19224..f701c12a6d 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseOnlineCustomerController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseOnlineCustomerController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Customers; using Grand.Domain.Permissions; @@ -9,6 +8,7 @@ using Grand.Web.Common.DataSource; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -18,7 +18,7 @@ public abstract class BaseOnlineCustomerController( ICustomerService customerService, IDateTimeService dateTimeService, CustomerSettings customerSettings, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor) : BaseController { diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseOrderController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseOrderController.cs index 64a002b715..ccb969b6db 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseOrderController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseOrderController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Pdf; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain.Orders; @@ -11,6 +10,7 @@ using Grand.Web.Common.DataSource; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -19,7 +19,7 @@ namespace Grand.Web.AdminShared.Controllers; public abstract class BaseOrderController( IOrderViewModelService orderViewModelService, IOrderService orderService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IPdfService pdfService, IAdminDataScope scope) @@ -29,7 +29,7 @@ public abstract class BaseOrderController( // derived classes by name in C#). protected IOrderViewModelService OrderViewModelService => orderViewModelService; protected IOrderService OrderService => orderService; - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IContextAccessor ContextAccessor => contextAccessor; protected IPdfService PdfService => pdfService; protected IAdminDataScope Scope => scope; diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseOrderManagementController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseOrderManagementController.cs index 9f7478123e..b7cdde1706 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseOrderManagementController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseOrderManagementController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Commands.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Pdf; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain.Orders; @@ -13,6 +12,7 @@ using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using Grand.Business.Core.Queries.Checkout.Orders; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -20,7 +20,7 @@ public abstract class BaseOrderManagementController( IOrderViewModelService orderViewModelService, IOrderService orderService, IOrderStatusService orderStatusService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IPdfService pdfService, IMediator mediator, diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BasePageController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BasePageController.cs index e0f8621302..5ff9b9e1ac 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BasePageController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BasePageController.cs @@ -13,6 +13,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -22,7 +23,7 @@ public abstract class BasePageController( IPageViewModelService pageViewModelService, IPageService pageService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, IAdminDataScope scope) : BaseController @@ -35,7 +36,7 @@ protected virtual void EditWarningCheck(Page page) { } protected IPageService PageService => pageService; protected ILanguageService LanguageService => languageService; protected IDateTimeService DateTimeService => dateTimeService; - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IAdminDataScope Scope => scope; #region List diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BasePaymentTransactionController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BasePaymentTransactionController.cs index 7e8531fc17..f7932ce9fd 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BasePaymentTransactionController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BasePaymentTransactionController.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Payments; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Queries.Checkout.Orders; using Grand.Domain.Payments; using Grand.Domain.Permissions; @@ -24,7 +23,7 @@ namespace Grand.Web.AdminShared.Controllers; public abstract class BasePaymentTransactionController( IPaymentTransactionService paymentTransactionService, IOrderService orderService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, IMediator mediator, IEnumTranslationService enumTranslationService, @@ -36,7 +35,7 @@ public abstract class BasePaymentTransactionController( // every other Base*Controller and so Task 3/4's own file sections can reference them). protected IPaymentTransactionService PaymentTransactionService => paymentTransactionService; protected IOrderService OrderService => orderService; - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IDateTimeService DateTimeService => dateTimeService; protected IMediator Mediator => mediator; protected IEnumTranslationService EnumTranslationService => enumTranslationService; diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BasePickupPointController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BasePickupPointController.cs index 93bf9b6b4e..753ccaf54a 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BasePickupPointController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BasePickupPointController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Directory; using Grand.Domain.Shipping; @@ -11,6 +10,7 @@ using Grand.Web.Common.DataSource; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -20,7 +20,7 @@ public abstract class BasePickupPointController( IWarehouseService warehouseService, ICountryService countryService, IStoreService storeService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseController { protected virtual async Task PreparePickupPointModel(PickupPointModel model) diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseProductAttributeController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseProductAttributeController.cs index 82beba38e7..cae1e10361 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseProductAttributeController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseProductAttributeController.cs @@ -12,6 +12,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -21,7 +22,7 @@ public abstract class BaseProductAttributeController( IProductService productService, IProductAttributeService productAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, SeoSettings seoSettings, IAdminDataScope scope) : BaseController { diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseProductController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseProductController.cs index d8039f7710..c3933e236e 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseProductController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseProductController.cs @@ -37,7 +37,7 @@ public abstract class BaseProductController( IProductService productService, IInventoryManageService inventoryManageService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductReservationService productReservationService, IAuctionService auctionService, IDateTimeService dateTimeService, @@ -48,7 +48,7 @@ public abstract class BaseProductController( { protected virtual void EditWarningCheck(Product product) { } - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IAdminDataScope Scope => scope; #region Product list / create / edit / delete diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseProductReviewController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseProductReviewController.cs index 167386f84b..e5a0ed57cd 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseProductReviewController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseProductReviewController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain.Catalog; using Grand.Domain.Permissions; @@ -10,6 +9,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -18,7 +18,7 @@ namespace Grand.Web.AdminShared.Controllers; public abstract class BaseProductReviewController( IProductReviewViewModelService productReviewViewModelService, IProductReviewService productReviewService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseController { diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseReportsController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseReportsController.cs index ffa261a35b..ddfcbcc91d 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseReportsController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseReportsController.cs @@ -5,7 +5,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.System.Reports; @@ -35,7 +34,7 @@ public abstract class BaseReportsController( IProductService productService, IProductAttributeFormatter productAttributeFormatter, IStockQuantityService stockQuantityService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, ICountryService countryService, IVendorService vendorService, @@ -56,7 +55,7 @@ public abstract class BaseReportsController( protected IProductService ProductService => productService; protected IProductAttributeFormatter ProductAttributeFormatter => productAttributeFormatter; protected IStockQuantityService StockQuantityService => stockQuantityService; - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IStoreService StoreService => storeService; protected ICountryService CountryService => countryService; protected IVendorService VendorService => vendorService; diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseShipmentController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseShipmentController.cs index 1013b42fce..7fc27f72b9 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseShipmentController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseShipmentController.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Pdf; using Grand.Domain.Orders; using Grand.Domain.Permissions; @@ -17,6 +16,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -25,7 +25,7 @@ namespace Grand.Web.AdminShared.Controllers; public abstract class BaseShipmentController( IShipmentViewModelService shipmentViewModelService, IOrderService orderService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IPdfService pdfService, IShipmentService shipmentService, @@ -40,7 +40,7 @@ public abstract class BaseShipmentController( // C#). protected IShipmentViewModelService ShipmentViewModelService => shipmentViewModelService; protected IOrderService OrderService => orderService; - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IContextAccessor ContextAccessor => contextAccessor; protected IPdfService PdfService => pdfService; protected IShipmentService ShipmentService => shipmentService; diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseShippingMethodController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseShippingMethodController.cs index 763651d504..d7a1f7d3ac 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseShippingMethodController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseShippingMethodController.cs @@ -10,6 +10,7 @@ using Grand.Web.Common.DataSource; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -18,7 +19,7 @@ public abstract class BaseShippingMethodController( IShippingMethodService shippingMethodService, ILanguageService languageService, IStoreService storeService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseController { protected virtual async Task PrepareShippingMethodModel(ShippingMethodModel model) diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseSpecificationAttributeController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseSpecificationAttributeController.cs index 447a7ff393..21b80b5d2e 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseSpecificationAttributeController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseSpecificationAttributeController.cs @@ -13,6 +13,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -21,7 +22,7 @@ namespace Grand.Web.AdminShared.Controllers; public abstract class BaseSpecificationAttributeController( ISpecificationAttributeService specificationAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductService productService, SeoSettings seoSettings, IAdminDataScope scope) : BaseController diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseTaxCategoryController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseTaxCategoryController.cs index 85f3735988..043630b4c7 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseTaxCategoryController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseTaxCategoryController.cs @@ -1,7 +1,6 @@ #nullable enable using Grand.Business.Core.Interfaces.Catalog.Tax; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Permissions; using Grand.Domain.Tax; @@ -13,6 +12,7 @@ using Grand.Web.Common.Extensions; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -26,7 +26,7 @@ namespace Grand.Web.AdminShared.Controllers; public abstract class BaseTaxCategoryController( ITaxCategoryService taxCategoryService, IStoreService storeService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseController { @@ -40,7 +40,7 @@ public abstract class BaseTaxCategoryController( protected IStoreService StoreService => storeService; /// See . - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; /// See . protected IAdminDataScope Scope => scope; diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseVendorReviewController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseVendorReviewController.cs index b2cf5e2a87..8926784f03 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseVendorReviewController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseVendorReviewController.cs @@ -1,4 +1,3 @@ -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Permissions; using Grand.Domain.Vendors; @@ -9,6 +8,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -17,7 +17,7 @@ namespace Grand.Web.AdminShared.Controllers; public abstract class BaseVendorReviewController( IVendorViewModelService vendorViewModelService, IVendorService vendorService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseController { @@ -26,7 +26,7 @@ public abstract class BaseVendorReviewController( // C#). protected IVendorViewModelService VendorViewModelService => vendorViewModelService; protected IVendorService VendorService => vendorService; - protected ITranslationService TranslationService => translationService; + protected IRequestTranslationService TranslationService => translationService; protected IAdminDataScope Scope => scope; /// DRY replacement for the repeated "load vendor review, redirect to List if not found diff --git a/src/Web/Grand.Web.AdminShared/Controllers/BaseWarehouseController.cs b/src/Web/Grand.Web.AdminShared/Controllers/BaseWarehouseController.cs index c2da91f3ad..127e75f432 100644 --- a/src/Web/Grand.Web.AdminShared/Controllers/BaseWarehouseController.cs +++ b/src/Web/Grand.Web.AdminShared/Controllers/BaseWarehouseController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Directory; using Grand.Web.AdminShared.Extensions.Mapping; @@ -10,6 +9,7 @@ using Grand.Web.Common.DataSource; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Controllers; @@ -18,7 +18,7 @@ public abstract class BaseWarehouseController( IWarehouseService warehouseService, ICountryService countryService, IStoreService storeService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseController { protected virtual async Task PrepareWarehouseModel(WarehouseModel model) diff --git a/src/Web/Grand.Web.AdminShared/Services/AffiliateViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/AffiliateViewModelService.cs index 1b066fbe51..92df3825f6 100644 --- a/src/Web/Grand.Web.AdminShared/Services/AffiliateViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/AffiliateViewModelService.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Catalog.Prices; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Affiliates; using Grand.Domain.Directory; @@ -30,12 +29,12 @@ public class AffiliateViewModelService : IAffiliateViewModelService private readonly IOrderStatusService _orderStatusService; private readonly IPriceFormatter _priceFormatter; private readonly SeoSettings _seoSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; private readonly IEnumTranslationService _enumTranslationService; public AffiliateViewModelService(IContextAccessor contextAccessor, ICountryService countryService, IPriceFormatter priceFormatter, IAffiliateService affiliateService, - ICustomerService customerService, IOrderService orderService, ITranslationService translationService, + ICustomerService customerService, IOrderService orderService, IRequestTranslationService translationService, IDateTimeService dateTimeService, IOrderStatusService orderStatusService, SeoSettings seoSettings, ICurrencyService currencyService, IEnumTranslationService enumTranslationService) diff --git a/src/Web/Grand.Web.AdminShared/Services/BlogViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/BlogViewModelService.cs index cfd7cd1786..0cebeb8815 100644 --- a/src/Web/Grand.Web.AdminShared/Services/BlogViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/BlogViewModelService.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Seo; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; @@ -29,7 +28,7 @@ public class BlogViewModelService : IBlogViewModelService private readonly IPictureService _pictureService; private readonly IProductService _productService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IVendorService _vendorService; private readonly IContextAccessor _contextAccessor; private readonly ISeNameService _seNameService; @@ -41,7 +40,7 @@ public BlogViewModelService( IStoreService storeService, IPictureService pictureService, ICustomerService customerService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductService productService, IVendorService vendorService, IContextAccessor contextAccessor, diff --git a/src/Web/Grand.Web.AdminShared/Services/CategoryViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/CategoryViewModelService.cs index 3f35911937..d0ca8e29cf 100644 --- a/src/Web/Grand.Web.AdminShared/Services/CategoryViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/CategoryViewModelService.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Catalog.Categories; using Grand.Business.Core.Interfaces.Catalog.Discounts; using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Seo; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; @@ -29,7 +28,7 @@ public class CategoryViewModelService : ICategoryViewModelService private readonly IProductCategoryService _productCategoryService; private readonly IProductService _productService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IVendorService _vendorService; private readonly ISeNameService _seNameService; private readonly IEnumTranslationService _enumTranslationService; @@ -39,7 +38,7 @@ public CategoryViewModelService( IProductCategoryService productCategoryService, ICategoryLayoutService categoryLayoutService, IDiscountService discountService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IPictureService pictureService, IProductService productService, diff --git a/src/Web/Grand.Web.AdminShared/Services/CheckoutAttributeViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/CheckoutAttributeViewModelService.cs index 33753db972..8cb2a254ec 100644 --- a/src/Web/Grand.Web.AdminShared/Services/CheckoutAttributeViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/CheckoutAttributeViewModelService.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Catalog.Tax; using Grand.Business.Core.Interfaces.Checkout.CheckoutAttributes; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain.Catalog; using Grand.Domain.Common; @@ -19,7 +18,7 @@ namespace Grand.Web.AdminShared.Services; public class CheckoutAttributeViewModelService( ICheckoutAttributeService checkoutAttributeService, ICheckoutAttributeParser checkoutAttributeParser, - ITranslationService translationService, + IRequestTranslationService translationService, ITaxCategoryService taxCategoryService, ICurrencyService currencyService, CurrencySettings currencySettings, diff --git a/src/Web/Grand.Web.AdminShared/Services/CollectionViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/CollectionViewModelService.cs index 3afcbf8947..0c0a484839 100644 --- a/src/Web/Grand.Web.AdminShared/Services/CollectionViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/CollectionViewModelService.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Catalog.Collections; using Grand.Business.Core.Interfaces.Catalog.Discounts; using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Seo; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; @@ -31,7 +30,7 @@ public class CollectionViewModelService : ICollectionViewModelService private readonly IProductService _productService; private readonly IStoreService _storeService; private readonly IPictureService _pictureService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IDiscountService _discountService; private readonly IVendorService _vendorService; private readonly IContextAccessor _contextAccessor; @@ -49,7 +48,7 @@ public CollectionViewModelService( IProductService productService, IStoreService storeService, IPictureService pictureService, - ITranslationService translationService, + IRequestTranslationService translationService, IDiscountService discountService, IVendorService vendorService, IContextAccessor contextAccessor, diff --git a/src/Web/Grand.Web.AdminShared/Services/ContactFormViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/ContactFormViewModelService.cs index f0a23c3d71..8738762a45 100644 --- a/src/Web/Grand.Web.AdminShared/Services/ContactFormViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/ContactFormViewModelService.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Marketing.Contacts; using Grand.Business.Core.Interfaces.Messages; @@ -8,6 +7,7 @@ using Grand.Web.AdminShared.Interfaces; using Grand.Web.AdminShared.Models.Messages; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Services; @@ -17,11 +17,11 @@ public class ContactFormViewModelService : IContactFormViewModelService private readonly IDateTimeService _dateTimeService; private readonly IEmailAccountService _emailAccountService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public ContactFormViewModelService(IContactUsService contactUsService, IDateTimeService dateTimeService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IEmailAccountService emailAccountService) { diff --git a/src/Web/Grand.Web.AdminShared/Services/CourseViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/CourseViewModelService.cs index 5a3a4bf15c..e149659c24 100644 --- a/src/Web/Grand.Web.AdminShared/Services/CourseViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/CourseViewModelService.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Seo; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; @@ -24,7 +23,7 @@ public class CourseViewModelService( ICourseLessonService courseLessonService, ICourseSubjectService courseSubjectService, IPictureService pictureService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductCourseService productCourseService, IDownloadService downloadService, IProductService productService, diff --git a/src/Web/Grand.Web.AdminShared/Services/CurrencyViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/CurrencyViewModelService.cs index 9e9c5f2bc7..fbbc3b0083 100644 --- a/src/Web/Grand.Web.AdminShared/Services/CurrencyViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/CurrencyViewModelService.cs @@ -1,12 +1,12 @@ using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Directory; using Grand.Infrastructure.Caching; using Grand.Web.AdminShared.Extensions.Mapping; using Grand.Web.AdminShared.Interfaces; using Grand.Web.AdminShared.Models.Directory; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Services; @@ -18,7 +18,7 @@ public class CurrencyViewModelService : ICurrencyViewModelService private readonly IStoreService _storeService; private readonly CurrencySettings _currencySettings; private readonly ISettingService _settingService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly ICacheBase _cacheBase; #endregion @@ -29,7 +29,7 @@ public CurrencyViewModelService(ICurrencyService currencyService, IStoreService storeService, CurrencySettings currencySettings, ISettingService settingService, - ITranslationService translationService, + IRequestTranslationService translationService, ICacheBase cacheBase) { _currencyService = currencyService; diff --git a/src/Web/Grand.Web.AdminShared/Services/CustomerGroupViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/CustomerGroupViewModelService.cs index 9e72049d1d..d78ffad1be 100644 --- a/src/Web/Grand.Web.AdminShared/Services/CustomerGroupViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/CustomerGroupViewModelService.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Catalog; @@ -21,7 +20,7 @@ public class CustomerGroupViewModelService : ICustomerGroupViewModelService private readonly IGroupService _groupService; private readonly IProductService _productService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IVendorService _vendorService; private readonly IEnumTranslationService _enumTranslationService; @@ -30,7 +29,7 @@ public class CustomerGroupViewModelService : ICustomerGroupViewModelService public CustomerGroupViewModelService( IGroupService groupService, ICustomerGroupProductService customerGroupProductService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductService productService, IStoreService storeService, IVendorService vendorService, diff --git a/src/Web/Grand.Web.AdminShared/Services/CustomerReportViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/CustomerReportViewModelService.cs index 2c67419caa..148ac1e270 100644 --- a/src/Web/Grand.Web.AdminShared/Services/CustomerReportViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/CustomerReportViewModelService.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Catalog.Prices; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.System.Reports; using Grand.Domain.Payments; @@ -21,12 +20,12 @@ public class CustomerReportViewModelService : ICustomerReportViewModelService private readonly IDateTimeService _dateTimeService; private readonly IOrderStatusService _orderStatusService; private readonly IPriceFormatter _priceFormatter; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IEnumTranslationService _enumTranslationService; public CustomerReportViewModelService( ICustomerService customerService, - ITranslationService translationService, ICustomerReportService customerReportService, + IRequestTranslationService translationService, ICustomerReportService customerReportService, IDateTimeService dateTimeService, IPriceFormatter priceFormatter, IOrderStatusService orderStatusService, ICurrencyService currencyService, IEnumTranslationService enumTranslationService) { diff --git a/src/Web/Grand.Web.AdminShared/Services/CustomerTagViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/CustomerTagViewModelService.cs index 7ae52d31ee..c6308f20ef 100644 --- a/src/Web/Grand.Web.AdminShared/Services/CustomerTagViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/CustomerTagViewModelService.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Marketing.Customers; @@ -20,12 +19,12 @@ public class CustomerTagViewModelService : ICustomerTagViewModelService private readonly ICustomerTagService _customerTagService; private readonly IProductService _productService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IVendorService _vendorService; private readonly IEnumTranslationService _enumTranslationService; public CustomerTagViewModelService( - ITranslationService translationService, + IRequestTranslationService translationService, IProductService productService, IStoreService storeService, IVendorService vendorService, diff --git a/src/Web/Grand.Web.AdminShared/Services/CustomerViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/CustomerViewModelService.cs index d3b2154665..ec5ec8d565 100644 --- a/src/Web/Grand.Web.AdminShared/Services/CustomerViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/CustomerViewModelService.cs @@ -6,7 +6,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Addresses; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Marketing.Contacts; @@ -69,7 +68,7 @@ public class CustomerViewModelService : ICustomerViewModelService private readonly IStoreService _storeService; private readonly TaxSettings _taxSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IVendorService _vendorService; private readonly IContextAccessor _contextAccessor; private readonly IEnumTranslationService _enumTranslationService; @@ -80,7 +79,7 @@ public CustomerViewModelService( ICustomerProductService customerProductService, INewsLetterSubscriptionService newsLetterSubscriptionService, IDateTimeService dateTimeService, - ITranslationService translationService, + IRequestTranslationService translationService, ILoyaltyPointsService loyaltyPointsService, ICountryService countryService, IContextAccessor contextAccessor, diff --git a/src/Web/Grand.Web.AdminShared/Services/DiscountViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/DiscountViewModelService.cs index 581d3608e3..60aa33aafd 100644 --- a/src/Web/Grand.Web.AdminShared/Services/DiscountViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/DiscountViewModelService.cs @@ -6,7 +6,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Queries.Catalog; @@ -30,7 +29,7 @@ public class DiscountViewModelService : IDiscountViewModelService #region Constructors public DiscountViewModelService(IDiscountService discountService, - ITranslationService translationService, + IRequestTranslationService translationService, ICurrencyService currencyService, ICategoryService categoryService, IProductService productService, @@ -69,7 +68,7 @@ public DiscountViewModelService(IDiscountService discountService, #region Fields private readonly IDiscountService _discountService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly ICurrencyService _currencyService; private readonly ICategoryService _categoryService; private readonly IProductService _productService; diff --git a/src/Web/Grand.Web.AdminShared/Services/DocumentViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/DocumentViewModelService.cs index afd39f1f0e..6bcbae074d 100644 --- a/src/Web/Grand.Web.AdminShared/Services/DocumentViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/DocumentViewModelService.cs @@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Shipping; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Marketing.Documents; using Grand.Business.Core.Interfaces.Storage; @@ -14,6 +13,7 @@ using Grand.Web.AdminShared.Interfaces; using Grand.Web.AdminShared.Models.Documents; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Services; @@ -30,7 +30,7 @@ public class DocumentViewModelService : IDocumentViewModelService private readonly IProductService _productService; private readonly ISalesEmployeeService _salesEmployeeService; private readonly IShipmentService _shipmentService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IVendorService _vendorService; public DocumentViewModelService( @@ -38,7 +38,7 @@ public DocumentViewModelService( IDocumentTypeService documentTypeService, ICustomerService customerService, IOrderService orderService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductService productService, IShipmentService shipmentService, IMerchandiseReturnService merchandiseReturnService, diff --git a/src/Web/Grand.Web.AdminShared/Services/EmailAccountViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/EmailAccountViewModelService.cs index 837f7522b4..df8c6406d0 100644 --- a/src/Web/Grand.Web.AdminShared/Services/EmailAccountViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/EmailAccountViewModelService.cs @@ -1,11 +1,11 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Business.Core.Interfaces.Common.Stores; +using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Messages; using Grand.Domain.Messages; using Grand.Web.AdminShared.Extensions.Mapping; using Grand.Web.AdminShared.Interfaces; using Grand.Web.AdminShared.Models.Messages; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Services; @@ -14,10 +14,10 @@ public class EmailAccountViewModelService : IEmailAccountViewModelService private readonly IEmailAccountService _emailAccountService; private readonly IEmailSender _emailSender; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public EmailAccountViewModelService(IEmailAccountService emailAccountService, IEmailSender emailSender, - IStoreService storeService, ITranslationService translationService) + IStoreService storeService, IRequestTranslationService translationService) { _emailAccountService = emailAccountService; _emailSender = emailSender; diff --git a/src/Web/Grand.Web.AdminShared/Services/GiftVoucherViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/GiftVoucherViewModelService.cs index 0ffb313a45..0112652f59 100644 --- a/src/Web/Grand.Web.AdminShared/Services/GiftVoucherViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/GiftVoucherViewModelService.cs @@ -12,6 +12,7 @@ using Grand.Web.AdminShared.Interfaces; using Grand.Web.AdminShared.Models.Orders; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Services; @@ -25,7 +26,7 @@ public GiftVoucherViewModelService( IDateTimeService dateTimeService, ICurrencyService currencyService, LanguageSettings languageSettings, - ITranslationService translationService, ILanguageService languageService, + IRequestTranslationService translationService, ILanguageService languageService, IContextAccessor contextAccessor, IStoreService storeService) { @@ -235,7 +236,7 @@ public virtual async private readonly IDateTimeService _dateTimeService; private readonly ICurrencyService _currencyService; private readonly LanguageSettings _languageSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly ILanguageService _languageService; private readonly IStoreService _storeService; diff --git a/src/Web/Grand.Web.AdminShared/Services/LanguageViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/LanguageViewModelService.cs index 98eae1b1e0..91dde0a6a9 100644 --- a/src/Web/Grand.Web.AdminShared/Services/LanguageViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/LanguageViewModelService.cs @@ -6,6 +6,7 @@ using Grand.Web.AdminShared.Models.Localization; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Services; @@ -15,7 +16,7 @@ public class LanguageViewModelService : ILanguageViewModelService #region Fields private readonly ILanguageService _languageService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly ICurrencyService _currencyService; private readonly IWebHostEnvironment _hostingEnvironment; @@ -24,7 +25,7 @@ public class LanguageViewModelService : ILanguageViewModelService #region Constructors public LanguageViewModelService(ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, ICurrencyService currencyService, IWebHostEnvironment hostingEnvironment) { diff --git a/src/Web/Grand.Web.AdminShared/Services/MerchandiseReturnViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/MerchandiseReturnViewModelService.cs index 9d9bf62e10..10c0477b34 100644 --- a/src/Web/Grand.Web.AdminShared/Services/MerchandiseReturnViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/MerchandiseReturnViewModelService.cs @@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Addresses; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; using Grand.Business.Core.Interfaces.Storage; @@ -27,7 +26,7 @@ public class MerchandiseReturnViewModelService( IProductService productService, ICustomerService customerService, IDateTimeService dateTimeService, - ITranslationService translationService, + IRequestTranslationService translationService, IMessageProviderService messageProviderService, LanguageSettings languageSettings, IMerchandiseReturnService merchandiseReturnService, diff --git a/src/Web/Grand.Web.AdminShared/Services/NewsViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/NewsViewModelService.cs index 353e4f3740..4afc47e8f2 100644 --- a/src/Web/Grand.Web.AdminShared/Services/NewsViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/NewsViewModelService.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Seo; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Storage; @@ -12,6 +11,7 @@ using Grand.Web.AdminShared.Interfaces; using Grand.Web.AdminShared.Models.News; using Grand.Web.Common.Extensions; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Services; @@ -21,7 +21,7 @@ public class NewsViewModelService : INewsViewModelService private readonly INewsService _newsService; private readonly IDateTimeService _dateTimeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IPictureService _pictureService; private readonly ICustomerService _customerService; private readonly ISeNameService _seNameService; @@ -32,7 +32,7 @@ public class NewsViewModelService : INewsViewModelService public NewsViewModelService(INewsService newsService, IDateTimeService dateTimeService, - ITranslationService translationService, + IRequestTranslationService translationService, IPictureService pictureService, ICustomerService customerService, ISeNameService seNameService) diff --git a/src/Web/Grand.Web.AdminShared/Services/OrderViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/OrderViewModelService.cs index 5ca2a698be..dbe5749b78 100644 --- a/src/Web/Grand.Web.AdminShared/Services/OrderViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/OrderViewModelService.cs @@ -49,7 +49,7 @@ public class OrderViewModelService : IOrderViewModelService private readonly IDateTimeService _dateTimeService; private readonly IPriceFormatter _priceFormatter; private readonly IDiscountService _discountService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; private readonly ICurrencyService _currencyService; private readonly IPaymentService _paymentService; @@ -92,7 +92,7 @@ public OrderViewModelService(IOrderService orderService, IDateTimeService dateTimeService, IPriceFormatter priceFormatter, IDiscountService discountService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, ICurrencyService currencyService, IPaymentService paymentService, diff --git a/src/Web/Grand.Web.AdminShared/Services/PageViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/PageViewModelService.cs index 84cefb678b..c97a473974 100644 --- a/src/Web/Grand.Web.AdminShared/Services/PageViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/PageViewModelService.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Seo; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Pages; @@ -8,6 +7,7 @@ using Grand.Web.AdminShared.Interfaces; using Grand.Web.AdminShared.Models.Pages; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Services; @@ -17,13 +17,13 @@ public class PageViewModelService : IPageViewModelService private readonly IPageLayoutService _pageLayoutService; private readonly IPageService _pageService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly ISeNameService _seNameService; public PageViewModelService( IPageLayoutService pageLayoutService, IPageService pageService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IDateTimeService dateTimeService, ISeNameService seNameService) diff --git a/src/Web/Grand.Web.AdminShared/Services/PanelPasswordRecoveryService.cs b/src/Web/Grand.Web.AdminShared/Services/PanelPasswordRecoveryService.cs index 00e117d219..bddf0f5c1e 100644 --- a/src/Web/Grand.Web.AdminShared/Services/PanelPasswordRecoveryService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/PanelPasswordRecoveryService.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; @@ -10,6 +9,7 @@ using Grand.Infrastructure; using Grand.Web.AdminShared.Extensions; using Grand.Web.AdminShared.Interfaces; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Services; @@ -21,7 +21,7 @@ public class PanelPasswordRecoveryService( IPermissionService permissionService, IVendorService vendorService, IMessageProviderService messageProviderService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, CustomerSettings customerSettings, IExternalSignInPolicy externalSignInPolicy) : IPanelPasswordRecoveryService diff --git a/src/Web/Grand.Web.AdminShared/Services/ProductReviewViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/ProductReviewViewModelService.cs index 4a75e29d68..1a469f981e 100644 --- a/src/Web/Grand.Web.AdminShared/Services/ProductReviewViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/ProductReviewViewModelService.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Events.Catalog; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Catalog; @@ -13,6 +12,7 @@ using Grand.Web.Common.Extensions; using Grand.Mediator; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Services; @@ -24,7 +24,7 @@ public class ProductReviewViewModelService : IProductReviewViewModelService private readonly IProductReviewService _productReviewService; private readonly IProductService _productService; private readonly IStoreService _storeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public ProductReviewViewModelService( IProductService productService, @@ -32,7 +32,7 @@ public ProductReviewViewModelService( ICustomerService customerService, IStoreService storeService, IDateTimeService dateTimeService, - ITranslationService translationService, + IRequestTranslationService translationService, IMediator mediator) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.cs index 1bff05291b..6221d4a0be 100644 --- a/src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/ProductViewModelService.cs @@ -51,7 +51,7 @@ public class ProductViewModelService( ICategoryService categoryService, IProductCategoryService productCategoryService, IVendorService vendorService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductLayoutService productLayoutService, ISpecificationAttributeService specificationAttributeService, IContextAccessor contextAccessor, diff --git a/src/Web/Grand.Web.AdminShared/Services/ShipmentViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/ShipmentViewModelService.cs index 8acc461ef1..ee5e2e3fec 100644 --- a/src/Web/Grand.Web.AdminShared/Services/ShipmentViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/ShipmentViewModelService.cs @@ -4,7 +4,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Storage; using Grand.Domain.Catalog; using Grand.Domain.Directory; @@ -14,6 +13,7 @@ using Grand.Web.AdminShared.Interfaces; using Grand.Web.AdminShared.Models.Orders; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Services; @@ -31,7 +31,7 @@ public class ShipmentViewModelService : IShipmentViewModelService private readonly IShippingService _shippingService; private readonly ShippingSettings _shippingSettings; private readonly IStockQuantityService _stockQuantityService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IWarehouseService _warehouseService; private readonly IContextAccessor _contextAccessor; private readonly IAdminDataScope _scope; @@ -45,7 +45,7 @@ public ShipmentViewModelService( IMeasureService measureService, IDateTimeService dateTimeService, ICountryService countryService, - ITranslationService translationService, + IRequestTranslationService translationService, IDownloadService downloadService, IShippingService shippingService, IStockQuantityService stockQuantityService, diff --git a/src/Web/Grand.Web.AdminShared/Services/VendorViewModelService.cs b/src/Web/Grand.Web.AdminShared/Services/VendorViewModelService.cs index 34376b3e5b..cc7c97ce1a 100644 --- a/src/Web/Grand.Web.AdminShared/Services/VendorViewModelService.cs +++ b/src/Web/Grand.Web.AdminShared/Services/VendorViewModelService.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Events.Customers; using Grand.Business.Core.Interfaces.Catalog.Discounts; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Seo; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; @@ -17,6 +16,7 @@ using Grand.Web.AdminShared.Models.Vendors; using Grand.Mediator; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Services; @@ -24,7 +24,7 @@ public class VendorViewModelService( IDiscountService discountService, IVendorService vendorService, ICustomerService customerService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, ICountryService countryService, IStoreService storeService, diff --git a/src/Web/Grand.Web.AdminShared/Validators/Affiliate/AffiliateValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Affiliate/AffiliateValidator.cs index ff8a36224d..fb4b566dce 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Affiliate/AffiliateValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Affiliate/AffiliateValidator.cs @@ -1,14 +1,14 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Affiliates; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Affiliate; public class AffiliateValidator : BaseGrandValidator { public AffiliateValidator(IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Blogs/BlogCategoryValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Blogs/BlogCategoryValidator.cs index 4fa2107677..fd260e4c5d 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Blogs/BlogCategoryValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Blogs/BlogCategoryValidator.cs @@ -1,14 +1,14 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Blogs; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Blogs; public class BlogCategoryValidator : BaseGrandValidator { public BlogCategoryValidator(IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Blogs/BlogPostValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Blogs/BlogPostValidator.cs index 95e39909d2..5e6c1a5d0c 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Blogs/BlogPostValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Blogs/BlogPostValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Blogs; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Blogs; @@ -9,7 +9,7 @@ public class BlogPostValidator : BaseGrandValidator { public BlogPostValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Title) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddAssociatedProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddAssociatedProductModelValidator.cs index c166e28141..dbce059820 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddAssociatedProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddAssociatedProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -13,7 +13,7 @@ public class AddAssociatedProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddBundleProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddBundleProductModelValidator.cs index d2b870f8d4..1b977192e5 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddBundleProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddBundleProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -12,7 +12,7 @@ public class AddBundleProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddCategoryProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddCategoryProductModelValidator.cs index 54857e60a0..67845035d9 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddCategoryProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddCategoryProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Categories; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -12,7 +12,7 @@ public class AddCategoryProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, ICategoryService categoryService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, ICategoryService categoryService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _categoryService = categoryService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddCollectionProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddCollectionProductModelValidator.cs index 049cdda4f2..7346371f99 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddCollectionProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddCollectionProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Collections; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -12,7 +12,7 @@ public class AddCollectionProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, ICollectionService collectionService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, ICollectionService collectionService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _collectionService = collectionService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddCrossSellProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddCrossSellProductModelValidator.cs index 2e0496b0aa..33aaf60bf7 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddCrossSellProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddCrossSellProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -12,7 +12,7 @@ public class AddCrossSellProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddProductPriceModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddProductPriceModelValidator.cs index 1c27688bf7..24e35e9aab 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddProductPriceModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddProductPriceModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -12,7 +12,7 @@ public class AddProductPriceModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs index f4bf7497e7..a56bd77be6 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddProductSpecificationAttributeModelValidator.cs @@ -1,10 +1,10 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -13,7 +13,7 @@ public class AddProductSpecificationAttributeModelValidator : BaseStoreAccessVal private readonly IProductService _productService; public AddProductSpecificationAttributeModelValidator( IEnumerable> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor, + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor, ISpecificationAttributeService specificationAttributeService) : base(validators, translationService, contextAccessor) { diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddRecomendedProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddRecomendedProductModelValidator.cs index 80359c23e8..eb5f5d714d 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddRecomendedProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddRecomendedProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -12,7 +12,7 @@ public class AddRecomendedProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddRelatedProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddRelatedProductModelValidator.cs index 43e55d37a0..5b28bc7019 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddRelatedProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddRelatedProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -12,7 +12,7 @@ public class AddRelatedProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddSimilarProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddSimilarProductModelValidator.cs index 8d67306ebf..f57124e11e 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddSimilarProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AddSimilarProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -12,7 +12,7 @@ public class AddSimilarProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AssociatedProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AssociatedProductModelValidator.cs index 9a5a3d8fbf..6bb9940cdc 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/AssociatedProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/AssociatedProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -12,7 +12,7 @@ public class AssociatedProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/BaseStoreAccessValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/BaseStoreAccessValidator.cs index 81c615fe0a..d354735879 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/BaseStoreAccessValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/BaseStoreAccessValidator.cs @@ -1,21 +1,21 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Infrastructure.Validators; +using Grand.Infrastructure.Validators; using Grand.Infrastructure; using FluentValidation; using Grand.Domain; using Grand.Domain.Stores; using Grand.Web.AdminShared.Extensions; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog { public abstract class BaseStoreAccessValidator : BaseGrandValidator where TEntity : BaseEntity, IStoreLinkEntity where TModel : class { protected readonly IContextAccessor _contextAccessor; - protected readonly ITranslationService _translationService; + protected readonly IRequestTranslationService _translationService; protected BaseStoreAccessValidator( IEnumerable> validators, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor) : base(validators) { diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/BrandValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/BrandValidator.cs index 0676ea9f99..6ae9b6511e 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/BrandValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/BrandValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -9,7 +9,7 @@ public class BrandValidator : BaseGrandValidator { public BrandValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/BundleProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/BundleProductModelValidator.cs index 865800fb9d..586162242a 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/BundleProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/BundleProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -12,7 +12,7 @@ public class BundleProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/CategoryProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/CategoryProductModelValidator.cs index 4c11fb118f..e438fd9c24 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/CategoryProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/CategoryProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Categories; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -12,7 +12,7 @@ public class CategoryProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, ICategoryService categoryService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, ICategoryService categoryService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _categoryService = categoryService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/CategoryValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/CategoryValidator.cs index a940c27df7..150a2d46e2 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/CategoryValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/CategoryValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -9,7 +9,7 @@ public class CategoryValidator : BaseGrandValidator { public CategoryValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/CollectionProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/CollectionProductModelValidator.cs index c900d147ee..31ea476abe 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/CollectionProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/CollectionProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Collections; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -12,7 +12,7 @@ public class CollectionProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, ICollectionService collectionService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, ICollectionService collectionService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _collectionService = collectionService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/CollectionValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/CollectionValidator.cs index f34d0fa227..a37208dc4c 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/CollectionValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/CollectionValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -9,7 +9,7 @@ public class CollectionValidator : BaseGrandValidator { public CollectionValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/CrossSellProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/CrossSellProductModelValidator.cs index a82ec5d00c..12c6b2d020 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/CrossSellProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/CrossSellProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -13,7 +13,7 @@ public class CrossSellProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/PredefinedProductAttributeValueModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/PredefinedProductAttributeValueModelValidator.cs index 9143e532cb..a94c0d70fd 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/PredefinedProductAttributeValueModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/PredefinedProductAttributeValueModelValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -9,7 +9,7 @@ public class PredefinedProductAttributeValueModelValidator : BaseGrandValidator< { public PredefinedProductAttributeValueModelValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductAttributeMappingModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductAttributeMappingModelValidator.cs index 3d4d352caf..d25aed03de 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductAttributeMappingModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductAttributeMappingModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -13,7 +13,7 @@ public class ProductAttributeMappingModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductAttributeValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductAttributeValidator.cs index 6c55cfac4c..079f37c4d5 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductAttributeValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductAttributeValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -9,7 +9,7 @@ public class ProductAttributeValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductAttributeValueModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductAttributeValueModelValidator.cs index b2f1e10aa5..1799084895 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductAttributeValueModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductAttributeValueModelValidator.cs @@ -1,10 +1,10 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -13,7 +13,7 @@ public class ProductAttributeValueModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductCategoryModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductCategoryModelValidator.cs index eafbc44207..a0d88fe67a 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductCategoryModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductCategoryModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -13,7 +13,7 @@ public class ProductCategoryModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductCollectionModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductCollectionModelValidator.cs index 55d8494a88..88df881df6 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductCollectionModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductCollectionModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -13,7 +13,7 @@ public class ProductCollectionModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductPictureModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductPictureModelValidator.cs index db88ddd6e4..2d874fc1f8 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductPictureModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductPictureModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -13,7 +13,7 @@ public class ProductPictureModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductReviewValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductReviewValidator.cs index 952d892d1c..c9e2f8e2fa 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductReviewValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductReviewValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -9,7 +9,7 @@ public class ProductReviewValidator : BaseGrandValidator { public ProductReviewValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Title).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductSpecificationAttributeModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductSpecificationAttributeModelValidator.cs index 688383744c..d2d682bb11 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductSpecificationAttributeModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductSpecificationAttributeModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -13,7 +13,7 @@ public class ProductSpecificationAttributeModelValidator : BaseStoreAccessValida public ProductSpecificationAttributeModelValidator( IEnumerable> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductTagValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductTagValidator.cs index 2cc763cd19..65e4681843 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductTagValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductTagValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -9,7 +9,7 @@ public class ProductTagValidator : BaseGrandValidator { public ProductTagValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductValidator.cs index 8172877322..244576627d 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/ProductValidator.cs @@ -1,9 +1,9 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Domain.Common; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -11,7 +11,7 @@ public class ProductValidator : BaseGrandValidator { public ProductValidator( IEnumerable> validators, - ITranslationService translationService, CommonSettings commonSettings) + IRequestTranslationService translationService, CommonSettings commonSettings) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/RecomendedProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/RecomendedProductModelValidator.cs index f9390f0689..5649d6919a 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/RecomendedProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/RecomendedProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -13,7 +13,7 @@ public class RecomendedProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/RelatedProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/RelatedProductModelValidator.cs index 19bad7cb9a..0ef8219c11 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/RelatedProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/RelatedProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -13,7 +13,7 @@ public class RelatedProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/SimilarProductModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/SimilarProductModelValidator.cs index 176587bd26..32b7cb85df 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/SimilarProductModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/SimilarProductModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -13,7 +13,7 @@ public class SimilarProductModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/SpecificationAttributeOptionValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/SpecificationAttributeOptionValidator.cs index a4a6712520..390936d398 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/SpecificationAttributeOptionValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/SpecificationAttributeOptionValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -9,7 +9,7 @@ public class SpecificationAttributeOptionValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/SpecificationAttributeValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/SpecificationAttributeValidator.cs index 8e14b468d3..05e85e6e57 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/SpecificationAttributeValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/SpecificationAttributeValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -9,7 +9,7 @@ public class SpecificationAttributeValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Catalog/TierPriceModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Catalog/TierPriceModelValidator.cs index 28603cbc34..5fd80168e0 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Catalog/TierPriceModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Catalog/TierPriceModelValidator.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Catalog; @@ -13,7 +13,7 @@ public class TierPriceModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; @@ -31,7 +31,7 @@ public class TierPriceDeleteModelValidator : BaseStoreAccessValidator> validators, - ITranslationService translationService, IProductService productService, IContextAccessor contextAccessor) + IRequestTranslationService translationService, IProductService productService, IContextAccessor contextAccessor) : base(validators, translationService, contextAccessor) { _productService = productService; diff --git a/src/Web/Grand.Web.AdminShared/Validators/Common/AddressAttributeValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Common/AddressAttributeValidator.cs index eec8ede204..de469c8123 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Common/AddressAttributeValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Common/AddressAttributeValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Common; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Common; @@ -9,7 +9,7 @@ public class AddressAttributeValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Common/AddressAttributeValueValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Common/AddressAttributeValueValidator.cs index a77f05da0e..2fccbe789f 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Common/AddressAttributeValueValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Common/AddressAttributeValueValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Common; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Common; @@ -9,7 +9,7 @@ public class AddressAttributeValueValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Common/AddressValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Common/AddressValidator.cs index a22b11f2bc..fbed655c35 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Common/AddressValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Common/AddressValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Common; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Common; @@ -9,7 +9,7 @@ public class AddressValidator : BaseGrandValidator { public AddressValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.FirstName) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Common/LoginValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Common/LoginValidator.cs index 6e700b8a72..fa46a851d8 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Common/LoginValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Common/LoginValidator.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Events.Customers; using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Common; @@ -17,6 +16,7 @@ using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Common; @@ -26,7 +26,7 @@ public LoginValidator( IEnumerable> validators, IEnumerable> validatorsCaptcha, ICustomerService customerService, IGroupService groupService, IEncryptionService encryptionService, - ITranslationService translationService, CustomerSettings customerSettings, CaptchaSettings captchaSettings, + IRequestTranslationService translationService, CustomerSettings customerSettings, CaptchaSettings captchaSettings, IHttpContextAccessor contextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator, IExternalSignInPolicy externalSignInPolicy) : base(validators) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Common/MenuValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Common/MenuValidator.cs index b10070c3d8..f363807d95 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Common/MenuValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Common/MenuValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Menu; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Common; @@ -9,7 +9,7 @@ public class MenuValidator : BaseGrandValidator { public MenuValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.SystemName) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Common/PasswordRecoveryConfirmValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Common/PasswordRecoveryConfirmValidator.cs index 2e164b4e37..9afb30e9bb 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Common/PasswordRecoveryConfirmValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Common/PasswordRecoveryConfirmValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Customers; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Common; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Common; @@ -14,7 +14,7 @@ public class PasswordRecoveryConfirmValidator : BaseGrandValidator> validators, - ITranslationService translationService, CustomerSettings customerSettings) + IRequestTranslationService translationService, CustomerSettings customerSettings) : base(validators) { RuleFor(x => x.NewPassword).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Common/PasswordRecoveryValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Common/PasswordRecoveryValidator.cs index 943dc36e3d..a46153279d 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Common/PasswordRecoveryValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Common/PasswordRecoveryValidator.cs @@ -1,5 +1,4 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Common; using Grand.Infrastructure.Models; using Grand.Infrastructure.Validators; @@ -7,6 +6,7 @@ using Grand.Web.AdminShared.Models.Common; using Grand.Web.Common.Validators; using Microsoft.AspNetCore.Http; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Common; @@ -19,7 +19,7 @@ public class PasswordRecoveryValidator : BaseGrandValidator> validators, IEnumerable> validatorsCaptcha, - ITranslationService translationService, CaptchaSettings captchaSettings, + IRequestTranslationService translationService, CaptchaSettings captchaSettings, IHttpContextAccessor contextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator) : base(validators) { diff --git a/src/Web/Grand.Web.AdminShared/Validators/Common/ReviewValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Common/ReviewValidator.cs index 518c87e5c7..a596799bb0 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Common/ReviewValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Common/ReviewValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Common; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Common; @@ -9,7 +9,7 @@ public class ReviewValidator : BaseGrandValidator { public ReviewValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Title) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Common/UserFieldValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Common/UserFieldValidator.cs index 026935450f..706e3b266d 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Common/UserFieldValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Common/UserFieldValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Common; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Common; @@ -9,7 +9,7 @@ public class UserFieldValidator : BaseGrandValidator { public UserFieldValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Id) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Course/CourseLessonValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Course/CourseLessonValidator.cs index 6901e7508b..e323d8e972 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Course/CourseLessonValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Course/CourseLessonValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Courses; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Course; @@ -9,7 +9,7 @@ public class CourseLessonValidator : BaseGrandValidator { public CourseLessonValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Course/CourseLevelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Course/CourseLevelValidator.cs index 5f650d1708..0a4b457986 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Course/CourseLevelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Course/CourseLevelValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Courses; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Course; @@ -9,7 +9,7 @@ public class CourseLevelValidator : BaseGrandValidator { public CourseLevelValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Course/CourseSubjectValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Course/CourseSubjectValidator.cs index b87e6b8546..4c337c6676 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Course/CourseSubjectValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Course/CourseSubjectValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Courses; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Course; @@ -9,7 +9,7 @@ public class CourseSubjectValidator : BaseGrandValidator { public CourseSubjectValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Course/CourseValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Course/CourseValidator.cs index bd8b084971..52c0cd9146 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Course/CourseValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Course/CourseValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Courses; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Course; @@ -10,7 +10,7 @@ public class CourseValidator : BaseGrandValidator { public CourseValidator( IEnumerable> validators, - ITranslationService translationService, + IRequestTranslationService translationService, IProductService productService, IProductCourseService productCourseService) : base(validators) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerAddressValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerAddressValidator.cs index 5dec1550fa..235f3e24ed 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerAddressValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerAddressValidator.cs @@ -1,11 +1,11 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Common.Addresses; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Extensions; using Grand.Web.AdminShared.Models.Common; using Grand.Web.AdminShared.Models.Customers; using Grand.Web.AdminShared.Validators.Common; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Customers; @@ -16,7 +16,7 @@ public CustomerAddressValidator( IEnumerable> addressvalidators, IAddressAttributeParser addressAttributeParser, IAddressAttributeService addressAttributeService, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Address).SetValidator(new AddressValidator(addressvalidators, translationService)); diff --git a/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerAttributeValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerAttributeValidator.cs index e0dd81252f..dba496c9ae 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerAttributeValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerAttributeValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Customers; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Customers; @@ -9,7 +9,7 @@ public class CustomerAttributeValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerAttributeValueValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerAttributeValueValidator.cs index e6f06b222d..888c31dc25 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerAttributeValueValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerAttributeValueValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Customers; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Customers; @@ -9,7 +9,7 @@ public class CustomerAttributeValueValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerGroupValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerGroupValidator.cs index 53e6de1d0e..e1570103e7 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerGroupValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerGroupValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Customers; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Customers; @@ -11,7 +11,7 @@ public class CustomerGroupValidator : BaseGrandValidator public CustomerGroupValidator( IEnumerable> validators, IGroupService groupService, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerTagValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerTagValidator.cs index 15c42909f9..a311f2176e 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerTagValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerTagValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Customers; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Customers; @@ -9,7 +9,7 @@ public class CustomerTagValidator : BaseGrandValidator { public CustomerTagValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerValidator.cs index 041059c58b..e56cfb508f 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Customers/CustomerValidator.cs @@ -1,6 +1,5 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Customers; using Grand.Infrastructure; @@ -9,6 +8,7 @@ using Grand.SharedKernel.Extensions; using Grand.Web.AdminShared.Models.Customers; using System.Text.RegularExpressions; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Customers; @@ -16,7 +16,7 @@ public class CustomerValidator : BaseGrandValidator { public CustomerValidator( IEnumerable> validators, - ITranslationService translationService, + IRequestTranslationService translationService, ICountryService countryService, IContextAccessor contextAccessor, ICustomerService customerService, diff --git a/src/Web/Grand.Web.AdminShared/Validators/Customers/SalesEmployeeValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Customers/SalesEmployeeValidator.cs index 49c6401379..d20f59442f 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Customers/SalesEmployeeValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Customers/SalesEmployeeValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Customers; using Grand.Web.AdminShared.Validators.Common; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Customers; @@ -10,7 +10,7 @@ public class SalesEmployeeValidator : BaseGrandValidator { public SalesEmployeeValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Customers/UserApiCreateValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Customers/UserApiCreateValidator.cs index db1c6a4cf3..71e6653831 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Customers/UserApiCreateValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Customers/UserApiCreateValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Customers; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Customers; @@ -10,7 +10,7 @@ public class UserApiCreateValidator : BaseGrandValidator { public UserApiCreateValidator( IEnumerable> validators, - ITranslationService translationService, ICustomerService customerService) + IRequestTranslationService translationService, ICustomerService customerService) : base(validators) { RuleFor(x => x.Password).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Customers/UserApiValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Customers/UserApiValidator.cs index 0bcf11a5f7..7e1a04bdcf 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Customers/UserApiValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Customers/UserApiValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Customers; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Customers; @@ -10,7 +10,7 @@ public class UserApiValidator : BaseGrandValidator { public UserApiValidator( IEnumerable> validators, - ITranslationService translationService, ICustomerService customerService) + IRequestTranslationService translationService, ICustomerService customerService) : base(validators) { RuleFor(x => x.Email).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Directory/CountryValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Directory/CountryValidator.cs index 51b60a6a56..6bbb48f2f6 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Directory/CountryValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Directory/CountryValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Directory; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Directory; @@ -9,7 +9,7 @@ public class CountryValidator : BaseGrandValidator { public CountryValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Directory/CurrencyValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Directory/CurrencyValidator.cs index 2fb7dc60c0..dff180ee71 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Directory/CurrencyValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Directory/CurrencyValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Directory; using System.Globalization; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Directory; @@ -10,7 +10,7 @@ public class CurrencyValidator : BaseGrandValidator { public CurrencyValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Directory/MeasureDimensionValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Directory/MeasureDimensionValidator.cs index a55a511cbb..afeecb9696 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Directory/MeasureDimensionValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Directory/MeasureDimensionValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Directory; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Directory; @@ -9,7 +9,7 @@ public class MeasureDimensionValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Directory/MeasureUnitValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Directory/MeasureUnitValidator.cs index bb18282002..25017e57fc 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Directory/MeasureUnitValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Directory/MeasureUnitValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Directory; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Directory; @@ -9,7 +9,7 @@ public class MeasureUnitValidator : BaseGrandValidator { public MeasureUnitValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Directory/MeasureWeightValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Directory/MeasureWeightValidator.cs index acd9d83cb0..27675149d0 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Directory/MeasureWeightValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Directory/MeasureWeightValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Directory; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Directory; @@ -9,7 +9,7 @@ public class MeasureWeightValidator : BaseGrandValidator { public MeasureWeightValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Directory/RobotsTxtValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Directory/RobotsTxtValidator.cs index 1782e903d3..cc59053f77 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Directory/RobotsTxtValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Directory/RobotsTxtValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Directory; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Directory; @@ -9,7 +9,7 @@ public class RobotsTxtValidator : BaseGrandValidator { public RobotsTxtValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Directory/StateProvinceValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Directory/StateProvinceValidator.cs index c667d392c5..058df38272 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Directory/StateProvinceValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Directory/StateProvinceValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Directory; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Directory; @@ -9,7 +9,7 @@ public class StateProvinceValidator : BaseGrandValidator { public StateProvinceValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Discounts/DiscountValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Discounts/DiscountValidator.cs index 6087ba7aa0..20f00e8e0a 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Discounts/DiscountValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Discounts/DiscountValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Discounts; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Discounts; @@ -9,7 +9,7 @@ public class DiscountValidator : BaseGrandValidator { public DiscountValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Documents/DocumentTypeValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Documents/DocumentTypeValidator.cs index 2b8d1f6302..d383402b5b 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Documents/DocumentTypeValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Documents/DocumentTypeValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Documents; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Documents; @@ -9,7 +9,7 @@ public class DocumentTypeValidator : BaseGrandValidator { public DocumentTypeValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Documents/DocumentValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Documents/DocumentValidator.cs index 6d0fe0dba6..097a8f3fe9 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Documents/DocumentValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Documents/DocumentValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Documents; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Documents; @@ -9,7 +9,7 @@ public class DocumentValidator : BaseGrandValidator { public DocumentValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Knowledgebase/KnowledgebaseArticleModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Knowledgebase/KnowledgebaseArticleModelValidator.cs index 5202abb66b..d3dae867a2 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Knowledgebase/KnowledgebaseArticleModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Knowledgebase/KnowledgebaseArticleModelValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Cms; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Knowledgebase; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Knowledgebase; @@ -10,7 +10,7 @@ public class KnowledgebaseArticleModelValidator : BaseGrandValidator> validators, - ITranslationService translationService, IKnowledgebaseService knowledgebaseService) + IRequestTranslationService translationService, IKnowledgebaseService knowledgebaseService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Knowledgebase/KnowledgebaseCategoryModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Knowledgebase/KnowledgebaseCategoryModelValidator.cs index 192b157f46..9d278c736b 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Knowledgebase/KnowledgebaseCategoryModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Knowledgebase/KnowledgebaseCategoryModelValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Cms; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Knowledgebase; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Knowledgebase; @@ -10,7 +10,7 @@ public class KnowledgebaseCategoryModelValidator : BaseGrandValidator> validators, - ITranslationService translationService, IKnowledgebaseService knowledgebaseService) + IRequestTranslationService translationService, IKnowledgebaseService knowledgebaseService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Layouts/BrandLayoutValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Layouts/BrandLayoutValidator.cs index 5e5cb06d80..b34cee14fc 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Layouts/BrandLayoutValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Layouts/BrandLayoutValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Layouts; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Layouts; @@ -9,7 +9,7 @@ public class BrandLayoutValidator : BaseGrandValidator { public BrandLayoutValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Layouts/CategoryLayoutValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Layouts/CategoryLayoutValidator.cs index 0285d3118e..f440f536a1 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Layouts/CategoryLayoutValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Layouts/CategoryLayoutValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Layouts; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Layouts; @@ -9,7 +9,7 @@ public class CategoryLayoutValidator : BaseGrandValidator { public CategoryLayoutValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Layouts/CollectionLayoutValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Layouts/CollectionLayoutValidator.cs index 6b3edb600b..b6bcf8d4fd 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Layouts/CollectionLayoutValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Layouts/CollectionLayoutValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Layouts; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Layouts; @@ -9,7 +9,7 @@ public class CollectionLayoutValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Layouts/PageLayoutValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Layouts/PageLayoutValidator.cs index 9ad67f5987..a09c0fbbf3 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Layouts/PageLayoutValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Layouts/PageLayoutValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Layouts; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Layouts; @@ -9,7 +9,7 @@ public class PageLayoutValidator : BaseGrandValidator { public PageLayoutValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Layouts/ProductLayoutValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Layouts/ProductLayoutValidator.cs index 7574dd35b1..cbf5a2275d 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Layouts/ProductLayoutValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Layouts/ProductLayoutValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Layouts; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Layouts; @@ -9,7 +9,7 @@ public class ProductLayoutValidator : BaseGrandValidator { public ProductLayoutValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Localization/LanguageResourceValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Localization/LanguageResourceValidator.cs index f9fd13f673..81b45568cf 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Localization/LanguageResourceValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Localization/LanguageResourceValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Localization; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Localization; @@ -9,7 +9,7 @@ public class LanguageResourceValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Localization/LanguageValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Localization/LanguageValidator.cs index bab532f81b..777795f0f1 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Localization/LanguageValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Localization/LanguageValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Localization; using System.Globalization; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Localization; @@ -10,7 +10,7 @@ public class LanguageValidator : BaseGrandValidator { public LanguageValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Messages/CampaignValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Messages/CampaignValidator.cs index fd9c003232..3f1b933d23 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Messages/CampaignValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Messages/CampaignValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Messages; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Messages; @@ -9,7 +9,7 @@ public class CampaignValidator : BaseGrandValidator { public CampaignValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Messages/ContactAttributeValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Messages/ContactAttributeValidator.cs index 48a777f84e..f26eab8378 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Messages/ContactAttributeValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Messages/ContactAttributeValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Messages; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Messages; @@ -9,7 +9,7 @@ public class ContactAttributeValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Messages/ContactAttributeValueValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Messages/ContactAttributeValueValidator.cs index 2f0e9d4f03..fa29478398 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Messages/ContactAttributeValueValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Messages/ContactAttributeValueValidator.cs @@ -1,9 +1,9 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Marketing.Contacts; using Grand.Domain.Catalog; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Messages; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Messages; @@ -12,7 +12,7 @@ public class ContactAttributeValueValidator : BaseGrandValidator> validators, IContactAttributeService contactAttributeService, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Messages/EmailAccountValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Messages/EmailAccountValidator.cs index 33520fb56f..bc637d69f8 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Messages/EmailAccountValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Messages/EmailAccountValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Messages; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Messages; @@ -9,7 +9,7 @@ public class EmailAccountValidator : BaseGrandValidator { public EmailAccountValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Email).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Messages/MessageTemplateValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Messages/MessageTemplateValidator.cs index ed05e40f87..b0c8cc0c49 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Messages/MessageTemplateValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Messages/MessageTemplateValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Messages; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Messages; @@ -9,7 +9,7 @@ public class MessageTemplateValidator : BaseGrandValidator { public MessageTemplateValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Subject).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Messages/NewsLetterSubscriptionValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Messages/NewsLetterSubscriptionValidator.cs index d94d657e56..29a0c40c83 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Messages/NewsLetterSubscriptionValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Messages/NewsLetterSubscriptionValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Messages; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Messages; @@ -9,7 +9,7 @@ public class NewsLetterSubscriptionValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Email).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Messages/NewsletterCategoryValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Messages/NewsletterCategoryValidator.cs index 1eebda7ed5..666c7285b3 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Messages/NewsletterCategoryValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Messages/NewsletterCategoryValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Messages; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Messages; @@ -9,7 +9,7 @@ public class NewsletterCategoryValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Messages/QueuedEmailValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Messages/QueuedEmailValidator.cs index 1b50426c53..5a268c9340 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Messages/QueuedEmailValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Messages/QueuedEmailValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Messages; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Messages; @@ -9,7 +9,7 @@ public class QueuedEmailValidator : BaseGrandValidator { public QueuedEmailValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.From).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/News/NewsItemValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/News/NewsItemValidator.cs index 1837b030c1..19ac868e6d 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/News/NewsItemValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/News/NewsItemValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.News; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.News; @@ -9,7 +9,7 @@ public class NewsItemValidator : BaseGrandValidator { public NewsItemValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Title).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Orders/CheckoutAttributeValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Orders/CheckoutAttributeValidator.cs index 1810beb6be..165d7e3aab 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Orders/CheckoutAttributeValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Orders/CheckoutAttributeValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Orders; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Orders; @@ -9,7 +9,7 @@ public class CheckoutAttributeValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Orders/CheckoutAttributeValueValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Orders/CheckoutAttributeValueValidator.cs index c7846ef6ee..542f370ec1 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Orders/CheckoutAttributeValueValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Orders/CheckoutAttributeValueValidator.cs @@ -1,9 +1,9 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Checkout.CheckoutAttributes; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Orders; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Orders; @@ -12,7 +12,7 @@ public class CheckoutAttributeValueValidator : BaseGrandValidator> validators, ICheckoutAttributeService checkoutAttributeService, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Orders/GiftVoucherDeleteModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Orders/GiftVoucherDeleteModelValidator.cs index a4d72d0749..1651e5d9e4 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Orders/GiftVoucherDeleteModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Orders/GiftVoucherDeleteModelValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Checkout.GiftVouchers; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Orders; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Orders; @@ -10,7 +10,7 @@ public class GiftVoucherDeleteModelValidator : BaseGrandValidator> validators, - IGiftVoucherService giftVoucherService, ITranslationService translationService) + IGiftVoucherService giftVoucherService, IRequestTranslationService translationService) : base(validators) { RuleFor(x => x).CustomAsync(async (x, context, _) => diff --git a/src/Web/Grand.Web.AdminShared/Validators/Orders/GiftVoucherValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Orders/GiftVoucherValidator.cs index 57be27e93f..f7b098b377 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Orders/GiftVoucherValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Orders/GiftVoucherValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Orders; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Orders; @@ -9,7 +9,7 @@ public class GiftVoucherValidator : BaseGrandValidator { public GiftVoucherValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Code).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Orders/OrderStatusValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Orders/OrderStatusValidator.cs index 8a4daa4dc2..fd634bff62 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Orders/OrderStatusValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Orders/OrderStatusValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Orders; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Orders; @@ -9,7 +9,7 @@ public class OrderStatusValidator : BaseGrandValidator { public OrderStatusValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Pages/PageValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Pages/PageValidator.cs index aa66d42045..504cbcc457 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Pages/PageValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Pages/PageValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Pages; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Pages; @@ -9,7 +9,7 @@ public class PageValidator : BaseGrandValidator { public PageValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.SystemName).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Permission/PermissionCreateModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Permission/PermissionCreateModelValidator.cs index e746ddc188..66d2013a18 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Permission/PermissionCreateModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Permission/PermissionCreateModelValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Permissions; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Permission; @@ -11,7 +11,7 @@ public class PermissionCreateModelValidator : BaseGrandValidator> validators, IPermissionService permissionService, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Permission/PermissionUpdateModelValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Permission/PermissionUpdateModelValidator.cs index 1668eb0367..181c701a65 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Permission/PermissionUpdateModelValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Permission/PermissionUpdateModelValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Permissions; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Permission; @@ -11,7 +11,7 @@ public class PermissionUpdateModelValidator : BaseGrandValidator> validators, IPermissionService permissionService, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Plugins/PluginValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Plugins/PluginValidator.cs index 65fb7222e8..c36b6d65be 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Plugins/PluginValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Plugins/PluginValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Plugins; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Plugins; @@ -9,7 +9,7 @@ public class PluginValidator : BaseGrandValidator { public PluginValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.FriendlyName).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Settings/LoyaltyPointsSettingsValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Settings/LoyaltyPointsSettingsValidator.cs index 2622690bf8..0a598fedb9 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Settings/LoyaltyPointsSettingsValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Settings/LoyaltyPointsSettingsValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Orders; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Settings; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Settings; @@ -10,7 +10,7 @@ public class LoyaltyPointsSettingsValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.PointsForPurchases_Awarded).NotEqual((int)OrderStatusSystem.Pending).WithMessage( diff --git a/src/Web/Grand.Web.AdminShared/Validators/Settings/MerchandiseReturnActionValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Settings/MerchandiseReturnActionValidator.cs index b720b59d89..448984c60c 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Settings/MerchandiseReturnActionValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Settings/MerchandiseReturnActionValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Settings; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Settings; @@ -9,7 +9,7 @@ public class MerchandiseReturnActionValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Settings/MerchandiseReturnReasonValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Settings/MerchandiseReturnReasonValidator.cs index be133c548b..1cad65d15e 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Settings/MerchandiseReturnReasonValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Settings/MerchandiseReturnReasonValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Settings; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Settings; @@ -9,7 +9,7 @@ public class MerchandiseReturnReasonValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Settings/OrderSettingsValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Settings/OrderSettingsValidator.cs index ed1665897c..7065f92dfd 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Settings/OrderSettingsValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Settings/OrderSettingsValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Orders; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Settings; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Settings; @@ -10,7 +10,7 @@ public class OrderSettingsValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.GiftVouchers_Activated_OrderStatusId).NotEqual((int)OrderStatusSystem.Pending) diff --git a/src/Web/Grand.Web.AdminShared/Validators/Settings/SettingValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Settings/SettingValidator.cs index 97cd76ea1b..d78f4bf726 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Settings/SettingValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Settings/SettingValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Settings; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Settings; @@ -9,7 +9,7 @@ public class SettingValidator : BaseGrandValidator { public SettingValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Shipping/DeliveryDateValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Shipping/DeliveryDateValidator.cs index 4f901c97a9..97c70ffe73 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Shipping/DeliveryDateValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Shipping/DeliveryDateValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Shipping; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Shipping; @@ -9,7 +9,7 @@ public class DeliveryDateValidator : BaseGrandValidator { public DeliveryDateValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Shipping/PickupPointValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Shipping/PickupPointValidator.cs index 3ae79410e7..63670d1ab8 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Shipping/PickupPointValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Shipping/PickupPointValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Shipping; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Shipping; @@ -9,7 +9,7 @@ public class PickupPointValidator : BaseGrandValidator { public PickupPointValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Shipping/ShippingMethodValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Shipping/ShippingMethodValidator.cs index d93daa6ec9..e5ef2e1e16 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Shipping/ShippingMethodValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Shipping/ShippingMethodValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Shipping; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Shipping; @@ -9,7 +9,7 @@ public class ShippingMethodValidator : BaseGrandValidator { public ShippingMethodValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Shipping/WarehouseValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Shipping/WarehouseValidator.cs index 60188be09d..e868db0a1e 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Shipping/WarehouseValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Shipping/WarehouseValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Shipping; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Shipping; @@ -9,7 +9,7 @@ public class WarehouseValidator : BaseGrandValidator { public WarehouseValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Stores/DomainHostValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Stores/DomainHostValidator.cs index ba4bfe4090..4e631d1c50 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Stores/DomainHostValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Stores/DomainHostValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Stores; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Stores; @@ -9,7 +9,7 @@ public class DomainHostValidator : BaseGrandValidator { public DomainHostValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Url).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Stores/StoreValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Stores/StoreValidator.cs index 52f4625419..9fecf6d6d5 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Stores/StoreValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Stores/StoreValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Stores; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Stores; @@ -9,7 +9,7 @@ public class StoreValidator : BaseGrandValidator { public StoreValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Tax/TaxCategoryValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Tax/TaxCategoryValidator.cs index fe2b9054ba..22195eaf6e 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Tax/TaxCategoryValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Tax/TaxCategoryValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Tax; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Tax; @@ -9,7 +9,7 @@ public class TaxCategoryValidator : BaseGrandValidator { public TaxCategoryValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Vendors/VendorReviewValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Vendors/VendorReviewValidator.cs index 6ad36f9ea0..aec48b95e8 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Vendors/VendorReviewValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Vendors/VendorReviewValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Vendors; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Vendors; @@ -9,7 +9,7 @@ public class VendorReviewValidator : BaseGrandValidator { public VendorReviewValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Title).NotEmpty() diff --git a/src/Web/Grand.Web.AdminShared/Validators/Vendors/VendorValidator.cs b/src/Web/Grand.Web.AdminShared/Validators/Vendors/VendorValidator.cs index e81fbb0503..147c932f50 100644 --- a/src/Web/Grand.Web.AdminShared/Validators/Vendors/VendorValidator.cs +++ b/src/Web/Grand.Web.AdminShared/Validators/Vendors/VendorValidator.cs @@ -1,8 +1,8 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.AdminShared.Models.Vendors; using Grand.Web.AdminShared.Validators.Common; +using Grand.Web.Common.Localization; namespace Grand.Web.AdminShared.Validators.Vendors; @@ -10,7 +10,7 @@ public class VendorValidator : BaseGrandValidator { public VendorValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty() diff --git a/src/Web/Grand.Web.Common/Localization/IRequestTranslationService.cs b/src/Web/Grand.Web.Common/Localization/IRequestTranslationService.cs new file mode 100644 index 0000000000..589d1a621e --- /dev/null +++ b/src/Web/Grand.Web.Common/Localization/IRequestTranslationService.cs @@ -0,0 +1,79 @@ +using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Domain.Localization; +using Grand.Infrastructure; + +namespace Grand.Web.Common.Localization; + +/// +/// Translation service for code that runs inside a request +/// +public interface IRequestTranslationService : ITranslationService +{ + /// + /// Gets a resource string in the working language of the current request. + /// + /// A string representing a name. + /// A string representing the requested resource string. + string GetResource(string name); +} + +public class RequestTranslationService(ITranslationService translationService, IContextAccessor contextAccessor) + : IRequestTranslationService +{ + public string GetResource(string name) + { + var language = contextAccessor.WorkContext.WorkingLanguage; + return language != null ? translationService.GetResource(name, language.Id) : ""; + } + + public string GetResource(string resourceKey, string languageId, string defaultValue = "", + bool returnEmptyIfNotFound = false) + { + return translationService.GetResource(resourceKey, languageId, defaultValue, returnEmptyIfNotFound); + } + + public Task GetTranslateResourceById(string translateResourceId) + { + return translationService.GetTranslateResourceById(translateResourceId); + } + + public Task GetTranslateResourceByName(string name, string languageId) + { + return translationService.GetTranslateResourceByName(name, languageId); + } + + public IList GetAllResources(string languageId) + { + return translationService.GetAllResources(languageId); + } + + public Task InsertTranslateResource(TranslationResource translateResource) + { + return translationService.InsertTranslateResource(translateResource); + } + + public Task UpdateTranslateResource(TranslationResource translateResource) + { + return translationService.UpdateTranslateResource(translateResource); + } + + public Task DeleteTranslateResource(TranslationResource translateResource) + { + return translationService.DeleteTranslateResource(translateResource); + } + + public Task ExportResourcesToXml(Language language) + { + return translationService.ExportResourcesToXml(language); + } + + public Task ImportResourcesFromXml(Language language, string xml) + { + return translationService.ImportResourcesFromXml(language, xml); + } + + public Task ImportResourcesFromXmlInstall(Language language, string xml) + { + return translationService.ImportResourcesFromXmlInstall(language, xml); + } +} diff --git a/src/Web/Grand.Web.Common/Localization/LocService.cs b/src/Web/Grand.Web.Common/Localization/LocService.cs index a9d0eee1a8..7a2bd76323 100644 --- a/src/Web/Grand.Web.Common/Localization/LocService.cs +++ b/src/Web/Grand.Web.Common/Localization/LocService.cs @@ -1,17 +1,16 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Microsoft.Extensions.Localization; +using Microsoft.Extensions.Localization; namespace Grand.Web.Common.Localization; public class LocService : StringLocalizer { - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public LocService(IStringLocalizerFactory factory) : base(factory) { } - public LocService(IStringLocalizerFactory factory, ITranslationService translationService) : base(factory) + public LocService(IStringLocalizerFactory factory, IRequestTranslationService translationService) : base(factory) { _translationService = translationService; } diff --git a/src/Web/Grand.Web.Common/Security/Captcha/CaptchaSettingsExtension.cs b/src/Web/Grand.Web.Common/Security/Captcha/CaptchaSettingsExtension.cs index a7b54ecb7a..a370120737 100644 --- a/src/Web/Grand.Web.Common/Security/Captcha/CaptchaSettingsExtension.cs +++ b/src/Web/Grand.Web.Common/Security/Captcha/CaptchaSettingsExtension.cs @@ -1,12 +1,12 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Domain.Common; +using Grand.Domain.Common; +using Grand.Web.Common.Localization; namespace Grand.Web.Common.Security.Captcha; public static class CaptchaSettingsExtension { public static string GetWrongCaptchaMessage(this CaptchaSettings captchaSettings, - ITranslationService translationService) + IRequestTranslationService translationService) { return captchaSettings.ReCaptchaVersion switch { GoogleReCaptchaVersion.V2 => translationService.GetResource("Common.WrongCaptchaV2"), diff --git a/src/Web/Grand.Web.Common/Startup/StartupApplication.cs b/src/Web/Grand.Web.Common/Startup/StartupApplication.cs index abe42f42e3..a917420773 100644 --- a/src/Web/Grand.Web.Common/Startup/StartupApplication.cs +++ b/src/Web/Grand.Web.Common/Startup/StartupApplication.cs @@ -119,6 +119,7 @@ private static void RegisterFramework(IServiceCollection serviceCollection) serviceCollection.AddScoped(); + serviceCollection.AddScoped(); serviceCollection.AddScoped(); if (DataSettingsManager.DatabaseIsInstalled()) { diff --git a/src/Web/Grand.Web.Common/TagHelpers/Admin/AdminDeleteConfirmationTagHelper.cs b/src/Web/Grand.Web.Common/TagHelpers/Admin/AdminDeleteConfirmationTagHelper.cs index ca02ca6b04..0972602aac 100644 --- a/src/Web/Grand.Web.Common/TagHelpers/Admin/AdminDeleteConfirmationTagHelper.cs +++ b/src/Web/Grand.Web.Common/TagHelpers/Admin/AdminDeleteConfirmationTagHelper.cs @@ -1,11 +1,11 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Web.Common.Extensions; +using Grand.Web.Common.Extensions; using Grand.Web.Common.Models; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; using System.Text.Json; +using Grand.Web.Common.Localization; namespace Grand.Web.Common.TagHelpers.Admin; @@ -14,9 +14,9 @@ public class AdminDeleteConfirmationTagHelper : TagHelper { private readonly IHtmlHelper _htmlHelper; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; - public AdminDeleteConfirmationTagHelper(IHtmlHelper htmlHelper, ITranslationService translationService) + public AdminDeleteConfirmationTagHelper(IHtmlHelper htmlHelper, IRequestTranslationService translationService) { _htmlHelper = htmlHelper; _translationService = translationService; diff --git a/src/Web/Grand.Web.Common/TagHelpers/Admin/GridCommandsTagHelper.cs b/src/Web/Grand.Web.Common/TagHelpers/Admin/GridCommandsTagHelper.cs index 2b541f2323..6e7671d639 100644 --- a/src/Web/Grand.Web.Common/TagHelpers/Admin/GridCommandsTagHelper.cs +++ b/src/Web/Grand.Web.Common/TagHelpers/Admin/GridCommandsTagHelper.cs @@ -1,4 +1,3 @@ -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure; using Grand.Web.Common.TagHelpers.Admin.Grid; using Microsoft.AspNetCore.Mvc; @@ -6,6 +5,7 @@ using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; +using Grand.Web.Common.Localization; namespace Grand.Web.Common.TagHelpers.Admin; @@ -100,9 +100,9 @@ public override void Process(TagHelperContext context, TagHelperOutput output) [HtmlTargetElement("grid-toolbar-create", ParentTag = "admin-grid", TagStructure = TagStructure.WithoutEndTag)] public class GridToolbarCreateTagHelper : TagHelper { - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; - public GridToolbarCreateTagHelper(ITranslationService translationService) + public GridToolbarCreateTagHelper(IRequestTranslationService translationService) { _translationService = translationService; } @@ -124,9 +124,9 @@ public override void Process(TagHelperContext context, TagHelperOutput output) public class GridToolbarSaveTagHelper : TagHelper { private readonly IContextAccessor _contextAccessor; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; - public GridToolbarSaveTagHelper(ITranslationService translationService, IContextAccessor contextAccessor) + public GridToolbarSaveTagHelper(IRequestTranslationService translationService, IContextAccessor contextAccessor) { _translationService = translationService; _contextAccessor = contextAccessor; @@ -151,9 +151,9 @@ public override void Process(TagHelperContext context, TagHelperOutput output) public class GridToolbarCancelTagHelper : TagHelper { private readonly IContextAccessor _contextAccessor; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; - public GridToolbarCancelTagHelper(ITranslationService translationService, IContextAccessor contextAccessor) + public GridToolbarCancelTagHelper(IRequestTranslationService translationService, IContextAccessor contextAccessor) { _translationService = translationService; _contextAccessor = contextAccessor; @@ -179,7 +179,7 @@ internal static class GridToolbarText /// The resource in the working language, or the Kendo default text when the resource is /// missing (a database that never imported the upgrade resources), never the raw key. /// - public static string Get(ITranslationService translationService, IContextAccessor contextAccessor, string key, string fallback) + public static string Get(IRequestTranslationService translationService, IContextAccessor contextAccessor, string key, string fallback) { var languageId = contextAccessor.WorkContext?.WorkingLanguage?.Id; var value = languageId is null ? null : translationService.GetResource(key, languageId, string.Empty, true); diff --git a/src/Web/Grand.Web.Common/TagHelpers/DatePickerDropDownsTagHelper.cs b/src/Web/Grand.Web.Common/TagHelpers/DatePickerDropDownsTagHelper.cs index fcee79d699..1ffa76cee6 100644 --- a/src/Web/Grand.Web.Common/TagHelpers/DatePickerDropDownsTagHelper.cs +++ b/src/Web/Grand.Web.Common/TagHelpers/DatePickerDropDownsTagHelper.cs @@ -1,10 +1,10 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Web.Common.Extensions; +using Grand.Web.Common.Extensions; using Grand.Web.Common.Models; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; using System.Globalization; +using Grand.Web.Common.Localization; namespace Grand.Web.Common.TagHelpers; @@ -12,9 +12,9 @@ namespace Grand.Web.Common.TagHelpers; public class DatePickerDropDownsTagHelper : TagHelper { private readonly IHtmlHelper _htmlHelper; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; - public DatePickerDropDownsTagHelper(IHtmlHelper htmlHelper, ITranslationService translationService) + public DatePickerDropDownsTagHelper(IHtmlHelper htmlHelper, IRequestTranslationService translationService) { _htmlHelper = htmlHelper; _translationService = translationService; diff --git a/src/Web/Grand.Web.Common/TagHelpers/PageNavigationTagHelper.cs b/src/Web/Grand.Web.Common/TagHelpers/PageNavigationTagHelper.cs index a0017c9dd7..43d7bda326 100644 --- a/src/Web/Grand.Web.Common/TagHelpers/PageNavigationTagHelper.cs +++ b/src/Web/Grand.Web.Common/TagHelpers/PageNavigationTagHelper.cs @@ -1,11 +1,11 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Web.Common.Extensions; +using Grand.Web.Common.Extensions; using Grand.Web.Common.Page.Paging; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Routing; using CommonExtensions = Grand.Infrastructure.Extensions.CommonExtensions; +using Grand.Web.Common.Localization; namespace Grand.Web.Common.TagHelpers; @@ -50,9 +50,9 @@ public class PageNavigationTagHelper : TagHelper private const string BooleanParamAttributeName = "asp-boolean-params"; private readonly IHtmlHelper _htmlHelper; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; - public PageNavigationTagHelper(ITranslationService translationService, IHtmlHelper htmlHelper) + public PageNavigationTagHelper(IRequestTranslationService translationService, IHtmlHelper htmlHelper) { _translationService = translationService; _htmlHelper = htmlHelper; diff --git a/src/Web/Grand.Web.Store/Controllers/AddressAttributeController.cs b/src/Web/Grand.Web.Store/Controllers/AddressAttributeController.cs index ace9f0dbc8..1f70956b36 100644 --- a/src/Web/Grand.Web.Store/Controllers/AddressAttributeController.cs +++ b/src/Web/Grand.Web.Store/Controllers/AddressAttributeController.cs @@ -22,7 +22,7 @@ public class AddressAttributeController( IAddressAttributeService addressAttributeService, IAddressAttributeViewModelService addressAttributeViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseAddressAttributeController(addressAttributeService, addressAttributeViewModelService, languageService, translationService, scope) diff --git a/src/Web/Grand.Web.Store/Controllers/BlogController.cs b/src/Web/Grand.Web.Store/Controllers/BlogController.cs index 2cdeafb540..e0b7a91027 100644 --- a/src/Web/Grand.Web.Store/Controllers/BlogController.cs +++ b/src/Web/Grand.Web.Store/Controllers/BlogController.cs @@ -25,7 +25,7 @@ public class BlogController( IBlogService blogService, IBlogViewModelService blogViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IDateTimeService dateTimeService, IPictureViewModelService pictureViewModelService, diff --git a/src/Web/Grand.Web.Store/Controllers/BrandController.cs b/src/Web/Grand.Web.Store/Controllers/BrandController.cs index d180fa961b..1d4d48db0b 100644 --- a/src/Web/Grand.Web.Store/Controllers/BrandController.cs +++ b/src/Web/Grand.Web.Store/Controllers/BrandController.cs @@ -20,7 +20,7 @@ public class BrandController( IBrandService brandService, IStoreService storeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IPictureViewModelService pictureViewModelService, IAdminDataScope scope) : BaseBrandController(brandViewModelService, brandService, storeService, languageService, diff --git a/src/Web/Grand.Web.Store/Controllers/CategoryController.cs b/src/Web/Grand.Web.Store/Controllers/CategoryController.cs index 9e03ef6fea..2453936847 100644 --- a/src/Web/Grand.Web.Store/Controllers/CategoryController.cs +++ b/src/Web/Grand.Web.Store/Controllers/CategoryController.cs @@ -19,7 +19,7 @@ public class CategoryController( ICategoryService categoryService, ICategoryViewModelService categoryViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IPictureViewModelService pictureViewModelService, IProductService productService, IAdminDataScope scope) diff --git a/src/Web/Grand.Web.Store/Controllers/CheckoutAttributeController.cs b/src/Web/Grand.Web.Store/Controllers/CheckoutAttributeController.cs index 5573189955..3cd32f9f2d 100644 --- a/src/Web/Grand.Web.Store/Controllers/CheckoutAttributeController.cs +++ b/src/Web/Grand.Web.Store/Controllers/CheckoutAttributeController.cs @@ -20,7 +20,7 @@ namespace Grand.Web.Store.Controllers; public class CheckoutAttributeController( ICheckoutAttributeService checkoutAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, ICurrencyService currencyService, CurrencySettings currencySettings, IMeasureService measureService, diff --git a/src/Web/Grand.Web.Store/Controllers/CollectionController.cs b/src/Web/Grand.Web.Store/Controllers/CollectionController.cs index ceb1c24ac1..d02610178f 100644 --- a/src/Web/Grand.Web.Store/Controllers/CollectionController.cs +++ b/src/Web/Grand.Web.Store/Controllers/CollectionController.cs @@ -8,6 +8,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -20,7 +21,7 @@ public class CollectionController( ICollectionService collectionService, IStoreService storeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IPictureViewModelService pictureViewModelService, IProductService productService, IAdminDataScope scope) diff --git a/src/Web/Grand.Web.Store/Controllers/ContactAttributeController.cs b/src/Web/Grand.Web.Store/Controllers/ContactAttributeController.cs index 8a14c296b5..47158757fc 100644 --- a/src/Web/Grand.Web.Store/Controllers/ContactAttributeController.cs +++ b/src/Web/Grand.Web.Store/Controllers/ContactAttributeController.cs @@ -9,6 +9,7 @@ using Grand.Web.Common.Security.Authorization; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -20,7 +21,7 @@ public class ContactAttributeController( IContactAttributeViewModelService contactAttributeViewModelService, IContactAttributeService contactAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseContactAttributeController(contactAttributeViewModelService, contactAttributeService, languageService, translationService, scope); diff --git a/src/Web/Grand.Web.Store/Controllers/CurrencyController.cs b/src/Web/Grand.Web.Store/Controllers/CurrencyController.cs index 494e23b131..5a57430487 100644 --- a/src/Web/Grand.Web.Store/Controllers/CurrencyController.cs +++ b/src/Web/Grand.Web.Store/Controllers/CurrencyController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Directory; using Grand.Domain.Permissions; @@ -8,6 +7,7 @@ using Grand.Web.Common.Security.Authorization; using Grand.Web.Store.Models; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -15,7 +15,7 @@ namespace Grand.Web.Store.Controllers; public class CurrencyController( ICurrencyService currencyService, CurrencySettings currencySettings, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IContextAccessor contextAccessor) : BaseStoreController { diff --git a/src/Web/Grand.Web.Store/Controllers/CustomerAttributeController.cs b/src/Web/Grand.Web.Store/Controllers/CustomerAttributeController.cs index b305047c38..9dabf5e1a9 100644 --- a/src/Web/Grand.Web.Store/Controllers/CustomerAttributeController.cs +++ b/src/Web/Grand.Web.Store/Controllers/CustomerAttributeController.cs @@ -22,7 +22,7 @@ public class CustomerAttributeController( ICustomerAttributeService customerAttributeService, ICustomerAttributeViewModelService customerAttributeViewModelService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseCustomerAttributeController(customerAttributeService, customerAttributeViewModelService, languageService, translationService, scope) diff --git a/src/Web/Grand.Web.Store/Controllers/CustomerController.cs b/src/Web/Grand.Web.Store/Controllers/CustomerController.cs index 3436368ceb..d9577350c8 100644 --- a/src/Web/Grand.Web.Store/Controllers/CustomerController.cs +++ b/src/Web/Grand.Web.Store/Controllers/CustomerController.cs @@ -12,6 +12,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Filters; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -39,7 +40,7 @@ public class CustomerController( Grand.Business.Core.Interfaces.Common.Addresses.IAddressAttributeService addressAttributeService, Grand.Business.Core.Interfaces.Messages.IMessageProviderService messageProviderService, IGroupService groupService, - Grand.Business.Core.Interfaces.Common.Localization.ITranslationService translationService, + Grand.Web.Common.Localization.IRequestTranslationService translationService, IContextAccessor contextAccessor, CustomerSettings customerSettings, IAdminDataScope scope, diff --git a/src/Web/Grand.Web.Store/Controllers/DeliveryDateController.cs b/src/Web/Grand.Web.Store/Controllers/DeliveryDateController.cs index 7afba3b8f4..97751e3137 100644 --- a/src/Web/Grand.Web.Store/Controllers/DeliveryDateController.cs +++ b/src/Web/Grand.Web.Store/Controllers/DeliveryDateController.cs @@ -9,6 +9,7 @@ using Grand.Web.Common.Security.Authorization; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -22,7 +23,7 @@ public class DeliveryDateController( IDeliveryDateService deliveryDateService, ILanguageService languageService, IStoreService storeService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseDeliveryDateController(deliveryDateService, languageService, storeService, translationService, scope) { diff --git a/src/Web/Grand.Web.Store/Controllers/DiscountController.cs b/src/Web/Grand.Web.Store/Controllers/DiscountController.cs index 48e5cd2ade..bc4d7fa036 100644 --- a/src/Web/Grand.Web.Store/Controllers/DiscountController.cs +++ b/src/Web/Grand.Web.Store/Controllers/DiscountController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Catalog.Discounts; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Discounts; using Grand.Mediator; using Grand.Web.AdminShared.Controllers; @@ -8,6 +7,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -18,7 +18,7 @@ namespace Grand.Web.Store.Controllers; public class DiscountController( IDiscountViewModelService discountViewModelService, IDiscountService discountService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, IMediator mediator, IDiscountProviderLoader discountProviderLoader, diff --git a/src/Web/Grand.Web.Store/Controllers/EmailAccountController.cs b/src/Web/Grand.Web.Store/Controllers/EmailAccountController.cs index 119a045f81..3580aeac52 100644 --- a/src/Web/Grand.Web.Store/Controllers/EmailAccountController.cs +++ b/src/Web/Grand.Web.Store/Controllers/EmailAccountController.cs @@ -1,4 +1,3 @@ -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Messages; using Grand.Domain.Messages; using Grand.Domain.Permissions; @@ -10,6 +9,7 @@ using Grand.Web.Common.Security.Authorization; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -20,7 +20,7 @@ namespace Grand.Web.Store.Controllers; public class EmailAccountController( IEmailAccountViewModelService emailAccountViewModelService, IEmailAccountService emailAccountService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseEmailAccountController(emailAccountViewModelService, emailAccountService, translationService, scope) { diff --git a/src/Web/Grand.Web.Store/Controllers/GiftVoucherController.cs b/src/Web/Grand.Web.Store/Controllers/GiftVoucherController.cs index 51d0532d2d..96d556c78c 100644 --- a/src/Web/Grand.Web.Store/Controllers/GiftVoucherController.cs +++ b/src/Web/Grand.Web.Store/Controllers/GiftVoucherController.cs @@ -1,11 +1,11 @@ using Grand.Business.Core.Interfaces.Checkout.GiftVouchers; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Orders; using Grand.Web.AdminShared.Controllers; using Grand.Web.AdminShared.Interfaces; using Grand.Web.Common.Filters; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -16,7 +16,7 @@ namespace Grand.Web.Store.Controllers; public class GiftVoucherController( IGiftVoucherViewModelService giftVoucherViewModelService, IGiftVoucherService giftVoucherService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseGiftVoucherController(giftVoucherViewModelService, giftVoucherService, translationService, scope) { diff --git a/src/Web/Grand.Web.Store/Controllers/HomeController.cs b/src/Web/Grand.Web.Store/Controllers/HomeController.cs index 68ad6410ed..d4b117d248 100644 --- a/src/Web/Grand.Web.Store/Controllers/HomeController.cs +++ b/src/Web/Grand.Web.Store/Controllers/HomeController.cs @@ -1,11 +1,11 @@ using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure; using Grand.Web.AdminShared.Controllers; using Grand.Web.Common.Filters; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -19,7 +19,7 @@ public class HomeController : BaseHomeControllerWithSetLanguage public HomeController( ICountryService countryService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, ILogger logger) : base(countryService, translationService, contextAccessor) diff --git a/src/Web/Grand.Web.Store/Controllers/LanguageController.cs b/src/Web/Grand.Web.Store/Controllers/LanguageController.cs index 6e3cab67b4..4e4a7f7d60 100644 --- a/src/Web/Grand.Web.Store/Controllers/LanguageController.cs +++ b/src/Web/Grand.Web.Store/Controllers/LanguageController.cs @@ -6,13 +6,14 @@ using Grand.Web.Common.Security.Authorization; using Grand.Web.Store.Models; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; [PermissionAuthorize(PermissionSystemName.Languages)] public class LanguageController( ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IContextAccessor contextAccessor) : BaseStoreController { diff --git a/src/Web/Grand.Web.Store/Controllers/LoginController.cs b/src/Web/Grand.Web.Store/Controllers/LoginController.cs index d37841368d..72650e7441 100644 --- a/src/Web/Grand.Web.Store/Controllers/LoginController.cs +++ b/src/Web/Grand.Web.Store/Controllers/LoginController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Authentication; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; using Grand.Domain.Common; @@ -9,13 +8,14 @@ using Grand.Web.Store.Extensions; using Grand.Mediator; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; [Area(Constants.AreaStore)] public class LoginController : BaseLoginController { - public LoginController(CustomerSettings customerSettings, CaptchaSettings captchaSettings, ITranslationService translationService, ICustomerManagerService customerManagerService, ICustomerService customerService, IGrandAuthenticationService authenticationService, IMessageProviderService messageProviderService, IContextAccessor contextAccessor, IMediator mediator) : base(customerSettings, captchaSettings, translationService, customerManagerService, customerService, authenticationService, messageProviderService, contextAccessor, mediator) + public LoginController(CustomerSettings customerSettings, CaptchaSettings captchaSettings, IRequestTranslationService translationService, ICustomerManagerService customerManagerService, ICustomerService customerService, IGrandAuthenticationService authenticationService, IMessageProviderService messageProviderService, IContextAccessor contextAccessor, IMediator mediator) : base(customerSettings, captchaSettings, translationService, customerManagerService, customerService, authenticationService, messageProviderService, contextAccessor, mediator) { } } diff --git a/src/Web/Grand.Web.Store/Controllers/MerchandiseReturnController.cs b/src/Web/Grand.Web.Store/Controllers/MerchandiseReturnController.cs index 70c5351125..4158211e07 100644 --- a/src/Web/Grand.Web.Store/Controllers/MerchandiseReturnController.cs +++ b/src/Web/Grand.Web.Store/Controllers/MerchandiseReturnController.cs @@ -1,11 +1,11 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Orders; using Grand.Web.AdminShared.Controllers; using Grand.Web.AdminShared.Interfaces; using Grand.Web.Common.Filters; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -15,7 +15,7 @@ namespace Grand.Web.Store.Controllers; [AuthorizeMenu] public class MerchandiseReturnController( IMerchandiseReturnViewModelService merchandiseReturnViewModelService, - ITranslationService translationService, + IRequestTranslationService translationService, IMerchandiseReturnService merchandiseReturnService, IOrderService orderService, IAdminDataScope scope) diff --git a/src/Web/Grand.Web.Store/Controllers/MessageTemplateController.cs b/src/Web/Grand.Web.Store/Controllers/MessageTemplateController.cs index d5dbaccbbe..69da0be0a5 100644 --- a/src/Web/Grand.Web.Store/Controllers/MessageTemplateController.cs +++ b/src/Web/Grand.Web.Store/Controllers/MessageTemplateController.cs @@ -12,6 +12,7 @@ using Grand.Web.Common.Security.Authorization; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -23,7 +24,7 @@ public class MessageTemplateController( IMessageTemplateService messageTemplateService, IEmailAccountService emailAccountService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IMessageTokenProvider messageTokenProvider, IDownloadService downloadService, IAdminDataScope scope, diff --git a/src/Web/Grand.Web.Store/Controllers/NewsController.cs b/src/Web/Grand.Web.Store/Controllers/NewsController.cs index d9379de07d..8c6de57586 100644 --- a/src/Web/Grand.Web.Store/Controllers/NewsController.cs +++ b/src/Web/Grand.Web.Store/Controllers/NewsController.cs @@ -12,6 +12,7 @@ using Grand.Web.Common.Security.Authorization; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -23,7 +24,7 @@ public class NewsController( INewsViewModelService newsViewModelService, INewsService newsService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, IDateTimeService dateTimeService, IAdminDataScope scope) diff --git a/src/Web/Grand.Web.Store/Controllers/OnlineCustomerController.cs b/src/Web/Grand.Web.Store/Controllers/OnlineCustomerController.cs index ae53b4a367..b82e160615 100644 --- a/src/Web/Grand.Web.Store/Controllers/OnlineCustomerController.cs +++ b/src/Web/Grand.Web.Store/Controllers/OnlineCustomerController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Customers; using Grand.Infrastructure; @@ -7,6 +6,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -18,7 +18,7 @@ public class OnlineCustomerController( ICustomerService customerService, IDateTimeService dateTimeService, CustomerSettings customerSettings, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor) : BaseOnlineCustomerController(customerService, dateTimeService, customerSettings, translationService, contextAccessor) { diff --git a/src/Web/Grand.Web.Store/Controllers/OrderController.cs b/src/Web/Grand.Web.Store/Controllers/OrderController.cs index 2c1fe8e725..7c78beb4dd 100644 --- a/src/Web/Grand.Web.Store/Controllers/OrderController.cs +++ b/src/Web/Grand.Web.Store/Controllers/OrderController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Pdf; using Grand.Domain.Orders; using Grand.Infrastructure; @@ -9,6 +8,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -20,7 +20,7 @@ public class OrderController( IOrderViewModelService orderViewModelService, IOrderService orderService, IOrderStatusService orderStatusService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IPdfService pdfService, IMediator mediator, diff --git a/src/Web/Grand.Web.Store/Controllers/PageController.cs b/src/Web/Grand.Web.Store/Controllers/PageController.cs index 9591853ce2..017e8e0d68 100644 --- a/src/Web/Grand.Web.Store/Controllers/PageController.cs +++ b/src/Web/Grand.Web.Store/Controllers/PageController.cs @@ -14,6 +14,7 @@ using Grand.Web.Common.Security.Authorization; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -25,7 +26,7 @@ public class PageController( IPageViewModelService pageViewModelService, IPageService pageService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, IAdminDataScope scope) : BasePageController(pageViewModelService, pageService, languageService, translationService, diff --git a/src/Web/Grand.Web.Store/Controllers/PaymentController.cs b/src/Web/Grand.Web.Store/Controllers/PaymentController.cs index d4a36132fa..33aa57519b 100644 --- a/src/Web/Grand.Web.Store/Controllers/PaymentController.cs +++ b/src/Web/Grand.Web.Store/Controllers/PaymentController.cs @@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Payments; using Grand.Domain.Permissions; using Grand.Infrastructure; @@ -15,6 +14,7 @@ using Grand.Web.Common.Security.Authorization; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -24,7 +24,7 @@ public class PaymentController( ISettingService settingService, ICountryService countryService, IShippingMethodService shippingMethodService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor) : BaseStoreController { private string CurrentStoreId => contextAccessor.WorkContext.CurrentCustomer.StaffStoreId; diff --git a/src/Web/Grand.Web.Store/Controllers/PaymentTransactionController.cs b/src/Web/Grand.Web.Store/Controllers/PaymentTransactionController.cs index 26bbdc5878..58a4facb41 100644 --- a/src/Web/Grand.Web.Store/Controllers/PaymentTransactionController.cs +++ b/src/Web/Grand.Web.Store/Controllers/PaymentTransactionController.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Payments; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Payments; using Grand.Mediator; using Grand.Web.AdminShared.Controllers; @@ -20,7 +19,7 @@ namespace Grand.Web.Store.Controllers; public class PaymentTransactionController( IPaymentTransactionService paymentTransactionService, IOrderService orderService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, IMediator mediator, IEnumTranslationService enumTranslationService, diff --git a/src/Web/Grand.Web.Store/Controllers/PickupPointController.cs b/src/Web/Grand.Web.Store/Controllers/PickupPointController.cs index c1cc593926..c26078212a 100644 --- a/src/Web/Grand.Web.Store/Controllers/PickupPointController.cs +++ b/src/Web/Grand.Web.Store/Controllers/PickupPointController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Permissions; using Grand.Web.AdminShared.Controllers; @@ -10,6 +9,7 @@ using Grand.Web.Common.Security.Authorization; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -24,7 +24,7 @@ public class PickupPointController( IWarehouseService warehouseService, ICountryService countryService, IStoreService storeService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BasePickupPointController(pickupPointService, warehouseService, countryService, storeService, translationService, scope) { diff --git a/src/Web/Grand.Web.Store/Controllers/ProductAttributeController.cs b/src/Web/Grand.Web.Store/Controllers/ProductAttributeController.cs index e391ee0541..9f423d10c6 100644 --- a/src/Web/Grand.Web.Store/Controllers/ProductAttributeController.cs +++ b/src/Web/Grand.Web.Store/Controllers/ProductAttributeController.cs @@ -7,6 +7,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -18,7 +19,7 @@ public class ProductAttributeController( IProductService productService, IProductAttributeService productAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, SeoSettings seoSettings, IAdminDataScope scope) : BaseProductAttributeController(productService, productAttributeService, languageService, diff --git a/src/Web/Grand.Web.Store/Controllers/ProductController.cs b/src/Web/Grand.Web.Store/Controllers/ProductController.cs index 11b19551c9..096aaa71bb 100644 --- a/src/Web/Grand.Web.Store/Controllers/ProductController.cs +++ b/src/Web/Grand.Web.Store/Controllers/ProductController.cs @@ -23,7 +23,7 @@ public class ProductController( IProductService productService, IInventoryManageService inventoryManageService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductReservationService productReservationService, IAuctionService auctionService, IDateTimeService dateTimeService, diff --git a/src/Web/Grand.Web.Store/Controllers/ProductReviewController.cs b/src/Web/Grand.Web.Store/Controllers/ProductReviewController.cs index be16261cff..30c0ed6d3f 100644 --- a/src/Web/Grand.Web.Store/Controllers/ProductReviewController.cs +++ b/src/Web/Grand.Web.Store/Controllers/ProductReviewController.cs @@ -1,11 +1,11 @@ using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Web.AdminShared.Controllers; using Grand.Web.AdminShared.Interfaces; using Grand.Web.Common.Filters; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -16,6 +16,6 @@ namespace Grand.Web.Store.Controllers; public class ProductReviewController( IProductReviewViewModelService productReviewViewModelService, IProductReviewService productReviewService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseProductReviewController(productReviewViewModelService, productReviewService, translationService, scope); diff --git a/src/Web/Grand.Web.Store/Controllers/ReportsController.cs b/src/Web/Grand.Web.Store/Controllers/ReportsController.cs index 6e0a9d9b6c..b22d59d467 100644 --- a/src/Web/Grand.Web.Store/Controllers/ReportsController.cs +++ b/src/Web/Grand.Web.Store/Controllers/ReportsController.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; @@ -33,7 +32,7 @@ public class ReportsController( IProductService productService, IProductAttributeFormatter productAttributeFormatter, IStockQuantityService stockQuantityService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, ICountryService countryService, IVendorService vendorService, diff --git a/src/Web/Grand.Web.Store/Controllers/SettingController.cs b/src/Web/Grand.Web.Store/Controllers/SettingController.cs index 5afe6470a9..2ed5355e8c 100644 --- a/src/Web/Grand.Web.Store/Controllers/SettingController.cs +++ b/src/Web/Grand.Web.Store/Controllers/SettingController.cs @@ -37,7 +37,7 @@ namespace Grand.Web.Store.Controllers; public class SettingController( ISettingService settingService, IPictureService pictureService, - ITranslationService translationService, + IRequestTranslationService translationService, IMerchandiseReturnService merchandiseReturnService, ILanguageService languageService, ICacheBase cacheBase, diff --git a/src/Web/Grand.Web.Store/Controllers/ShipmentController.cs b/src/Web/Grand.Web.Store/Controllers/ShipmentController.cs index 3d5962a4db..1ca78fcb51 100644 --- a/src/Web/Grand.Web.Store/Controllers/ShipmentController.cs +++ b/src/Web/Grand.Web.Store/Controllers/ShipmentController.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Pdf; using Grand.Domain.Orders; using Grand.Domain.Shipping; @@ -12,6 +11,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -22,7 +22,7 @@ namespace Grand.Web.Store.Controllers; public class ShipmentController( IShipmentViewModelService shipmentViewModelService, IOrderService orderService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IPdfService pdfService, IShipmentService shipmentService, diff --git a/src/Web/Grand.Web.Store/Controllers/ShippingController.cs b/src/Web/Grand.Web.Store/Controllers/ShippingController.cs index 65491b5dc1..97ba1612c0 100644 --- a/src/Web/Grand.Web.Store/Controllers/ShippingController.cs +++ b/src/Web/Grand.Web.Store/Controllers/ShippingController.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain; using Grand.Domain.Customers; using Grand.Domain.Directory; @@ -20,6 +19,7 @@ using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -29,7 +29,7 @@ public class ShippingController( IShippingMethodService shippingMethodService, ICountryService countryService, IGroupService groupService, - ITranslationService translationService, + IRequestTranslationService translationService, ISettingService settingService, IContextAccessor contextAccessor) : BaseStoreController { diff --git a/src/Web/Grand.Web.Store/Controllers/ShippingMethodController.cs b/src/Web/Grand.Web.Store/Controllers/ShippingMethodController.cs index 3a0f92e735..9e5dba533d 100644 --- a/src/Web/Grand.Web.Store/Controllers/ShippingMethodController.cs +++ b/src/Web/Grand.Web.Store/Controllers/ShippingMethodController.cs @@ -9,6 +9,7 @@ using Grand.Web.Common.Security.Authorization; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -22,7 +23,7 @@ public class ShippingMethodController( IShippingMethodService shippingMethodService, ILanguageService languageService, IStoreService storeService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseShippingMethodController(shippingMethodService, languageService, storeService, translationService, scope) { diff --git a/src/Web/Grand.Web.Store/Controllers/SpecificationAttributeController.cs b/src/Web/Grand.Web.Store/Controllers/SpecificationAttributeController.cs index 007002174a..ce7d9a099d 100644 --- a/src/Web/Grand.Web.Store/Controllers/SpecificationAttributeController.cs +++ b/src/Web/Grand.Web.Store/Controllers/SpecificationAttributeController.cs @@ -9,6 +9,7 @@ using Grand.Web.Common.Security.Authorization; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -19,7 +20,7 @@ namespace Grand.Web.Store.Controllers; public class SpecificationAttributeController( ISpecificationAttributeService specificationAttributeService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductService productService, SeoSettings seoSettings, IAdminDataScope scope) diff --git a/src/Web/Grand.Web.Store/Controllers/TaxController.cs b/src/Web/Grand.Web.Store/Controllers/TaxController.cs index bb45034873..4be98913b8 100644 --- a/src/Web/Grand.Web.Store/Controllers/TaxController.cs +++ b/src/Web/Grand.Web.Store/Controllers/TaxController.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Catalog.Tax; using Grand.Business.Core.Interfaces.Common.Configuration; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Directory; using Grand.Domain.Permissions; @@ -40,7 +39,7 @@ public class TaxController( ISettingService settingService, IServiceProvider serviceProvider, ICacheBase cacheBase, - ITranslationService translationService, + IRequestTranslationService translationService, ICountryService countryService, IEnumTranslationService enumTranslationService, IContextAccessor contextAccessor, diff --git a/src/Web/Grand.Web.Store/Controllers/WarehouseController.cs b/src/Web/Grand.Web.Store/Controllers/WarehouseController.cs index 995dfff9cc..9ab885a0c1 100644 --- a/src/Web/Grand.Web.Store/Controllers/WarehouseController.cs +++ b/src/Web/Grand.Web.Store/Controllers/WarehouseController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Domain.Permissions; using Grand.Web.AdminShared.Controllers; @@ -10,6 +9,7 @@ using Grand.Web.Common.Security.Authorization; using Grand.Web.Store.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Store.Controllers; @@ -23,7 +23,7 @@ public class WarehouseController( IWarehouseService warehouseService, ICountryService countryService, IStoreService storeService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseWarehouseController(warehouseService, countryService, storeService, translationService, scope) { diff --git a/src/Web/Grand.Web.Vendor/Controllers/HomeController.cs b/src/Web/Grand.Web.Vendor/Controllers/HomeController.cs index 6cc197332e..ca2a7f4b9e 100644 --- a/src/Web/Grand.Web.Vendor/Controllers/HomeController.cs +++ b/src/Web/Grand.Web.Vendor/Controllers/HomeController.cs @@ -1,9 +1,9 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Web.AdminShared.Controllers; using Grand.Web.Common.Filters; using Grand.Web.Vendor.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Vendor.Controllers; @@ -17,7 +17,7 @@ public class HomeController : BaseHomeController public HomeController( ICountryService countryService, - ITranslationService translationService, + IRequestTranslationService translationService, ILogger logger) : base(countryService, translationService) { diff --git a/src/Web/Grand.Web.Vendor/Controllers/LoginController.cs b/src/Web/Grand.Web.Vendor/Controllers/LoginController.cs index 8d9faf1db4..d963d64937 100644 --- a/src/Web/Grand.Web.Vendor/Controllers/LoginController.cs +++ b/src/Web/Grand.Web.Vendor/Controllers/LoginController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Authentication; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; using Grand.Domain.Common; @@ -9,13 +8,14 @@ using Grand.Web.Vendor.Extensions; using Grand.Mediator; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Vendor.Controllers; [Area(Constants.AreaVendor)] public class LoginController : BaseLoginController { - public LoginController(CustomerSettings customerSettings, CaptchaSettings captchaSettings, ITranslationService translationService, ICustomerManagerService customerManagerService, ICustomerService customerService, IGrandAuthenticationService authenticationService, IMessageProviderService messageProviderService, IContextAccessor contextAccessor, IMediator mediator) : base(customerSettings, captchaSettings, translationService, customerManagerService, customerService, authenticationService, messageProviderService, contextAccessor, mediator) + public LoginController(CustomerSettings customerSettings, CaptchaSettings captchaSettings, IRequestTranslationService translationService, ICustomerManagerService customerManagerService, ICustomerService customerService, IGrandAuthenticationService authenticationService, IMessageProviderService messageProviderService, IContextAccessor contextAccessor, IMediator mediator) : base(customerSettings, captchaSettings, translationService, customerManagerService, customerService, authenticationService, messageProviderService, contextAccessor, mediator) { } } diff --git a/src/Web/Grand.Web.Vendor/Controllers/MerchandiseReturnController.cs b/src/Web/Grand.Web.Vendor/Controllers/MerchandiseReturnController.cs index 3fc3eb3625..50e1256fd8 100644 --- a/src/Web/Grand.Web.Vendor/Controllers/MerchandiseReturnController.cs +++ b/src/Web/Grand.Web.Vendor/Controllers/MerchandiseReturnController.cs @@ -1,11 +1,11 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Orders; using Grand.Web.AdminShared.Controllers; using Grand.Web.AdminShared.Interfaces; using Grand.Web.Common.Filters; using Grand.Web.Vendor.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Vendor.Controllers; @@ -15,7 +15,7 @@ namespace Grand.Web.Vendor.Controllers; [AuthorizeMenu] public class MerchandiseReturnController( IMerchandiseReturnViewModelService merchandiseReturnViewModelService, - ITranslationService translationService, + IRequestTranslationService translationService, IMerchandiseReturnService merchandiseReturnService, IOrderService orderService, IAdminDataScope scope) diff --git a/src/Web/Grand.Web.Vendor/Controllers/OrderController.cs b/src/Web/Grand.Web.Vendor/Controllers/OrderController.cs index 7f411d5be8..d02c7cdc0f 100644 --- a/src/Web/Grand.Web.Vendor/Controllers/OrderController.cs +++ b/src/Web/Grand.Web.Vendor/Controllers/OrderController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Pdf; using Grand.Domain.Orders; using Grand.Infrastructure; @@ -8,6 +7,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Vendor.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Vendor.Controllers; @@ -18,7 +18,7 @@ namespace Grand.Web.Vendor.Controllers; public class OrderController( IOrderViewModelService orderViewModelService, IOrderService orderService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IPdfService pdfService, IAdminDataScope scope) diff --git a/src/Web/Grand.Web.Vendor/Controllers/ProductController.cs b/src/Web/Grand.Web.Vendor/Controllers/ProductController.cs index ac9e1bcbb4..99c7532633 100644 --- a/src/Web/Grand.Web.Vendor/Controllers/ProductController.cs +++ b/src/Web/Grand.Web.Vendor/Controllers/ProductController.cs @@ -23,7 +23,7 @@ public class ProductController( IProductService productService, IInventoryManageService inventoryManageService, ILanguageService languageService, - ITranslationService translationService, + IRequestTranslationService translationService, IProductReservationService productReservationService, IAuctionService auctionService, IDateTimeService dateTimeService, diff --git a/src/Web/Grand.Web.Vendor/Controllers/ReportsController.cs b/src/Web/Grand.Web.Vendor/Controllers/ReportsController.cs index dedb6cd07d..2b6d696cfb 100644 --- a/src/Web/Grand.Web.Vendor/Controllers/ReportsController.cs +++ b/src/Web/Grand.Web.Vendor/Controllers/ReportsController.cs @@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Stores; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.System.Reports; @@ -33,7 +32,7 @@ public class ReportsController( IProductService productService, IProductAttributeFormatter productAttributeFormatter, IStockQuantityService stockQuantityService, - ITranslationService translationService, + IRequestTranslationService translationService, IStoreService storeService, ICountryService countryService, IVendorService vendorService, diff --git a/src/Web/Grand.Web.Vendor/Controllers/ShipmentController.cs b/src/Web/Grand.Web.Vendor/Controllers/ShipmentController.cs index ef423385af..de7ecc371f 100644 --- a/src/Web/Grand.Web.Vendor/Controllers/ShipmentController.cs +++ b/src/Web/Grand.Web.Vendor/Controllers/ShipmentController.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Pdf; using Grand.Domain.Orders; using Grand.Domain.Shipping; @@ -12,6 +11,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Vendor.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Vendor.Controllers; @@ -22,7 +22,7 @@ namespace Grand.Web.Vendor.Controllers; public class ShipmentController( IShipmentViewModelService shipmentViewModelService, IOrderService orderService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IPdfService pdfService, IShipmentService shipmentService, diff --git a/src/Web/Grand.Web.Vendor/Controllers/VendorInfoController.cs b/src/Web/Grand.Web.Vendor/Controllers/VendorInfoController.cs index bb726ca9d3..842f6b1cf1 100644 --- a/src/Web/Grand.Web.Vendor/Controllers/VendorInfoController.cs +++ b/src/Web/Grand.Web.Vendor/Controllers/VendorInfoController.cs @@ -11,6 +11,7 @@ using Grand.Web.Vendor.Models.Vendor; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.Vendor.Controllers; @@ -19,7 +20,7 @@ public class VendorInfoController : BaseVendorController #region Constructors public VendorInfoController( - ITranslationService translationService, + IRequestTranslationService translationService, IVendorService vendorService, ILanguageService languageService, IContextAccessor contextAccessor, @@ -41,7 +42,7 @@ public VendorInfoController( #region Fields private readonly IContextAccessor _contextAccessor; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IVendorService _vendorService; private readonly ILanguageService _languageService; private readonly ICountryService _countryService; diff --git a/src/Web/Grand.Web.Vendor/Controllers/VendorReviewController.cs b/src/Web/Grand.Web.Vendor/Controllers/VendorReviewController.cs index a48443fdec..006f0d9811 100644 --- a/src/Web/Grand.Web.Vendor/Controllers/VendorReviewController.cs +++ b/src/Web/Grand.Web.Vendor/Controllers/VendorReviewController.cs @@ -1,4 +1,3 @@ -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Permissions; using Grand.Domain.Vendors; @@ -8,6 +7,7 @@ using Grand.Web.Common.Filters; using Grand.Web.Vendor.Extensions; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Vendor.Controllers; @@ -19,6 +19,6 @@ namespace Grand.Web.Vendor.Controllers; public class VendorReviewController( IVendorViewModelService vendorViewModelService, IVendorService vendorService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminDataScope scope) : BaseVendorReviewController(vendorViewModelService, vendorService, translationService, scope); diff --git a/src/Web/Grand.Web.Vendor/Validators/Common/AddressValidator.cs b/src/Web/Grand.Web.Vendor/Validators/Common/AddressValidator.cs index cb7d200408..637fba25d9 100644 --- a/src/Web/Grand.Web.Vendor/Validators/Common/AddressValidator.cs +++ b/src/Web/Grand.Web.Vendor/Validators/Common/AddressValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.Vendor.Models.Common; +using Grand.Web.Common.Localization; namespace Grand.Web.Vendor.Validators.Common; @@ -9,7 +9,7 @@ public class AddressValidator : BaseGrandValidator { public AddressValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.FirstName) diff --git a/src/Web/Grand.Web.Vendor/Validators/Vendor/VendorValidator.cs b/src/Web/Grand.Web.Vendor/Validators/Vendor/VendorValidator.cs index 589f355321..c65807807d 100644 --- a/src/Web/Grand.Web.Vendor/Validators/Vendor/VendorValidator.cs +++ b/src/Web/Grand.Web.Vendor/Validators/Vendor/VendorValidator.cs @@ -1,9 +1,9 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.Vendor.Models.Common; using Grand.Web.Vendor.Models.Vendor; using Grand.Web.Vendor.Validators.Common; +using Grand.Web.Common.Localization; namespace Grand.Web.Vendor.Validators.Vendor; @@ -12,7 +12,7 @@ public class VendorValidator : BaseGrandValidator public VendorValidator( IEnumerable> validators, IEnumerable> addressValidators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Name).NotEmpty().WithMessage(translationService.GetResource("Vendor.Fields.Name.Required")); diff --git a/src/Web/Grand.Web/Commands/Handler/Newsletter/SubscribeNewsletterHandler.cs b/src/Web/Grand.Web/Commands/Handler/Newsletter/SubscribeNewsletterHandler.cs index 07f42e4cbd..f5926d57c4 100644 --- a/src/Web/Grand.Web/Commands/Handler/Newsletter/SubscribeNewsletterHandler.cs +++ b/src/Web/Grand.Web/Commands/Handler/Newsletter/SubscribeNewsletterHandler.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Extensions; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Marketing.Newsletters; using Grand.Business.Core.Interfaces.Messages; using Grand.Domain.Messages; @@ -8,6 +7,7 @@ using Grand.Web.Commands.Models.Newsletter; using Grand.Web.Models.Newsletter; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Commands.Handler.Newsletter; @@ -16,12 +16,12 @@ public class SubscribeNewsletterHandler : IRequestHandler { private readonly INewsLetterSubscriptionService _newsLetterSubscriptionService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public SubscriptionActivationHandler(INewsLetterSubscriptionService newsLetterSubscriptionService, - ITranslationService translationService) + IRequestTranslationService translationService) { _newsLetterSubscriptionService = newsLetterSubscriptionService; _translationService = translationService; diff --git a/src/Web/Grand.Web/Commands/Handler/Vendors/ContactVendorCommandHandler.cs b/src/Web/Grand.Web/Commands/Handler/Vendors/ContactVendorCommandHandler.cs index 12bc5db696..db6590f3b4 100644 --- a/src/Web/Grand.Web/Commands/Handler/Vendors/ContactVendorCommandHandler.cs +++ b/src/Web/Grand.Web/Commands/Handler/Vendors/ContactVendorCommandHandler.cs @@ -1,11 +1,11 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Business.Core.Interfaces.Messages; +using Grand.Business.Core.Interfaces.Messages; using Grand.Domain.Common; using Grand.Infrastructure; using Grand.SharedKernel.Extensions; using Grand.Web.Commands.Models.Vendors; using Grand.Web.Models.Vendors; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Commands.Handler.Vendors; @@ -13,11 +13,11 @@ public class ContactVendorCommandHandler : IRequestHandler Courses() #region Fields private readonly IGrandAuthenticationService _authenticationService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; private readonly ICustomerService _customerService; private readonly IGroupService _groupService; diff --git a/src/Web/Grand.Web/Controllers/ActionCartController.cs b/src/Web/Grand.Web/Controllers/ActionCartController.cs index 24b7566ae0..ba50c69140 100644 --- a/src/Web/Grand.Web/Controllers/ActionCartController.cs +++ b/src/Web/Grand.Web/Controllers/ActionCartController.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Utilities.Checkout; using Grand.Domain.Catalog; using Grand.Domain.Common; @@ -19,6 +18,7 @@ using Microsoft.AspNetCore.Mvc; using System.Globalization; using Grand.Web.Common.Extensions; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -32,7 +32,7 @@ public ActionCartController(IProductService productService, IShoppingCartService shoppingCartService, IContextAccessor contextAccessor, IGroupService groupService, - ITranslationService translationService, + IRequestTranslationService translationService, ICurrencyService currencyService, IShoppingCartValidator shoppingCartValidator, IMediator mediator, @@ -57,7 +57,7 @@ public ActionCartController(IProductService productService, private readonly IShoppingCartService _shoppingCartService; private readonly IContextAccessor _contextAccessor; private readonly IGroupService _groupService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly ICurrencyService _currencyService; private readonly IShoppingCartValidator _shoppingCartValidator; private readonly IMediator _mediator; diff --git a/src/Web/Grand.Web/Controllers/BlogController.cs b/src/Web/Grand.Web/Controllers/BlogController.cs index 10f937f3e8..f283d27b90 100644 --- a/src/Web/Grand.Web/Controllers/BlogController.cs +++ b/src/Web/Grand.Web/Controllers/BlogController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Domain.Permissions; using Grand.Domain.Blogs; @@ -15,6 +14,7 @@ using Grand.Mediator; using Microsoft.AspNetCore.Mvc; using Grand.SharedKernel.Attributes; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -26,7 +26,7 @@ public class BlogController : BasePublicController public BlogController( IMediator mediator, IBlogService blogService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, BlogSettings blogSettings) { @@ -43,7 +43,7 @@ public BlogController( private readonly IMediator _mediator; private readonly IBlogService _blogService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; private readonly BlogSettings _blogSettings; diff --git a/src/Web/Grand.Web/Controllers/CatalogController.cs b/src/Web/Grand.Web/Controllers/CatalogController.cs index e9b1b1b93a..893d13dd96 100644 --- a/src/Web/Grand.Web/Controllers/CatalogController.cs +++ b/src/Web/Grand.Web/Controllers/CatalogController.cs @@ -4,7 +4,6 @@ using Grand.Business.Core.Interfaces.Catalog.Collections; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Permissions; @@ -21,6 +20,7 @@ using Grand.Mediator; using Microsoft.AspNetCore.Mvc; using Grand.SharedKernel.Attributes; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -36,7 +36,7 @@ public CatalogController( ICollectionService collectionService, IContextAccessor contextAccessor, IGroupService groupService, - ITranslationService translationService, + IRequestTranslationService translationService, IAclService aclService, IPermissionService permissionService, IMediator mediator, @@ -65,7 +65,7 @@ public CatalogController( private readonly ICollectionService _collectionService; private readonly IContextAccessor _contextAccessor; private readonly IGroupService _groupService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IAclService _aclService; private readonly IPermissionService _permissionService; private readonly IMediator _mediator; diff --git a/src/Web/Grand.Web/Controllers/CheckoutController.cs b/src/Web/Grand.Web/Controllers/CheckoutController.cs index cdeaabeb80..2abede8661 100644 --- a/src/Web/Grand.Web/Controllers/CheckoutController.cs +++ b/src/Web/Grand.Web/Controllers/CheckoutController.cs @@ -6,7 +6,6 @@ using Grand.Business.Core.Interfaces.Checkout.Payments; using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Utilities.Checkout; using Grand.Domain.Common; @@ -29,6 +28,7 @@ using Grand.Mediator; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.ModelBinding; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -40,7 +40,7 @@ public class CheckoutController : BasePublicController public CheckoutController( IContextAccessor contextAccessor, - ITranslationService translationService, + IRequestTranslationService translationService, ICustomerService customerService, IGroupService groupService, IShoppingCartService shoppingCartService, @@ -824,7 +824,7 @@ public virtual async Task CompleteRedirectionPayment(string payme #region Fields private readonly IContextAccessor _contextAccessor; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly ICustomerService _customerService; private readonly IGroupService _groupService; private readonly IShoppingCartService _shoppingCartService; diff --git a/src/Web/Grand.Web/Controllers/ContactController.cs b/src/Web/Grand.Web/Controllers/ContactController.cs index 74d8372332..d933018942 100644 --- a/src/Web/Grand.Web/Controllers/ContactController.cs +++ b/src/Web/Grand.Web/Controllers/ContactController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Cms; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Marketing.Contacts; using Grand.Business.Core.Interfaces.Storage; using Grand.Domain.Catalog; @@ -16,6 +15,7 @@ using Grand.Web.Models.Contact; using Grand.Mediator; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -25,7 +25,7 @@ public class ContactController : BasePublicController #region Constructors public ContactController( - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, IMediator mediator) { @@ -197,7 +197,7 @@ public virtual async Task UploadFileContactAttribute(string attri #region Fields - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; private readonly IMediator _mediator; diff --git a/src/Web/Grand.Web/Controllers/CountryController.cs b/src/Web/Grand.Web/Controllers/CountryController.cs index a01ac72853..5d51b6a90d 100644 --- a/src/Web/Grand.Web/Controllers/CountryController.cs +++ b/src/Web/Grand.Web/Controllers/CountryController.cs @@ -1,11 +1,11 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.SharedKernel.Attributes; +using Grand.SharedKernel.Attributes; using Grand.Web.Common.Controllers; using Grand.Web.Common.Filters; using Grand.Web.Features.Models.Common; using Grand.Web.Models.Common; using Grand.Mediator; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -14,7 +14,7 @@ public class CountryController : BasePublicController { #region Constructors - public CountryController(IMediator mediator, ITranslationService translationService) + public CountryController(IMediator mediator, IRequestTranslationService translationService) { _mediator = mediator; _translationService = translationService; @@ -43,7 +43,7 @@ public virtual async Task GetStatesByCountryId(string countryId, #region Fields private readonly IMediator _mediator; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; #endregion } \ No newline at end of file diff --git a/src/Web/Grand.Web/Controllers/DownloadController.cs b/src/Web/Grand.Web/Controllers/DownloadController.cs index f5dbfb8a8f..34bf0dd8f9 100644 --- a/src/Web/Grand.Web/Controllers/DownloadController.cs +++ b/src/Web/Grand.Web/Controllers/DownloadController.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Marketing.Documents; using Grand.Business.Core.Interfaces.Storage; @@ -17,6 +16,7 @@ using System.IO.Compression; using System.Text.RegularExpressions; using OperatingSystem = Grand.Infrastructure.OperatingSystem; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -29,7 +29,7 @@ public class DownloadController : BasePublicController private readonly IMerchandiseReturnService _merchandiseReturnService; private readonly IOrderService _orderService; private readonly IProductService _productService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; public DownloadController(IDownloadService downloadService, @@ -37,7 +37,7 @@ public DownloadController(IDownloadService downloadService, IOrderService orderService, IMerchandiseReturnService merchandiseReturnService, IContextAccessor contextAccessor, - ITranslationService translationService, + IRequestTranslationService translationService, CustomerSettings customerSettings) { _downloadService = downloadService; diff --git a/src/Web/Grand.Web/Controllers/KnowledgebaseController.cs b/src/Web/Grand.Web/Controllers/KnowledgebaseController.cs index 6090b1324e..018ffc09c5 100644 --- a/src/Web/Grand.Web/Controllers/KnowledgebaseController.cs +++ b/src/Web/Grand.Web/Controllers/KnowledgebaseController.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Extensions; using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; @@ -20,6 +19,7 @@ using Grand.Web.Extensions; using Grand.Web.Models.Knowledgebase; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -36,7 +36,7 @@ public class KnowledgebaseController : BasePublicController private readonly LanguageSettings _languageSettings; private readonly IMessageProviderService _messageProviderService; private readonly IPermissionService _permissionService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; public KnowledgebaseController( @@ -45,7 +45,7 @@ public KnowledgebaseController( IContextAccessor contextAccessor, ICacheBase cacheBase, IAclService aclService, - ITranslationService translationService, + IRequestTranslationService translationService, IMessageProviderService messageProviderService, IDateTimeService dateTimeService, IPermissionService permissionService, diff --git a/src/Web/Grand.Web/Controllers/MerchandiseReturnController.cs b/src/Web/Grand.Web/Controllers/MerchandiseReturnController.cs index 38200dc471..1be648a6b2 100644 --- a/src/Web/Grand.Web/Controllers/MerchandiseReturnController.cs +++ b/src/Web/Grand.Web/Controllers/MerchandiseReturnController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Queries.Checkout.Orders; using Grand.Domain.Common; using Grand.Domain.Orders; @@ -16,6 +15,7 @@ using Grand.Web.Models.Orders; using Grand.Mediator; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -30,7 +30,7 @@ public MerchandiseReturnController( IOrderService orderService, IContextAccessor contextAccessor, IGroupService groupService, - ITranslationService translationService, + IRequestTranslationService translationService, IMediator mediator, AddressSettings addressSettings, OrderSettings orderSettings) @@ -53,7 +53,7 @@ public MerchandiseReturnController( private readonly IOrderService _orderService; private readonly IContextAccessor _contextAccessor; private readonly IGroupService _groupService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IMediator _mediator; private readonly AddressSettings _addressSettings; private readonly OrderSettings _orderSettings; diff --git a/src/Web/Grand.Web/Controllers/NewsController.cs b/src/Web/Grand.Web/Controllers/NewsController.cs index 702627772d..e8db830814 100644 --- a/src/Web/Grand.Web/Controllers/NewsController.cs +++ b/src/Web/Grand.Web/Controllers/NewsController.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Domain.Permissions; using Grand.Domain.Customers; @@ -15,6 +14,7 @@ using Grand.Mediator; using Microsoft.AspNetCore.Mvc; using Grand.SharedKernel.Attributes; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -25,7 +25,7 @@ public class NewsController : BasePublicController public NewsController(INewsService newsService, IContextAccessor contextAccessor, - ITranslationService translationService, + IRequestTranslationService translationService, IAclService aclService, IPermissionService permissionService, IMediator mediator, @@ -46,7 +46,7 @@ public NewsController(INewsService newsService, private readonly INewsService _newsService; private readonly IContextAccessor _contextAccessor; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IAclService _aclService; private readonly IPermissionService _permissionService; private readonly IMediator _mediator; diff --git a/src/Web/Grand.Web/Controllers/OrderController.cs b/src/Web/Grand.Web/Controllers/OrderController.cs index e373bd2959..21f8421dda 100644 --- a/src/Web/Grand.Web/Controllers/OrderController.cs +++ b/src/Web/Grand.Web/Controllers/OrderController.cs @@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Checkout.Payments; using Grand.Business.Core.Interfaces.Checkout.Shipping; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Pdf; using Grand.Domain.Customers; using Grand.Domain.Orders; @@ -22,6 +21,7 @@ using Grand.Web.Models.Orders; using Grand.Mediator; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -35,7 +35,7 @@ public OrderController(IOrderService orderService, IContextAccessor contextAccessor, IPaymentService paymentService, IPaymentTransactionService paymentTransactionService, - ITranslationService translationService, + IRequestTranslationService translationService, IGroupService groupService, IMediator mediator, OrderSettings orderSettings) @@ -58,7 +58,7 @@ public OrderController(IOrderService orderService, private readonly IContextAccessor _contextAccessor; private readonly IPaymentService _paymentService; private readonly IPaymentTransactionService _paymentTransactionService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IGroupService _groupService; private readonly IMediator _mediator; private readonly OrderSettings _orderSettings; diff --git a/src/Web/Grand.Web/Controllers/OutOfStockSubscriptionController.cs b/src/Web/Grand.Web/Controllers/OutOfStockSubscriptionController.cs index 06ef2772a2..771578fefc 100644 --- a/src/Web/Grand.Web/Controllers/OutOfStockSubscriptionController.cs +++ b/src/Web/Grand.Web/Controllers/OutOfStockSubscriptionController.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Extensions; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Domain.Customers; using Grand.Domain.Orders; @@ -14,6 +13,7 @@ using Grand.Mediator; using Microsoft.AspNetCore.Mvc; using Grand.Web.Common.Extensions; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -26,7 +26,7 @@ public class OutOfStockSubscriptionController : BasePublicController public OutOfStockSubscriptionController(IProductService productService, IContextAccessor contextAccessor, IGroupService groupService, - ITranslationService translationService, + IRequestTranslationService translationService, IOutOfStockSubscriptionService outOfStockSubscriptionService, IProductAttributeFormatter productAttributeFormatter, IStockQuantityService stockQuantityService, @@ -53,7 +53,7 @@ public OutOfStockSubscriptionController(IProductService productService, private readonly IProductService _productService; private readonly IContextAccessor _contextAccessor; private readonly IGroupService _groupService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IOutOfStockSubscriptionService _outOfStockSubscriptionService; private readonly IProductAttributeFormatter _productAttributeFormatter; private readonly IStockQuantityService _stockQuantityService; diff --git a/src/Web/Grand.Web/Controllers/PageController.cs b/src/Web/Grand.Web/Controllers/PageController.cs index f860f26bab..1e7f613539 100644 --- a/src/Web/Grand.Web/Controllers/PageController.cs +++ b/src/Web/Grand.Web/Controllers/PageController.cs @@ -1,5 +1,4 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Business.Core.Interfaces.Common.Security; +using Grand.Business.Core.Interfaces.Common.Security; using Grand.Domain.Permissions; using Grand.SharedKernel.Attributes; using Grand.Web.Common.Controllers; @@ -8,6 +7,7 @@ using Grand.Web.Models.Pages; using Grand.Mediator; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -17,7 +17,7 @@ public class PageController : BasePublicController #region Constructors public PageController( - ITranslationService translationService, + IRequestTranslationService translationService, IPermissionService permissionService, IMediator mediator) { @@ -30,7 +30,7 @@ public PageController( #region Fields - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IPermissionService _permissionService; private readonly IMediator _mediator; diff --git a/src/Web/Grand.Web/Controllers/ProductController.cs b/src/Web/Grand.Web/Controllers/ProductController.cs index cbcc224e52..f36ef499f7 100644 --- a/src/Web/Grand.Web/Controllers/ProductController.cs +++ b/src/Web/Grand.Web/Controllers/ProductController.cs @@ -3,7 +3,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Storage; @@ -27,6 +26,7 @@ using Microsoft.AspNetCore.Mvc; using Grand.SharedKernel.Attributes; using Grand.SharedKernel.Extensions; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -38,7 +38,7 @@ public class ProductController : BasePublicController public ProductController( IProductService productService, IContextAccessor contextAccessor, - ITranslationService translationService, + IRequestTranslationService translationService, IRecentlyViewedProductsService recentlyViewedProductsService, IShoppingCartService shoppingCartService, IAclService aclService, @@ -260,7 +260,7 @@ public virtual async Task GetDatesForMonth(string productId, int private readonly IProductService _productService; private readonly IContextAccessor _contextAccessor; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IRecentlyViewedProductsService _recentlyViewedProductsService; private readonly IShoppingCartService _shoppingCartService; private readonly IAclService _aclService; diff --git a/src/Web/Grand.Web/Controllers/ShoppingCartController.cs b/src/Web/Grand.Web/Controllers/ShoppingCartController.cs index 3cab9ba40f..5f9c6283f1 100644 --- a/src/Web/Grand.Web/Controllers/ShoppingCartController.cs +++ b/src/Web/Grand.Web/Controllers/ShoppingCartController.cs @@ -4,7 +4,6 @@ using Grand.Business.Core.Interfaces.Checkout.GiftVouchers; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Storage; @@ -26,6 +25,7 @@ using Grand.Mediator; using Microsoft.AspNetCore.Mvc; using Grand.SharedKernel.Extensions; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -37,7 +37,7 @@ public class ShoppingCartController : BasePublicController public ShoppingCartController( IContextAccessor contextAccessor, IShoppingCartService shoppingCartService, - ITranslationService translationService, + IRequestTranslationService translationService, IDiscountService discountService, ICustomerService customerService, IGroupService groupService, @@ -102,7 +102,7 @@ private ShoppingCartType[] PrepareCartTypes() private readonly IContextAccessor _contextAccessor; private readonly IShoppingCartService _shoppingCartService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IDiscountService _discountService; private readonly ICustomerService _customerService; private readonly IGroupService _groupService; diff --git a/src/Web/Grand.Web/Controllers/VendorController.cs b/src/Web/Grand.Web/Controllers/VendorController.cs index 55f0bafd62..aa47152ea1 100644 --- a/src/Web/Grand.Web/Controllers/VendorController.cs +++ b/src/Web/Grand.Web/Controllers/VendorController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Seo; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; @@ -21,6 +20,7 @@ using Grand.Web.Models.Vendors; using Grand.Mediator; using Microsoft.AspNetCore.Mvc; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -31,7 +31,7 @@ public class VendorController : BasePublicController public VendorController( IContextAccessor contextAccessor, - ITranslationService translationService, + IRequestTranslationService translationService, ICustomerService customerService, IMessageProviderService messageProviderService, IVendorService vendorService, @@ -75,7 +75,7 @@ protected virtual async Task UpdatePictureSeoNames(Domain.Vendors.Vendor vendor) #region Fields private readonly IContextAccessor _contextAccessor; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly ICustomerService _customerService; private readonly IMessageProviderService _messageProviderService; private readonly IVendorService _vendorService; diff --git a/src/Web/Grand.Web/Controllers/WishlistController.cs b/src/Web/Grand.Web/Controllers/WishlistController.cs index 71a0e029d8..ea0ba28907 100644 --- a/src/Web/Grand.Web/Controllers/WishlistController.cs +++ b/src/Web/Grand.Web/Controllers/WishlistController.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Interfaces.Checkout.Orders; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Messages; @@ -17,6 +16,7 @@ using Grand.Mediator; using Microsoft.AspNetCore.Mvc; using Grand.Web.Common.Extensions; +using Grand.Web.Common.Localization; namespace Grand.Web.Controllers; @@ -28,7 +28,7 @@ public class WishlistController : BasePublicController public WishlistController( IContextAccessor contextAccessor, IShoppingCartService shoppingCartService, - ITranslationService translationService, + IRequestTranslationService translationService, ICustomerService customerService, IPermissionService permissionService, IMediator mediator, @@ -49,7 +49,7 @@ public WishlistController( private readonly IContextAccessor _contextAccessor; private readonly IShoppingCartService _shoppingCartService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly ICustomerService _customerService; private readonly IPermissionService _permissionService; private readonly IMediator _mediator; diff --git a/src/Web/Grand.Web/Features/Handlers/Blogs/GetBlogPostHandler.cs b/src/Web/Grand.Web/Features/Handlers/Blogs/GetBlogPostHandler.cs index b13f2aab54..ad91d96c3f 100644 --- a/src/Web/Grand.Web/Features/Handlers/Blogs/GetBlogPostHandler.cs +++ b/src/Web/Grand.Web/Features/Handlers/Blogs/GetBlogPostHandler.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Extensions; using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Storage; using Grand.Domain.Blogs; @@ -13,6 +12,7 @@ using Grand.Web.Models.Blogs; using Grand.Web.Models.Media; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Features.Handlers.Blogs; @@ -26,14 +26,14 @@ public class GetBlogPostHandler : IRequestHandler private readonly MediaSettings _mediaSettings; private readonly IPictureService _pictureService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; public GetBlogPostHandler( IBlogService blogService, IContextAccessor contextAccessor, IPictureService pictureService, - ITranslationService translationService, + IRequestTranslationService translationService, IDateTimeService dateTimeService, ICustomerService customerService, CaptchaSettings captchaSettings, diff --git a/src/Web/Grand.Web/Features/Handlers/Blogs/GetBlogPostListHandler.cs b/src/Web/Grand.Web/Features/Handlers/Blogs/GetBlogPostListHandler.cs index 7bb7673613..d054528be7 100644 --- a/src/Web/Grand.Web/Features/Handlers/Blogs/GetBlogPostListHandler.cs +++ b/src/Web/Grand.Web/Features/Handlers/Blogs/GetBlogPostListHandler.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Extensions; using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Storage; using Grand.Domain; using Grand.Domain.Blogs; @@ -11,6 +10,7 @@ using Grand.Web.Models.Blogs; using Grand.Web.Models.Media; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Features.Handlers.Blogs; @@ -19,7 +19,7 @@ public class GetBlogPostListHandler : IRequestHandler private readonly CatalogSettings _catalogSettings; private readonly MediaSettings _mediaSettings; private readonly IPictureService _pictureService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public GetBrandAllHandler(IBrandService brandService, IPictureService pictureService, - ITranslationService translationService, + IRequestTranslationService translationService, MediaSettings mediaSettings, CatalogSettings catalogSettings) { diff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetCategoryAllHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetCategoryAllHandler.cs index b5681ecc9d..fc7fd2d677 100644 --- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetCategoryAllHandler.cs +++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetCategoryAllHandler.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Extensions; using Grand.Business.Core.Interfaces.Catalog.Categories; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Storage; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain.Catalog; @@ -10,6 +9,7 @@ using Grand.Web.Models.Catalog; using Grand.Web.Models.Media; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Features.Handlers.Catalog; @@ -19,11 +19,11 @@ public class GetCategoryAllHandler : IRequestHandler private readonly IMediator _mediator; private readonly IPictureService _pictureService; private readonly ISpecificationAttributeService _specificationAttributeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public GetCategoryHandler( IMediator mediator, ICacheBase cacheBase, ICategoryService categoryService, IPictureService pictureService, - ITranslationService translationService, + IRequestTranslationService translationService, ISpecificationAttributeService specificationAttributeService, IHttpContextAccessor httpContextAccessor, CatalogSettings catalogSettings, diff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetCollectionAllHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetCollectionAllHandler.cs index 82cf7c2e3b..fb8ac2d4bd 100644 --- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetCollectionAllHandler.cs +++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetCollectionAllHandler.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Extensions; using Grand.Business.Core.Interfaces.Catalog.Collections; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Storage; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain.Catalog; @@ -10,6 +9,7 @@ using Grand.Web.Models.Catalog; using Grand.Web.Models.Media; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Features.Handlers.Catalog; @@ -19,11 +19,11 @@ public class GetCollectionAllHandler : IRequestHandler private readonly CatalogSettings _catalogSettings; private readonly ICategoryService _categoryService; private readonly StoreInformationSettings _storeInformationSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public GetSearchBoxHandler( ICacheBase cacheBase, ICategoryService categoryService, - ITranslationService translationService, + IRequestTranslationService translationService, CatalogSettings catalogSettings, StoreInformationSettings storeInformationSettings) { diff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetSearchHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetSearchHandler.cs index 6639be3b6b..cd7036cc59 100644 --- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetSearchHandler.cs +++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetSearchHandler.cs @@ -4,7 +4,6 @@ using Grand.Business.Core.Interfaces.Catalog.Directory; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Queries.Catalog; using Grand.Business.Core.Utilities.Catalog; @@ -20,6 +19,7 @@ using Grand.Mediator; using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.Features.Handlers.Catalog; @@ -35,14 +35,14 @@ public class GetSearchHandler : IRequestHandler private readonly IMediator _mediator; private readonly ISearchTermService _searchTermService; private readonly ISpecificationAttributeService _specificationAttributeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IVendorService _vendorService; private readonly VendorSettings _vendorSettings; public GetSearchHandler( ICategoryService categoryService, ICacheBase cacheBase, - ITranslationService translationService, + IRequestTranslationService translationService, ICollectionService collectionService, IVendorService vendorService, ICurrencyService currencyService, diff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetVendorAllHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetVendorAllHandler.cs index d6791d7123..3be1fece7f 100644 --- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetVendorAllHandler.cs +++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetVendorAllHandler.cs @@ -1,5 +1,4 @@ using Grand.Business.Core.Extensions; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Interfaces.Storage; using Grand.Domain.Catalog; @@ -10,6 +9,7 @@ using Grand.Web.Models.Catalog; using Grand.Web.Models.Media; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Features.Handlers.Catalog; @@ -19,14 +19,14 @@ public class GetVendorAllHandler : IRequestHandler private readonly IMediator _mediator; private readonly IPictureService _pictureService; private readonly ISpecificationAttributeService _specificationAttributeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly VendorSettings _vendorSettings; public GetVendorHandler( IMediator mediator, IPictureService pictureService, - ITranslationService translationService, + IRequestTranslationService translationService, VendorSettings vendorSettings, MediaSettings mediaSettings, ISpecificationAttributeService specificationAttributeService, diff --git a/src/Web/Grand.Web/Features/Handlers/Catalog/GetViewSortSizeOptionsHandler.cs b/src/Web/Grand.Web/Features/Handlers/Catalog/GetViewSortSizeOptionsHandler.cs index 03fdb42db4..69654c06a7 100644 --- a/src/Web/Grand.Web/Features/Handlers/Catalog/GetViewSortSizeOptionsHandler.cs +++ b/src/Web/Grand.Web/Features/Handlers/Catalog/GetViewSortSizeOptionsHandler.cs @@ -1,5 +1,4 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Domain.Catalog; +using Grand.Domain.Catalog; using Grand.Infrastructure.Extensions; using Grand.Web.Common.Localization; using Grand.Web.Features.Models.Catalog; @@ -15,9 +14,9 @@ public class GetViewSortSizeOptionsHandler : IRequestHandler> { private readonly ICountryService _countryService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; public GetStatesProvinceHandler(ICountryService countryService, IContextAccessor contextAccessor, - ITranslationService translationService) + IRequestTranslationService translationService) { _countryService = countryService; _contextAccessor = contextAccessor; diff --git a/src/Web/Grand.Web/Features/Handlers/Common/GetVendorAddressHandler.cs b/src/Web/Grand.Web/Features/Handlers/Common/GetVendorAddressHandler.cs index a5a50e7051..4a336ce5f1 100644 --- a/src/Web/Grand.Web/Features/Handlers/Common/GetVendorAddressHandler.cs +++ b/src/Web/Grand.Web/Features/Handlers/Common/GetVendorAddressHandler.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Extensions; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Common; using Grand.Domain.Customers; using Grand.Domain.Directory; @@ -9,19 +8,20 @@ using Grand.Web.Models.Vendors; using Grand.Mediator; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.Features.Handlers.Common; public class GetVendorAddressHandler : IRequestHandler { private readonly ICountryService _countryService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly VendorSettings _vendorSettings; public GetVendorAddressHandler( ICountryService countryService, - ITranslationService translationService, + IRequestTranslationService translationService, VendorSettings vendorSettings) { _countryService = countryService; diff --git a/src/Web/Grand.Web/Features/Handlers/Customers/GetInfoHandler.cs b/src/Web/Grand.Web/Features/Handlers/Customers/GetInfoHandler.cs index 67ad687dae..6479c8e033 100644 --- a/src/Web/Grand.Web/Features/Handlers/Customers/GetInfoHandler.cs +++ b/src/Web/Grand.Web/Features/Handlers/Customers/GetInfoHandler.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Extensions; using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Marketing.Newsletters; using Grand.Domain.Common; using Grand.Domain.Customers; @@ -27,13 +26,13 @@ public class GetInfoHandler : IRequestHandler private readonly INewsletterCategoryService _newsletterCategoryService; private readonly INewsLetterSubscriptionService _newsLetterSubscriptionService; private readonly TaxSettings _taxSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IEnumTranslationService _enumTranslationService; public GetInfoHandler( INewsLetterSubscriptionService newsLetterSubscriptionService, INewsletterCategoryService newsletterCategoryService, - ITranslationService translationService, + IRequestTranslationService translationService, ICountryService countryService, IExternalAuthenticationService externalAuthenticationService, IMediator mediator, diff --git a/src/Web/Grand.Web/Features/Handlers/Customers/GetPasswordRecoveryConfirmHandler.cs b/src/Web/Grand.Web/Features/Handlers/Customers/GetPasswordRecoveryConfirmHandler.cs index 88802f1461..a77e59be51 100644 --- a/src/Web/Grand.Web/Features/Handlers/Customers/GetPasswordRecoveryConfirmHandler.cs +++ b/src/Web/Grand.Web/Features/Handlers/Customers/GetPasswordRecoveryConfirmHandler.cs @@ -1,8 +1,8 @@ -using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Domain.Customers; +using Grand.Domain.Customers; using Grand.Web.Features.Models.Customers; using Grand.Web.Models.Customer; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Features.Handlers.Customers; @@ -10,10 +10,10 @@ public class GetPasswordRecoveryConfirmHandler : IRequestHandler { private readonly CustomerSettings _customerSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public GetPasswordRecoveryConfirmHandler( - ITranslationService translationService, + IRequestTranslationService translationService, CustomerSettings customerSettings) { _translationService = translationService; diff --git a/src/Web/Grand.Web/Features/Handlers/Customers/GetRegisterHandler.cs b/src/Web/Grand.Web/Features/Handlers/Customers/GetRegisterHandler.cs index 43757d93d2..10451f9240 100644 --- a/src/Web/Grand.Web/Features/Handlers/Customers/GetRegisterHandler.cs +++ b/src/Web/Grand.Web/Features/Handlers/Customers/GetRegisterHandler.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Extensions; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Marketing.Newsletters; using Grand.Domain.Common; using Grand.Domain.Customers; @@ -10,6 +9,7 @@ using Grand.Web.Models.Newsletter; using Grand.Mediator; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.Features.Handlers.Customers; @@ -23,11 +23,11 @@ public class GetRegisterHandler : IRequestHandler private readonly INewsletterCategoryService _newsletterCategoryService; private readonly TaxSettings _taxSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public GetRegisterHandler( INewsletterCategoryService newsletterCategoryService, - ITranslationService translationService, + IRequestTranslationService translationService, ICountryService countryService, IMediator mediator, CustomerSettings customerSettings, diff --git a/src/Web/Grand.Web/Features/Handlers/Customers/GetReviewsHandler.cs b/src/Web/Grand.Web/Features/Handlers/Customers/GetReviewsHandler.cs index 860c47c99d..d41808f536 100644 --- a/src/Web/Grand.Web/Features/Handlers/Customers/GetReviewsHandler.cs +++ b/src/Web/Grand.Web/Features/Handlers/Customers/GetReviewsHandler.cs @@ -1,10 +1,10 @@ using Grand.Business.Core.Extensions; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Web.Features.Models.Customers; using Grand.Web.Models.Customer; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Features.Handlers.Customers; @@ -13,10 +13,10 @@ public class GetReviewsHandler : IRequestHandler private readonly MediaSettings _mediaSettings; private readonly IPictureService _pictureService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; public GetNewsItemHandler(IContextAccessor contextAccessor, IDateTimeService dateTimeService, - IPictureService pictureService, ITranslationService translationService, ICustomerService customerService, + IPictureService pictureService, IRequestTranslationService translationService, ICustomerService customerService, MediaSettings mediaSettings, CaptchaSettings captchaSettings, CustomerSettings customerSettings) { _contextAccessor = contextAccessor; diff --git a/src/Web/Grand.Web/Features/Handlers/News/GetNewsItemListHandler.cs b/src/Web/Grand.Web/Features/Handlers/News/GetNewsItemListHandler.cs index 1b252a3af6..33324b5f15 100644 --- a/src/Web/Grand.Web/Features/Handlers/News/GetNewsItemListHandler.cs +++ b/src/Web/Grand.Web/Features/Handlers/News/GetNewsItemListHandler.cs @@ -1,7 +1,6 @@ using Grand.Business.Core.Extensions; using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Storage; using Grand.Domain.Media; using Grand.Domain.News; @@ -11,6 +10,7 @@ using Grand.Web.Models.Media; using Grand.Web.Models.News; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Features.Handlers.News; @@ -19,7 +19,7 @@ public class GetNewsItemListHandler : IRequestHandler private readonly ShoppingCartSettings _shoppingCartSettings; private readonly ITaxService _taxService; private readonly TaxSettings _taxSettings; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; public GetAddToCartHandler( IProductAttributeFormatter productAttributeFormatter, - ITranslationService translationService, + IRequestTranslationService translationService, ITaxService taxService, IPricingService priceCalculationService, IPriceFormatter priceFormatter, diff --git a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingHandler.cs b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingHandler.cs index 925e5e86d1..f32f159531 100644 --- a/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingHandler.cs +++ b/src/Web/Grand.Web/Features/Handlers/ShoppingCart/GetEstimateShippingHandler.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Extensions; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Directory; using Grand.Domain.Orders; using Grand.Domain.Shipping; @@ -8,6 +7,7 @@ using Grand.Web.Models.ShoppingCart; using Grand.Mediator; using Microsoft.AspNetCore.Mvc.Rendering; +using Grand.Web.Common.Localization; namespace Grand.Web.Features.Handlers.ShoppingCart; @@ -16,10 +16,10 @@ public class GetEstimateShippingHandler : IRequestHandler private readonly ShoppingCartSettings _shoppingCartSettings; private readonly IShoppingCartValidator _shoppingCartValidator; private readonly ITaxService _taxService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IEnumTranslationService _enumTranslationService; public GetWishlistHandler( IPermissionService permissionService, IProductService productService, IProductAttributeFormatter productAttributeFormatter, - ITranslationService translationService, + IRequestTranslationService translationService, ITaxService taxService, IPricingService priceCalculationService, IPriceFormatter priceFormatter, diff --git a/src/Web/Grand.Web/Validators/Blogs/AddBlogCommentValidator.cs b/src/Web/Grand.Web/Validators/Blogs/AddBlogCommentValidator.cs index 467c24388e..5bdcf1db0f 100644 --- a/src/Web/Grand.Web/Validators/Blogs/AddBlogCommentValidator.cs +++ b/src/Web/Grand.Web/Validators/Blogs/AddBlogCommentValidator.cs @@ -1,7 +1,6 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Domain.Blogs; using Grand.Domain.Common; @@ -11,6 +10,7 @@ using Grand.SharedKernel.Captcha; using Grand.Web.Common.Validators; using Grand.Web.Models.Blogs; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Blogs; @@ -23,7 +23,7 @@ public AddBlogCommentValidator( IGoogleReCaptchaValidator googleReCaptchaValidator, BlogSettings blogSettings, IGroupService groupService, IContextAccessor contextAccessor, IBlogService blogService, IAclService aclService, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.CommentText).NotEmpty() diff --git a/src/Web/Grand.Web/Validators/Catalog/ProductAskQuestionSimpleValidator.cs b/src/Web/Grand.Web/Validators/Catalog/ProductAskQuestionSimpleValidator.cs index 8328a9a7ec..7ca1d3e7b2 100644 --- a/src/Web/Grand.Web/Validators/Catalog/ProductAskQuestionSimpleValidator.cs +++ b/src/Web/Grand.Web/Validators/Catalog/ProductAskQuestionSimpleValidator.cs @@ -1,6 +1,5 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Catalog.Products; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Domain.Common; using Grand.Infrastructure.Models; @@ -8,6 +7,7 @@ using Grand.SharedKernel.Captcha; using Grand.Web.Common.Validators; using Grand.Web.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Catalog; @@ -19,7 +19,7 @@ public ProductAskQuestionSimpleValidator( CaptchaSettings captchaSettings, CatalogSettings catalogSettings, IProductService productService, IHttpContextAccessor contextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.AskQuestionEmail).NotEmpty() diff --git a/src/Web/Grand.Web/Validators/Catalog/ProductAskQuestionValidator.cs b/src/Web/Grand.Web/Validators/Catalog/ProductAskQuestionValidator.cs index 28e3b5d70d..4e20e0ca53 100644 --- a/src/Web/Grand.Web/Validators/Catalog/ProductAskQuestionValidator.cs +++ b/src/Web/Grand.Web/Validators/Catalog/ProductAskQuestionValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Catalog; @@ -9,7 +9,7 @@ public class ProductAskQuestionValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Email).NotEmpty() diff --git a/src/Web/Grand.Web/Validators/Catalog/ProductEmailAFriendValidator.cs b/src/Web/Grand.Web/Validators/Catalog/ProductEmailAFriendValidator.cs index a589d8d0b8..8c10196f8e 100644 --- a/src/Web/Grand.Web/Validators/Catalog/ProductEmailAFriendValidator.cs +++ b/src/Web/Grand.Web/Validators/Catalog/ProductEmailAFriendValidator.cs @@ -1,7 +1,6 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Domain.Common; using Grand.Infrastructure; @@ -10,6 +9,7 @@ using Grand.SharedKernel.Captcha; using Grand.Web.Common.Validators; using Grand.Web.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Catalog; @@ -21,7 +21,7 @@ public ProductEmailAFriendValidator( CaptchaSettings captchaSettings, CatalogSettings catalogSettings, IContextAccessor contextAccessor, IGroupService groupService, IProductService productService, IHttpContextAccessor httpcontextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.FriendEmail).NotEmpty() diff --git a/src/Web/Grand.Web/Validators/Catalog/ProductReviewsValidator.cs b/src/Web/Grand.Web/Validators/Catalog/ProductReviewsValidator.cs index 9779647a58..cea134b32e 100644 --- a/src/Web/Grand.Web/Validators/Catalog/ProductReviewsValidator.cs +++ b/src/Web/Grand.Web/Validators/Catalog/ProductReviewsValidator.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Catalog; using Grand.Domain.Common; using Grand.Domain.Orders; @@ -12,6 +11,7 @@ using Grand.SharedKernel.Captcha; using Grand.Web.Common.Validators; using Grand.Web.Models.Catalog; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Catalog; @@ -19,7 +19,7 @@ public class AddProductReviewValidator : BaseGrandValidator> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Title).NotEmpty().WithMessage(translationService.GetResource("Reviews.Fields.Title.Required")); @@ -42,7 +42,7 @@ public ProductReviewsValidator( CaptchaSettings captchaSettings, CatalogSettings catalogSettings, IContextAccessor contextAccessor, IHttpContextAccessor httpcontextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.AddProductReview.Title).NotEmpty() diff --git a/src/Web/Grand.Web/Validators/Common/AddressValidator.cs b/src/Web/Grand.Web/Validators/Common/AddressValidator.cs index 89d46fcfe1..2137994f51 100644 --- a/src/Web/Grand.Web/Validators/Common/AddressValidator.cs +++ b/src/Web/Grand.Web/Validators/Common/AddressValidator.cs @@ -1,13 +1,13 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Common.Addresses; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Common; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.Features.Models.Common; using Grand.Web.Models.Common; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Common; @@ -16,7 +16,7 @@ public class AddressValidator : BaseGrandValidator public AddressValidator( IEnumerable> validators, IMediator mediator, IAddressAttributeParser addressAttributeParser, - ITranslationService translationService, + IRequestTranslationService translationService, ICountryService countryService, AddressSettings addressSettings, IContextAccessor contextAccessor) diff --git a/src/Web/Grand.Web/Validators/Contact/ContactUsValidator.cs b/src/Web/Grand.Web/Validators/Contact/ContactUsValidator.cs index 5428a23b22..a077126185 100644 --- a/src/Web/Grand.Web/Validators/Contact/ContactUsValidator.cs +++ b/src/Web/Grand.Web/Validators/Contact/ContactUsValidator.cs @@ -1,6 +1,5 @@ using FluentValidation; using Grand.Business.Core.Extensions; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Marketing.Contacts; using Grand.Business.Core.Utilities.Catalog; using Grand.Domain.Catalog; @@ -13,6 +12,7 @@ using Grand.Web.Common.Security.Captcha; using Grand.Web.Common.Validators; using Grand.Web.Models.Contact; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Contact; @@ -20,7 +20,7 @@ public class ContactUsValidator : BaseGrandValidator { private readonly IContactAttributeParser _contactAttributeParser; private readonly IContactAttributeService _contactAttributeService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IContextAccessor _contextAccessor; public ContactUsValidator( @@ -29,7 +29,7 @@ public ContactUsValidator( IContactAttributeParser contactAttributeParser, IContactAttributeService contactAttributeService, IContextAccessor contextAccessor, - ITranslationService translationService, CommonSettings commonSettings, + IRequestTranslationService translationService, CommonSettings commonSettings, CaptchaSettings captchaSettings, IHttpContextAccessor httpcontextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator) : base(validators) diff --git a/src/Web/Grand.Web/Validators/Customer/AddOrderNoteValidator.cs b/src/Web/Grand.Web/Validators/Customer/AddOrderNoteValidator.cs index 8ba0a60f12..6fb91e13b2 100644 --- a/src/Web/Grand.Web/Validators/Customer/AddOrderNoteValidator.cs +++ b/src/Web/Grand.Web/Validators/Customer/AddOrderNoteValidator.cs @@ -1,7 +1,7 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure.Validators; using Grand.Web.Models.Orders; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Customer; @@ -9,7 +9,7 @@ public class AddOrderNoteValidator : BaseGrandValidator { public AddOrderNoteValidator( IEnumerable> validators, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.Note).NotEmpty().WithMessage(translationService.GetResource("OrderNote.Fields.Title.Required")); diff --git a/src/Web/Grand.Web/Validators/Customer/ChangePasswordValidator.cs b/src/Web/Grand.Web/Validators/Customer/ChangePasswordValidator.cs index cd6c3ab700..2fbd12a34d 100644 --- a/src/Web/Grand.Web/Validators/Customer/ChangePasswordValidator.cs +++ b/src/Web/Grand.Web/Validators/Customer/ChangePasswordValidator.cs @@ -1,12 +1,12 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Customers; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.Models.Customer; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Customer; @@ -17,7 +17,7 @@ public ChangePasswordValidator( ICustomerService customerService, IContextAccessor contextAccessor, IGroupService groupService, IEncryptionService encryptionService, ICustomerHistoryPasswordService customerHistoryPasswordService, ICustomerManagerService customerManagerService, - ITranslationService translationService, CustomerSettings customerSettings) + IRequestTranslationService translationService, CustomerSettings customerSettings) : base(validators) { RuleFor(x => x.OldPassword).NotEmpty() diff --git a/src/Web/Grand.Web/Validators/Customer/CheckoutBillingAddressValidator.cs b/src/Web/Grand.Web/Validators/Customer/CheckoutBillingAddressValidator.cs index c002a99729..1395bc08b3 100644 --- a/src/Web/Grand.Web/Validators/Customer/CheckoutBillingAddressValidator.cs +++ b/src/Web/Grand.Web/Validators/Customer/CheckoutBillingAddressValidator.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Common.Addresses; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Common; using Grand.Infrastructure; using Grand.Infrastructure.Validators; @@ -8,6 +7,7 @@ using Grand.Web.Models.Common; using Grand.Web.Validators.Common; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Customer; @@ -17,7 +17,7 @@ public CheckoutBillingAddressValidator( IEnumerable> validators, IEnumerable> addressValidators, IMediator mediator, IAddressAttributeParser addressAttributeParser, - ITranslationService translationService, + IRequestTranslationService translationService, ICountryService countryService, AddressSettings addressSettings, IContextAccessor contextAccessor) diff --git a/src/Web/Grand.Web/Validators/Customer/CheckoutShippingAddressValidator.cs b/src/Web/Grand.Web/Validators/Customer/CheckoutShippingAddressValidator.cs index 103840d984..47ae76f970 100644 --- a/src/Web/Grand.Web/Validators/Customer/CheckoutShippingAddressValidator.cs +++ b/src/Web/Grand.Web/Validators/Customer/CheckoutShippingAddressValidator.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Common.Addresses; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Common; using Grand.Infrastructure; using Grand.Infrastructure.Validators; @@ -8,6 +7,7 @@ using Grand.Web.Models.Common; using Grand.Web.Validators.Common; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Customer; @@ -17,7 +17,7 @@ public CheckoutShippingAddressValidator( IEnumerable> validators, IEnumerable> addressValidators, IMediator mediator, IAddressAttributeParser addressAttributeParser, - ITranslationService translationService, + IRequestTranslationService translationService, ICountryService countryService, AddressSettings addressSettings, IContextAccessor contextAccessor) diff --git a/src/Web/Grand.Web/Validators/Customer/CustomerAddressEditValidator.cs b/src/Web/Grand.Web/Validators/Customer/CustomerAddressEditValidator.cs index f55a127836..6ffebd35be 100644 --- a/src/Web/Grand.Web/Validators/Customer/CustomerAddressEditValidator.cs +++ b/src/Web/Grand.Web/Validators/Customer/CustomerAddressEditValidator.cs @@ -1,6 +1,5 @@ using Grand.Business.Core.Interfaces.Common.Addresses; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Common; using Grand.Infrastructure; using Grand.Infrastructure.Validators; @@ -8,6 +7,7 @@ using Grand.Web.Models.Customer; using Grand.Web.Validators.Common; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Customer; @@ -17,7 +17,7 @@ public CustomerAddressEditValidator( IEnumerable> validators, IEnumerable> addressValidators, IMediator mediator, IAddressAttributeParser addressAttributeParser, - ITranslationService translationService, + IRequestTranslationService translationService, ICountryService countryService, AddressSettings addressSettings, IContextAccessor contextAccessor) diff --git a/src/Web/Grand.Web/Validators/Customer/CustomerInfoValidator.cs b/src/Web/Grand.Web/Validators/Customer/CustomerInfoValidator.cs index 528e915db5..2255993290 100644 --- a/src/Web/Grand.Web/Validators/Customer/CustomerInfoValidator.cs +++ b/src/Web/Grand.Web/Validators/Customer/CustomerInfoValidator.cs @@ -1,6 +1,5 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Customers; using Grand.Infrastructure; @@ -10,6 +9,7 @@ using Grand.Web.Features.Models.Customers; using Grand.Web.Models.Customer; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Customer; @@ -20,7 +20,7 @@ public CustomerInfoValidator( IContextAccessor contextAccessor, ICustomerService customerService, IMediator mediator, ICustomerAttributeParser customerAttributeParser, - ITranslationService translationService, + IRequestTranslationService translationService, ICountryService countryService, CustomerSettings customerSettings, CustomerConfig customerConfig) diff --git a/src/Web/Grand.Web/Validators/Customer/DeleteAccountValidator.cs b/src/Web/Grand.Web/Validators/Customer/DeleteAccountValidator.cs index 78cb3da5a4..d18846ae0f 100644 --- a/src/Web/Grand.Web/Validators/Customer/DeleteAccountValidator.cs +++ b/src/Web/Grand.Web/Validators/Customer/DeleteAccountValidator.cs @@ -1,11 +1,11 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Domain.Customers; using Grand.Infrastructure; using Grand.Infrastructure.Configuration; using Grand.Infrastructure.Validators; using Grand.Web.Models.Customer; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Customer; @@ -14,7 +14,7 @@ public class DeleteAccountValidator : BaseGrandValidator public DeleteAccountValidator( IEnumerable> validators, IEncryptionService encryptionService, CustomerSettings customerSettings, IContextAccessor contextAccessor, - ITranslationService translationService, OidcLoginConfig loginConfig) + IRequestTranslationService translationService, OidcLoginConfig loginConfig) : base(validators) { //no password is asked for when the identity provider is the only sign-in diff --git a/src/Web/Grand.Web/Validators/Customer/LoginValidator.cs b/src/Web/Grand.Web/Validators/Customer/LoginValidator.cs index d3ff572745..98ab883730 100644 --- a/src/Web/Grand.Web/Validators/Customer/LoginValidator.cs +++ b/src/Web/Grand.Web/Validators/Customer/LoginValidator.cs @@ -2,7 +2,6 @@ using Grand.Business.Core.Events.Customers; using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Common.Security; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Common; @@ -15,6 +14,7 @@ using Grand.Web.Common.Validators; using Grand.Web.Models.Customer; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Customer; @@ -24,7 +24,7 @@ public LoginValidator( IEnumerable> validators, IEnumerable> validatorsCaptcha, ICustomerService customerService, IGroupService groupService, IEncryptionService encryptionService, - ITranslationService translationService, CustomerSettings customerSettings, CaptchaSettings captchaSettings, + IRequestTranslationService translationService, CustomerSettings customerSettings, CaptchaSettings captchaSettings, IHttpContextAccessor contextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator, IContextAccessor workContextAccessor, CustomerConfig customerConfig, IExternalSignInPolicy externalSignInPolicy) diff --git a/src/Web/Grand.Web/Validators/Customer/PasswordRecoveryConfirmValidator.cs b/src/Web/Grand.Web/Validators/Customer/PasswordRecoveryConfirmValidator.cs index 6f37fa6fbf..163469b443 100644 --- a/src/Web/Grand.Web/Validators/Customer/PasswordRecoveryConfirmValidator.cs +++ b/src/Web/Grand.Web/Validators/Customer/PasswordRecoveryConfirmValidator.cs @@ -1,13 +1,13 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Authentication; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Customers; using Grand.Infrastructure; using Grand.Infrastructure.Configuration; using Grand.Infrastructure.Validators; using Grand.Web.Models.Customer; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Customer; @@ -18,7 +18,7 @@ public PasswordRecoveryConfirmValidator( ICustomerService customerService, IGroupService groupService, ICustomerManagerService customerManagerService, ICustomerHistoryPasswordService customerHistoryPasswordService, - ITranslationService translationService, CustomerSettings customerSettings, + IRequestTranslationService translationService, CustomerSettings customerSettings, IContextAccessor contextAccessor, CustomerConfig customerConfig, IExternalSignInPolicy externalSignInPolicy) : base(validators) diff --git a/src/Web/Grand.Web/Validators/Customer/PasswordRecoveryValidator.cs b/src/Web/Grand.Web/Validators/Customer/PasswordRecoveryValidator.cs index 1a518adef8..68dd7b2f12 100644 --- a/src/Web/Grand.Web/Validators/Customer/PasswordRecoveryValidator.cs +++ b/src/Web/Grand.Web/Validators/Customer/PasswordRecoveryValidator.cs @@ -1,5 +1,4 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Common; using Grand.Infrastructure; @@ -9,6 +8,7 @@ using Grand.SharedKernel.Captcha; using Grand.Web.Common.Validators; using Grand.Web.Models.Customer; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Customer; @@ -19,7 +19,7 @@ public PasswordRecoveryValidator( IEnumerable> validatorsCaptcha, ICustomerService customerService, CaptchaSettings captchaSettings, IHttpContextAccessor contextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor workContextAccessor, CustomerConfig customerConfig) : base(validators) { diff --git a/src/Web/Grand.Web/Validators/Customer/RegisterValidator.cs b/src/Web/Grand.Web/Validators/Customer/RegisterValidator.cs index 1330605a2a..3f8c801b6d 100644 --- a/src/Web/Grand.Web/Validators/Customer/RegisterValidator.cs +++ b/src/Web/Grand.Web/Validators/Customer/RegisterValidator.cs @@ -1,6 +1,5 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Common; using Grand.Domain.Customers; @@ -15,6 +14,7 @@ using Grand.Web.Features.Models.Customers; using Grand.Web.Models.Customer; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Customer; @@ -23,7 +23,7 @@ public class RegisterValidator : BaseGrandValidator public RegisterValidator( IEnumerable> validators, IEnumerable> validatorsCaptcha, - ITranslationService translationService, + IRequestTranslationService translationService, ICountryService countryService, CustomerSettings customerSettings, CaptchaSettings captchaSettings, IHttpContextAccessor httpcontextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator, diff --git a/src/Web/Grand.Web/Validators/Customer/SubAccountCreateValidator.cs b/src/Web/Grand.Web/Validators/Customer/SubAccountCreateValidator.cs index c4e31d13f6..d378a49038 100644 --- a/src/Web/Grand.Web/Validators/Customer/SubAccountCreateValidator.cs +++ b/src/Web/Grand.Web/Validators/Customer/SubAccountCreateValidator.cs @@ -1,11 +1,11 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Customers; using Grand.Infrastructure; using Grand.Infrastructure.Configuration; using Grand.Infrastructure.Validators; using Grand.Web.Models.Customer; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Customer; @@ -14,7 +14,7 @@ public class SubAccountCreateValidator : BaseGrandValidator> validators, ICustomerService customerService, - ITranslationService translationService, + IRequestTranslationService translationService, CustomerSettings customerSettings, IContextAccessor contextAccessor, CustomerConfig customerConfig) : base(validators) diff --git a/src/Web/Grand.Web/Validators/Customer/SubAccountEditValidator.cs b/src/Web/Grand.Web/Validators/Customer/SubAccountEditValidator.cs index c719ff68c2..3e66f36527 100644 --- a/src/Web/Grand.Web/Validators/Customer/SubAccountEditValidator.cs +++ b/src/Web/Grand.Web/Validators/Customer/SubAccountEditValidator.cs @@ -1,6 +1,5 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Domain.Customers; using Grand.Infrastructure; @@ -8,6 +7,7 @@ using Grand.Infrastructure.Validators; using Grand.SharedKernel.Extensions; using Grand.Web.Models.Customer; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Customer; @@ -16,7 +16,7 @@ public class SubAccountEditValidator : BaseGrandValidator public SubAccountEditValidator( IEnumerable> validators, ICustomerService customerService, IGroupService groupService, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor, CustomerSettings customerSettings, CustomerConfig customerConfig) diff --git a/src/Web/Grand.Web/Validators/Knowledgebase/KnowledgebaseArticleValidator.cs b/src/Web/Grand.Web/Validators/Knowledgebase/KnowledgebaseArticleValidator.cs index fc2b863ecc..cd03a2b74a 100644 --- a/src/Web/Grand.Web/Validators/Knowledgebase/KnowledgebaseArticleValidator.cs +++ b/src/Web/Grand.Web/Validators/Knowledgebase/KnowledgebaseArticleValidator.cs @@ -1,7 +1,6 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Common; using Grand.Domain.Knowledgebase; using Grand.Infrastructure; @@ -11,6 +10,7 @@ using Grand.Web.Common.Extensions; using Grand.Web.Common.Validators; using Grand.Web.Models.Knowledgebase; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Knowledgebase; @@ -23,7 +23,7 @@ public KnowledgebaseArticleValidator( IKnowledgebaseService knowledgebaseService, KnowledgebaseSettings knowledgebaseSettings, CaptchaSettings captchaSettings, IHttpContextAccessor httpcontextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.AddNewComment.CommentText).NotEmpty() diff --git a/src/Web/Grand.Web/Validators/News/AddNewsCommentValidator.cs b/src/Web/Grand.Web/Validators/News/AddNewsCommentValidator.cs index 8ce21145c2..46ee43d6e8 100644 --- a/src/Web/Grand.Web/Validators/News/AddNewsCommentValidator.cs +++ b/src/Web/Grand.Web/Validators/News/AddNewsCommentValidator.cs @@ -1,7 +1,6 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Cms; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Common; using Grand.Domain.News; using Grand.Infrastructure; @@ -10,6 +9,7 @@ using Grand.SharedKernel.Captcha; using Grand.Web.Common.Validators; using Grand.Web.Models.News; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.News; @@ -21,7 +21,7 @@ public AddNewsCommentValidator( IContextAccessor contextAccessor, IGroupService groupService, INewsService newsService, CaptchaSettings captchaSettings, NewsSettings newsSettings, IHttpContextAccessor httpcontextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.CommentTitle).NotEmpty() diff --git a/src/Web/Grand.Web/Validators/Orders/MerchandiseReturnValidator.cs b/src/Web/Grand.Web/Validators/Orders/MerchandiseReturnValidator.cs index 6fe1921405..3ef9c48bee 100644 --- a/src/Web/Grand.Web/Validators/Orders/MerchandiseReturnValidator.cs +++ b/src/Web/Grand.Web/Validators/Orders/MerchandiseReturnValidator.cs @@ -2,13 +2,13 @@ using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Checkout.Orders; using Grand.Business.Core.Interfaces.Common.Addresses; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Orders; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.Features.Models.Common; using Grand.Web.Models.Orders; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Orders; @@ -18,7 +18,7 @@ public MerchandiseReturnValidator( IEnumerable> validators, OrderSettings orderSettings, IOrderService orderService, IProductService productService, IMediator mediator, IAddressAttributeParser addressAttributeParser, - ITranslationService translationService, + IRequestTranslationService translationService, IContextAccessor contextAccessor) : base(validators) { diff --git a/src/Web/Grand.Web/Validators/ShoppingCart/DiscountCouponValidator.cs b/src/Web/Grand.Web/Validators/ShoppingCart/DiscountCouponValidator.cs index c5ea53c714..5a2cdda4f5 100644 --- a/src/Web/Grand.Web/Validators/ShoppingCart/DiscountCouponValidator.cs +++ b/src/Web/Grand.Web/Validators/ShoppingCart/DiscountCouponValidator.cs @@ -1,10 +1,10 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Catalog.Discounts; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Customers; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.Models.ShoppingCart; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.ShoppingCart; @@ -14,7 +14,7 @@ public DiscountCouponValidator( IEnumerable> validators, IDiscountValidationService discountValidationService, IDiscountService discountService, IContextAccessor contextAccessor, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.DiscountCouponCode).NotEmpty() diff --git a/src/Web/Grand.Web/Validators/ShoppingCart/GiftVoucherCouponValidator.cs b/src/Web/Grand.Web/Validators/ShoppingCart/GiftVoucherCouponValidator.cs index 84e2fc0abb..91183856f5 100644 --- a/src/Web/Grand.Web/Validators/ShoppingCart/GiftVoucherCouponValidator.cs +++ b/src/Web/Grand.Web/Validators/ShoppingCart/GiftVoucherCouponValidator.cs @@ -1,11 +1,11 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Queries.Checkout.Orders; using Grand.Domain.Orders; using Grand.Infrastructure; using Grand.Infrastructure.Validators; using Grand.Web.Models.ShoppingCart; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.ShoppingCart; @@ -14,7 +14,7 @@ public class GiftVoucherCouponValidator : BaseGrandValidator> validators, IMediator mediator, IContextAccessor contextAccessor, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.GiftVoucherCouponCode).NotEmpty() diff --git a/src/Web/Grand.Web/Validators/ShoppingCart/WishlistEmailAFriendValidator.cs b/src/Web/Grand.Web/Validators/ShoppingCart/WishlistEmailAFriendValidator.cs index 4ef80b5699..132e192460 100644 --- a/src/Web/Grand.Web/Validators/ShoppingCart/WishlistEmailAFriendValidator.cs +++ b/src/Web/Grand.Web/Validators/ShoppingCart/WishlistEmailAFriendValidator.cs @@ -1,6 +1,5 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Common; using Grand.Domain.Orders; using Grand.Infrastructure; @@ -9,6 +8,7 @@ using Grand.SharedKernel.Captcha; using Grand.Web.Common.Validators; using Grand.Web.Models.ShoppingCart; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.ShoppingCart; @@ -20,7 +20,7 @@ public WishlistEmailAFriendValidator( IContextAccessor contextAccessor, IGroupService groupService, CaptchaSettings captchaSettings, ShoppingCartSettings shoppingCartSettings, IHttpContextAccessor httpcontextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.FriendEmail).NotEmpty() diff --git a/src/Web/Grand.Web/Validators/Vendors/ApplyVendorValidator.cs b/src/Web/Grand.Web/Validators/Vendors/ApplyVendorValidator.cs index 1d3fbbd2d4..de9ef06e3f 100644 --- a/src/Web/Grand.Web/Validators/Vendors/ApplyVendorValidator.cs +++ b/src/Web/Grand.Web/Validators/Vendors/ApplyVendorValidator.cs @@ -1,6 +1,5 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Common; using Grand.Domain.Vendors; using Grand.Infrastructure.Models; @@ -8,6 +7,7 @@ using Grand.SharedKernel.Captcha; using Grand.Web.Common.Validators; using Grand.Web.Models.Vendors; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Vendors; @@ -17,7 +17,7 @@ public ApplyVendorValidator( IEnumerable> validators, IEnumerable> validatorsCaptcha, IEnumerable> addressvalidators, - ITranslationService translationService, ICountryService countryService, + IRequestTranslationService translationService, ICountryService countryService, CaptchaSettings captchaSettings, IHttpContextAccessor contextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator, VendorSettings addressSettings) diff --git a/src/Web/Grand.Web/Validators/Vendors/ContactVendorValidator.cs b/src/Web/Grand.Web/Validators/Vendors/ContactVendorValidator.cs index 0d886b1935..78fbd1b5f2 100644 --- a/src/Web/Grand.Web/Validators/Vendors/ContactVendorValidator.cs +++ b/src/Web/Grand.Web/Validators/Vendors/ContactVendorValidator.cs @@ -1,5 +1,4 @@ using FluentValidation; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Common; using Grand.Infrastructure.Models; using Grand.Infrastructure.Validators; @@ -7,6 +6,7 @@ using Grand.Web.Common.Security.Captcha; using Grand.Web.Common.Validators; using Grand.Web.Models.Vendors; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Vendors; @@ -17,7 +17,7 @@ public ContactVendorValidator( IEnumerable> validatorsCaptcha, CaptchaSettings captchaSettings, IHttpContextAccessor contextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator, - ITranslationService translationService, CommonSettings commonSettings) + IRequestTranslationService translationService, CommonSettings commonSettings) : base(validators) { RuleFor(x => x.Email).NotEmpty().WithMessage(translationService.GetResource("ContactVendor.Email.Required")); diff --git a/src/Web/Grand.Web/Validators/Vendors/VendorAddressValidator.cs b/src/Web/Grand.Web/Validators/Vendors/VendorAddressValidator.cs index 76b463001c..67650bac19 100644 --- a/src/Web/Grand.Web/Validators/Vendors/VendorAddressValidator.cs +++ b/src/Web/Grand.Web/Validators/Vendors/VendorAddressValidator.cs @@ -1,9 +1,9 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Vendors; using Grand.Infrastructure.Validators; using Grand.Web.Models.Vendors; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Vendors; @@ -11,7 +11,7 @@ public class VendorAddressValidator : BaseGrandValidator { public VendorAddressValidator( IEnumerable> validators, - ITranslationService translationService, + IRequestTranslationService translationService, ICountryService countryService, VendorSettings addressSettings) : base(validators) diff --git a/src/Web/Grand.Web/Validators/Vendors/VendorReviewsValidator.cs b/src/Web/Grand.Web/Validators/Vendors/VendorReviewsValidator.cs index 8716069f8c..5e238c6351 100644 --- a/src/Web/Grand.Web/Validators/Vendors/VendorReviewsValidator.cs +++ b/src/Web/Grand.Web/Validators/Vendors/VendorReviewsValidator.cs @@ -1,6 +1,5 @@ using FluentValidation; using Grand.Business.Core.Interfaces.Common.Directory; -using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Customers; using Grand.Business.Core.Queries.Checkout.Orders; using Grand.Domain.Common; @@ -13,6 +12,7 @@ using Grand.Web.Common.Validators; using Grand.Web.Models.Vendors; using Grand.Mediator; +using Grand.Web.Common.Localization; namespace Grand.Web.Validators.Vendors; @@ -25,7 +25,7 @@ public VendorReviewsValidator( IGroupService groupService, IContextAccessor contextAccessor, IVendorService vendorService, CaptchaSettings captchaSettings, VendorSettings vendorSettings, IHttpContextAccessor httpcontextAccessor, IGoogleReCaptchaValidator googleReCaptchaValidator, - ITranslationService translationService) + IRequestTranslationService translationService) : base(validators) { RuleFor(x => x.AddVendorReview.Title).NotEmpty() From 1160094948348d4371e112f33e745f7254a982ca Mon Sep 17 00:00:00 2001 From: support Date: Sat, 17 Oct 2026 20:43:37 +0200 Subject: [PATCH 2/3] Document IRequestTranslationService in the agent guides --- .ai/examples/payment-plugin-walkthrough.md | 8 ++++---- .ai/knowledge/dotnet.md | 4 ++-- .ai/knowledge/security.md | 2 +- .ai/skills/plugin-payment.md | 2 +- .ai/skills/plugin-shipping.md | 2 +- .ai/skills/plugin-widget.md | 2 +- .ai/skills/settings-and-localization.md | 4 ++-- .ai/templates/plugin/admin-configuration.md | 5 +++-- 8 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.ai/examples/payment-plugin-walkthrough.md b/.ai/examples/payment-plugin-walkthrough.md index 9016154559..b82cc99303 100644 --- a/.ai/examples/payment-plugin-walkthrough.md +++ b/.ai/examples/payment-plugin-walkthrough.md @@ -47,7 +47,7 @@ public static class CashOnDeliveryPaymentDefaults Three constants, referenced everywhere else: - `ProviderSystemName` → the manifest's `SystemName`, the provider's `SystemName`, and the output folder. All three must agree; the system name is the plugin's persisted identity and cannot change after release. -- `FriendlyName` is a **resource key**, not a display string. The provider resolves it through `ITranslationService`. +- `FriendlyName` is a **resource key**, not a display string. The provider resolves it through `IRequestTranslationService`. - `ConfigurationUrl` must match the admin controller's actual route, or the admin's *Configure* link 404s. The manifest points back at the constant: @@ -67,7 +67,7 @@ The manifest points back at the constant: public class CashOnDeliveryPaymentProvider : IPaymentProvider { public CashOnDeliveryPaymentProvider( - ITranslationService translationService, + IRequestTranslationService translationService, IHttpContextAccessor httpContextAccessor, CashOnDeliveryPaymentSettings cashOnDeliveryPaymentSettings) { … } @@ -85,7 +85,7 @@ public class CashOnDeliveryPaymentProvider : IPaymentProvider Points worth copying: - **The settings class is injected directly.** GrandNode registers `ISettings` implementations in DI — do not resolve them through `ISettingService` inside a provider. -- **`FriendlyName` goes through `ITranslationService`.** A literal here cannot be translated and cannot be changed by an operator. +- **`FriendlyName` goes through `IRequestTranslationService`.** A literal here cannot be translated and cannot be changed by an operator. - **`Priority` comes from `DisplayOrder`**, so operators control ordering from the admin screen. - **`LimitedToStores` / `LimitedToGroups`** are the scoping hooks from `.ai/knowledge/scoping.md`. Returning empty lists means "available everywhere". @@ -206,6 +206,6 @@ A Release output path missing means the plugin silently disappears from release 1. Host starts → assembly scan finds `StartupApplication` → `IPaymentProvider` registered. 2. Plugin marked installed → `Install()` seeded settings and resource keys. 3. Checkout asks for available payment providers → this one appears, ordered by `Priority`, filtered by `LimitedToStores` / `LimitedToGroups`. -4. Its name renders through `FriendlyName` → `ITranslationService` → the resource key installed in step 2. +4. Its name renders through `FriendlyName` → `IRequestTranslationService` → the resource key installed in step 2. 5. Operator clicks *Configure* → `ConfigurationUrl` → admin controller → settings loaded for the active store. 6. Customer selects it → `ProcessPayment` → `TransactionStatus.Pending`. diff --git a/.ai/knowledge/dotnet.md b/.ai/knowledge/dotnet.md index 33fdbbe5c9..de5beadc0a 100644 --- a/.ai/knowledge/dotnet.md +++ b/.ai/knowledge/dotnet.md @@ -68,10 +68,10 @@ Use `switch` with `when` guards rather than nested `if/else`: switch (cartItem.ShoppingCartTypeId) { case ShoppingCartType.ShoppingCart when product.DisableBuyButton: - context.AddFailure(translationService.GetResource("ShoppingCart.BuyingDisabled")); + context.AddFailure(translationService.GetResource("ShoppingCart.BuyingDisabled", value.Language.Id)); break; case ShoppingCartType.Wishlist when product.DisableWishlistButton: - context.AddFailure(translationService.GetResource("ShoppingCart.WishlistDisabled")); + context.AddFailure(translationService.GetResource("ShoppingCart.WishlistDisabled", value.Language.Id)); break; } ``` diff --git a/.ai/knowledge/security.md b/.ai/knowledge/security.md index 5fdb92e064..c8a2c47e99 100644 --- a/.ai/knowledge/security.md +++ b/.ai/knowledge/security.md @@ -52,7 +52,7 @@ public class ShoppingCartStandardValidator : AbstractValidator x).Custom((value, context) => { if (!value.Product.Published) - context.AddFailure(translationService.GetResource("ShoppingCart.ProductUnpublished")); + context.AddFailure(translationService.GetResource("ShoppingCart.ProductUnpublished", value.Language.Id)); }); } } diff --git a/.ai/skills/plugin-payment.md b/.ai/skills/plugin-payment.md index 38212e0bfb..7b5816d47a 100644 --- a/.ai/skills/plugin-payment.md +++ b/.ai/skills/plugin-payment.md @@ -48,7 +48,7 @@ Do not use this skill for order processing business logic outside the payment fl - `TransactionStatus.Pending` — order placed but not yet confirmed. - `TransactionStatus.Authorized` — gateway authorized; capture is separate. - `TransactionStatus.Paid` — payment fully captured immediately. -4. Resolve `FriendlyName` through `ITranslationService.GetResource(Defaults.FriendlyName)`. +4. Resolve `FriendlyName` through `IRequestTranslationService.GetResource(Defaults.FriendlyName)`. 5. Set `LogoURL` to `"/Plugins/{SystemName}/logo.jpg"`. #### Redirect Payment Flow diff --git a/.ai/skills/plugin-shipping.md b/.ai/skills/plugin-shipping.md index b4a6b1bc39..07dc08c612 100644 --- a/.ai/skills/plugin-shipping.md +++ b/.ai/skills/plugin-shipping.md @@ -34,7 +34,7 @@ Do not use this skill for shipping method domain data (managed via `IShippingMet | `ShippingRateCalculationType` | `ShippingRateCalculationType.Off` for pre-configured rates; `ShippingRateCalculationType.Real` for live API rates. | | `ShipmentTracker` | Return `null` if shipment tracking is not supported; return an `IShipmentTracker` implementation otherwise. | -3. Resolve `FriendlyName` through `ITranslationService.GetResource(Defaults.FriendlyName)` so it is localizable. +3. Resolve `FriendlyName` through `IRequestTranslationService.GetResource(Defaults.FriendlyName)` so it is localizable. 4. Resolve `Priority` from the plugin settings `DisplayOrder` property. 5. Use `IShippingMethodService.GetAllShippingMethods(restrictByCountryId, customer, storeId)` to iterate over admin-configured methods and build a `ShippingOption` for each. 6. Set `ShippingOption.Name` and `ShippingOption.Description` using `shippingMethod.GetTranslation(x => x.Name, languageId)`. diff --git a/.ai/skills/plugin-widget.md b/.ai/skills/plugin-widget.md index 811f5549d9..f8a95d1b59 100644 --- a/.ai/skills/plugin-widget.md +++ b/.ai/skills/plugin-widget.md @@ -29,7 +29,7 @@ Do not use this skill for admin-only functionality with no storefront output, or | `GetWidgetZones()` | Return the list of zone names where this widget renders. Use existing zone name constants from `Defaults` or string literals matching the zones used in storefront views. | | `GetPublicViewComponentName(widgetZone)` | Return the view component name to invoke for the given zone. Can return different component names per zone, or the same name for all zones. | -3. Resolve `FriendlyName` through `ITranslationService.GetResource(Defaults.FriendlyName)`. +3. Resolve `FriendlyName` through `IRequestTranslationService.GetResource(Defaults.FriendlyName)`. 4. Resolve `Priority` from settings `DisplayOrder`. #### View Component diff --git a/.ai/skills/settings-and-localization.md b/.ai/skills/settings-and-localization.md index 9a66e6b973..408a4f1b72 100644 --- a/.ai/skills/settings-and-localization.md +++ b/.ai/skills/settings-and-localization.md @@ -45,7 +45,7 @@ Do not use this skill as the primary review for MongoDB query safety or security - `Plugin` (3) — plugin-owned resources. - `Vendor` (5) — vendor panel. 14. Seed default resources for core features in `src/Modules/Grand.Module.Installer/Services/InstallDataLocaleResources.cs` via `src/Web/Grand.Web/App_Data/Resources/DefaultLanguage.xml`. -15. Access resources in controllers and services by injecting `ITranslationService` and calling `GetResource(key)` or `GetResource(key, languageId, defaultValue)`. +15. Access resources by language. `ITranslationService` (Business) only has `GetResource(key, languageId, defaultValue)`: code in `src/Business` or the API module passes the language it has (the customer's, the order's, the store default). Web code that runs inside a request injects `IRequestTranslationService` (`Grand.Web.Common.Localization`), which adds `GetResource(key)` in the working language of the request. 16. Access resources in Razor views through the `Loc` indexer: `@Loc["key"]`. Do not call `ITranslationService` directly from views. 17. Translate enum values using `IEnumTranslationService` with keys formatted as `Enums.{TypeName}.{ValueName}`. @@ -145,7 +145,7 @@ Include changed files, store-scope behavior, resource area classification, valid - [ ] `DeleteSetting` is called in plugin `Uninstall`. - [ ] Every resource key added in `Install` is removed in `Uninstall`. - [ ] Resource area is set correctly (`TranslationResourceArea`). -- [ ] Controllers use `ITranslationService.GetResource(key)` for display messages. +- [ ] Controllers use `IRequestTranslationService.GetResource(key)` for display messages; Business code passes a language. - [ ] Views use `@Loc["key"]` and do not call `ITranslationService` directly. - [ ] Entities that need per-language values implement `ITranslationEntity`. - [ ] Admin models that expose localized fields implement `ILocalizedModel`. diff --git a/.ai/templates/plugin/admin-configuration.md b/.ai/templates/plugin/admin-configuration.md index ffc14bb4e9..2259de26a8 100644 --- a/.ai/templates/plugin/admin-configuration.md +++ b/.ai/templates/plugin/admin-configuration.md @@ -35,6 +35,7 @@ using Grand.Domain.Permissions; using Grand.Web.Common.Controllers; using Grand.Web.Common.Filters; using Grand.Web.Common.Helpers; +using Grand.Web.Common.Localization; using Grand.Web.Common.Security.Authorization; using Microsoft.AspNetCore.Mvc; using {SystemName}.Models; @@ -47,12 +48,12 @@ namespace {SystemName}.Areas.Admin.Controllers; public class {ControllerName}Controller : Base{Kind}Controller { private readonly ISettingService _settingService; - private readonly ITranslationService _translationService; + private readonly IRequestTranslationService _translationService; private readonly IAdminStoreService _adminStoreService; public {ControllerName}Controller( ISettingService settingService, - ITranslationService translationService, + IRequestTranslationService translationService, IAdminStoreService adminStoreService) { _settingService = settingService; From 3b6c612382ba6d87709b9bb0b52fbccde8d85040 Mon Sep 17 00:00:00 2001 From: support Date: Sat, 17 Oct 2026 21:38:24 +0200 Subject: [PATCH 3/3] Guard the working language in API validators and slim RequestTranslationService - Add IContextAccessor.WorkingLanguageId() in the API module so validators no longer throw when no working language is resolved - Move RequestTranslationService to its own file and derive it from TranslationService instead of forwarding every member - Return an empty string from GetResource(name) when there is no work context --- .../Extensions/ContextAccessorExtensions.cs | 14 +++++ .../Validators/Catalog/BrandValidator.cs | 3 +- .../Validators/Catalog/CategoryValidator.cs | 3 +- .../Validators/Catalog/CollectionValidator.cs | 3 +- .../ProductAttributeMappingValidator.cs | 3 +- .../Catalog/ProductAttributeValidator.cs | 3 +- .../Catalog/ProductCategoryValidator.cs | 3 +- .../Catalog/ProductCollectionValidator.cs | 3 +- .../Catalog/ProductPictureValidator.cs | 3 +- .../ProductSpecificationAttributeValidator.cs | 3 +- .../Catalog/ProductTierPriceValidator.cs | 3 +- .../Validators/Catalog/ProductValidator.cs | 3 +- .../SpecificationAttributeValidator.cs | 3 +- .../Validators/Common/PictureValidator.cs | 3 +- .../Validators/Customers/AddressValidator.cs | 3 +- .../Customers/CustomerGroupValidator.cs | 3 +- .../Validators/Customers/CustomerValidator.cs | 3 +- .../Validators/Customers/PasswordValidator.cs | 3 +- .../RequestTranslationServiceTests.cs | 26 +++++--- .../IRequestTranslationService.cs | 63 ------------------- .../Localization/RequestTranslationService.cs | 20 ++++++ 21 files changed, 87 insertions(+), 87 deletions(-) create mode 100644 src/Modules/Grand.Module.Api/Extensions/ContextAccessorExtensions.cs create mode 100644 src/Web/Grand.Web.Common/Localization/RequestTranslationService.cs diff --git a/src/Modules/Grand.Module.Api/Extensions/ContextAccessorExtensions.cs b/src/Modules/Grand.Module.Api/Extensions/ContextAccessorExtensions.cs new file mode 100644 index 0000000000..9729e20e75 --- /dev/null +++ b/src/Modules/Grand.Module.Api/Extensions/ContextAccessorExtensions.cs @@ -0,0 +1,14 @@ +using Grand.Infrastructure; + +namespace Grand.Module.Api.Extensions; + +public static class ContextAccessorExtensions +{ + /// + /// Gets the working language id of the current request, or an empty string when none is resolved + /// + public static string WorkingLanguageId(this IContextAccessor contextAccessor) + { + return contextAccessor.WorkContext?.WorkingLanguage?.Id ?? string.Empty; + } +} diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/BrandValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/BrandValidator.cs index fda30793eb..da79b6ccdd 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/BrandValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/BrandValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Brands; using Grand.Business.Core.Interfaces.Common.Localization; @@ -16,7 +17,7 @@ public BrandValidator(IEnumerable> validators, IBrandLayoutService brandLayoutService) : base(validators) { - var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + var languageId = contextAccessor.WorkingLanguageId(); RuleFor(x => x.Name).NotEmpty() .WithMessage(translationService.GetResource("Api.Catalog.Brand.Fields.Name.Required", languageId)); diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/CategoryValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/CategoryValidator.cs index 2a99aad7e1..0abb124330 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/CategoryValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/CategoryValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Categories; using Grand.Business.Core.Interfaces.Common.Localization; @@ -16,7 +17,7 @@ public CategoryValidator(IEnumerable> validators ICategoryLayoutService categoryLayoutService) : base(validators) { - var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + var languageId = contextAccessor.WorkingLanguageId(); RuleFor(x => x.Name).NotEmpty() .WithMessage(translationService.GetResource("Api.Catalog.Category.Fields.Name.Required", languageId)); diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/CollectionValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/CollectionValidator.cs index 83d9236d6a..34741c127a 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/CollectionValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/CollectionValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Collections; using Grand.Business.Core.Interfaces.Common.Localization; @@ -16,7 +17,7 @@ public CollectionValidator(IEnumerable> valida ICollectionLayoutService collectionLayoutService) : base(validators) { - var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + var languageId = contextAccessor.WorkingLanguageId(); RuleFor(x => x.Name).NotEmpty() .WithMessage(translationService.GetResource("Api.Catalog.Collection.Fields.Name.Required", languageId)); diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeMappingValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeMappingValidator.cs index 02ca24ae94..298c7a2f29 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeMappingValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeMappingValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Localization; @@ -15,7 +16,7 @@ public ProductAttributeMappingValidator( IContextAccessor contextAccessor, IProductAttributeService productAttributeService) : base(validators) { - var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + var languageId = contextAccessor.WorkingLanguageId(); RuleFor(x => x).MustAsync(async (x, _, _) => { diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeValidator.cs index 975da2a01b..c7f423a68e 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductAttributeValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Localization; @@ -14,7 +15,7 @@ public ProductAttributeValidator(IEnumerable x.Name).NotEmpty() .WithMessage(translationService.GetResource("Api.Catalog.ProductAttribute.Fields.Name.Required", languageId)); diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCategoryValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCategoryValidator.cs index f1757d8193..8a15821179 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCategoryValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCategoryValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Categories; using Grand.Business.Core.Interfaces.Common.Localization; @@ -14,7 +15,7 @@ public ProductCategoryValidator(IEnumerable x).MustAsync(async (x, _, _) => { diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCollectionValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCollectionValidator.cs index 4aa76980e8..678476f9a8 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCollectionValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductCollectionValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Collections; using Grand.Business.Core.Interfaces.Common.Localization; @@ -14,7 +15,7 @@ public ProductCollectionValidator(IEnumerable x).MustAsync(async (x, _, _) => { diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductPictureValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductPictureValidator.cs index 6639095301..32b5d8c729 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductPictureValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductPictureValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Business.Core.Interfaces.Storage; @@ -14,7 +15,7 @@ public ProductPictureValidator(IEnumerable IContextAccessor contextAccessor, IPictureService pictureService) : base(validators) { - var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + var languageId = contextAccessor.WorkingLanguageId(); RuleFor(x => x).MustAsync(async (x, _, _) => { diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductSpecificationAttributeValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductSpecificationAttributeValidator.cs index 2d2416e6c8..bd46db9ff6 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductSpecificationAttributeValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductSpecificationAttributeValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Localization; @@ -15,7 +16,7 @@ public ProductSpecificationAttributeValidator( IContextAccessor contextAccessor, ISpecificationAttributeService specificationAttributeService) : base(validators) { - var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + var languageId = contextAccessor.WorkingLanguageId(); RuleFor(x => x).MustAsync(async (x, _, _) => { diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductTierPriceValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductTierPriceValidator.cs index 790c3d8286..53215aa8df 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductTierPriceValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductTierPriceValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Common.Directory; using Grand.Business.Core.Interfaces.Common.Localization; @@ -16,7 +17,7 @@ public ProductTierPriceValidator( IContextAccessor contextAccessor, IStoreService storeService, IGroupService groupService) : base(validators) { - var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + var languageId = contextAccessor.WorkingLanguageId(); RuleFor(x => x.Quantity).GreaterThan(0) .WithMessage(translationService.GetResource("Api.Catalog.ProductTierPrice.Fields.Quantity.GreaterThan0", languageId)); diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductValidator.cs index 6f3077517e..9e4bca743f 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/ProductValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/ProductValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Brands; using Grand.Business.Core.Interfaces.Catalog.Products; @@ -22,7 +23,7 @@ public ProductValidator( IVendorService vendorService, CommonSettings commonSettings) : base(validators) { - var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + var languageId = contextAccessor.WorkingLanguageId(); RuleFor(x => x.Name).NotEmpty() .WithMessage(translationService.GetResource("Api.Catalog.Product.Fields.Name.Required", languageId)); diff --git a/src/Modules/Grand.Module.Api/Validators/Catalog/SpecificationAttributeValidator.cs b/src/Modules/Grand.Module.Api/Validators/Catalog/SpecificationAttributeValidator.cs index 1908789440..ada9af2ca4 100644 --- a/src/Modules/Grand.Module.Api/Validators/Catalog/SpecificationAttributeValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Catalog/SpecificationAttributeValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Catalog; using Grand.Business.Core.Interfaces.Catalog.Products; using Grand.Business.Core.Interfaces.Common.Localization; @@ -15,7 +16,7 @@ public SpecificationAttributeValidator( IContextAccessor contextAccessor, ISpecificationAttributeService specificationAttributeService) : base(validators) { - var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + var languageId = contextAccessor.WorkingLanguageId(); RuleFor(x => x.Name).NotEmpty() .WithMessage(translationService.GetResource("Api.Catalog.SpecificationAttribute.Fields.Name.Required", languageId)); diff --git a/src/Modules/Grand.Module.Api/Validators/Common/PictureValidator.cs b/src/Modules/Grand.Module.Api/Validators/Common/PictureValidator.cs index 34a8f8a80f..fd4b0c3003 100644 --- a/src/Modules/Grand.Module.Api/Validators/Common/PictureValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Common/PictureValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Common; using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Infrastructure; @@ -14,7 +15,7 @@ public PictureValidator( IContextAccessor contextAccessor) : base(validators) { - var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + var languageId = contextAccessor.WorkingLanguageId(); RuleFor(x => x.MimeType).NotEmpty() .WithMessage(translationService.GetResource("Api.Common.Picture.Fields.MimeType.Required", languageId)); diff --git a/src/Modules/Grand.Module.Api/Validators/Customers/AddressValidator.cs b/src/Modules/Grand.Module.Api/Validators/Customers/AddressValidator.cs index 9f556a1b96..f87828f84b 100644 --- a/src/Modules/Grand.Module.Api/Validators/Customers/AddressValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Customers/AddressValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Customers; using Grand.Business.Core.Interfaces.Common.Directory; using Grand.Business.Core.Interfaces.Common.Localization; @@ -16,7 +17,7 @@ public AddressValidator( IContextAccessor contextAccessor, ICountryService countryService, AddressSettings addressSettings) : base(validators) { - var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + var languageId = contextAccessor.WorkingLanguageId(); RuleFor(x => x.FirstName) .NotEmpty() diff --git a/src/Modules/Grand.Module.Api/Validators/Customers/CustomerGroupValidator.cs b/src/Modules/Grand.Module.Api/Validators/Customers/CustomerGroupValidator.cs index 99fde50756..9e30135684 100644 --- a/src/Modules/Grand.Module.Api/Validators/Customers/CustomerGroupValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Customers/CustomerGroupValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Customers; using Grand.Business.Core.Interfaces.Common.Directory; using Grand.Business.Core.Interfaces.Common.Localization; @@ -15,7 +16,7 @@ public CustomerGroupValidator( IContextAccessor contextAccessor, IGroupService groupService) : base(validators) { - var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + var languageId = contextAccessor.WorkingLanguageId(); RuleFor(x => x.Name).NotEmpty() .WithMessage(translationService.GetResource("Api.Customers.CustomerGroup.Fields.Name.Required", languageId)); diff --git a/src/Modules/Grand.Module.Api/Validators/Customers/CustomerValidator.cs b/src/Modules/Grand.Module.Api/Validators/Customers/CustomerValidator.cs index ac98172b19..b5455af7bd 100644 --- a/src/Modules/Grand.Module.Api/Validators/Customers/CustomerValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Customers/CustomerValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Customers; using Grand.Business.Core.Interfaces.Common.Directory; using Grand.Business.Core.Interfaces.Common.Localization; @@ -19,7 +20,7 @@ public CustomerValidator( ICustomerService customerService, IStoreService storeService, CustomerSettings customerSettings) : base(validators) { - var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + var languageId = contextAccessor.WorkingLanguageId(); RuleFor(x => x).MustAsync(async (x, _) => { diff --git a/src/Modules/Grand.Module.Api/Validators/Customers/PasswordValidator.cs b/src/Modules/Grand.Module.Api/Validators/Customers/PasswordValidator.cs index 48da49538d..f7044a7244 100644 --- a/src/Modules/Grand.Module.Api/Validators/Customers/PasswordValidator.cs +++ b/src/Modules/Grand.Module.Api/Validators/Customers/PasswordValidator.cs @@ -1,4 +1,5 @@ using FluentValidation; +using Grand.Module.Api.Extensions; using Grand.Module.Api.DTOs.Customers; using Grand.Business.Core.Interfaces.Common.Localization; using Grand.Domain.Customers; @@ -16,7 +17,7 @@ public PasswordValidator( CustomerSettings customerSettings) : base(validators) { - var languageId = contextAccessor.WorkContext.WorkingLanguage.Id; + var languageId = contextAccessor.WorkingLanguageId(); RuleFor(x => x.Password).NotEmpty() .WithMessage(translationService.GetResource("Account.Fields.Password.Required", languageId)); diff --git a/src/Tests/Grand.Web.Common.Tests/Localization/RequestTranslationServiceTests.cs b/src/Tests/Grand.Web.Common.Tests/Localization/RequestTranslationServiceTests.cs index 86453f2ef7..2398c4cb84 100644 --- a/src/Tests/Grand.Web.Common.Tests/Localization/RequestTranslationServiceTests.cs +++ b/src/Tests/Grand.Web.Common.Tests/Localization/RequestTranslationServiceTests.cs @@ -1,6 +1,7 @@ -using Grand.Business.Core.Interfaces.Common.Localization; +using Grand.Data; using Grand.Domain.Localization; using Grand.Infrastructure; +using Grand.Mediator; using Grand.Web.Common.Localization; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; @@ -11,22 +12,23 @@ namespace Grand.Web.Common.Tests.Localization; public class RequestTranslationServiceTests { private Mock _contextAccessorMock; + private Mock _serviceMock; private RequestTranslationService _service; - private Mock _translationServiceMock; [TestInitialize] public void Init() { - _translationServiceMock = new Mock(); _contextAccessorMock = new Mock(); - _service = new RequestTranslationService(_translationServiceMock.Object, _contextAccessorMock.Object); + _serviceMock = new Mock(Mock.Of>(), + Mock.Of(), _contextAccessorMock.Object) { CallBase = true }; + _service = _serviceMock.Object; } [TestMethod] public void GetResource_UsesWorkingLanguageOfTheRequest() { _contextAccessorMock.Setup(c => c.WorkContext.WorkingLanguage).Returns(new Language { Id = "pl" }); - _translationServiceMock.Setup(x => x.GetResource("name", "pl", "", false)).Returns("nazwa"); + _serviceMock.Setup(x => x.GetResource("name", "pl", "", false)).Returns("nazwa"); var result = _service.GetResource("name"); @@ -41,15 +43,25 @@ public void GetResource_WithoutWorkingLanguage_ReturnsEmpty() var result = _service.GetResource("name"); Assert.AreEqual("", result); - _translationServiceMock.Verify( + _serviceMock.Verify( x => x.GetResource(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); } + [TestMethod] + public void GetResource_WithoutWorkContext_ReturnsEmpty() + { + _contextAccessorMock.Setup(c => c.WorkContext).Returns((IWorkContext)null); + + var result = _service.GetResource("name"); + + Assert.AreEqual("", result); + } + [TestMethod] public void GetResource_WithLanguage_DoesNotReadTheRequest() { - _translationServiceMock.Setup(x => x.GetResource("name", "en", "default", true)).Returns("value"); + _serviceMock.Setup(x => x.GetResource("name", "en", "default", true)).Returns("value"); var result = _service.GetResource("name", "en", "default", true); diff --git a/src/Web/Grand.Web.Common/Localization/IRequestTranslationService.cs b/src/Web/Grand.Web.Common/Localization/IRequestTranslationService.cs index 589d1a621e..1b02bf5233 100644 --- a/src/Web/Grand.Web.Common/Localization/IRequestTranslationService.cs +++ b/src/Web/Grand.Web.Common/Localization/IRequestTranslationService.cs @@ -1,6 +1,4 @@ using Grand.Business.Core.Interfaces.Common.Localization; -using Grand.Domain.Localization; -using Grand.Infrastructure; namespace Grand.Web.Common.Localization; @@ -16,64 +14,3 @@ public interface IRequestTranslationService : ITranslationService /// A string representing the requested resource string. string GetResource(string name); } - -public class RequestTranslationService(ITranslationService translationService, IContextAccessor contextAccessor) - : IRequestTranslationService -{ - public string GetResource(string name) - { - var language = contextAccessor.WorkContext.WorkingLanguage; - return language != null ? translationService.GetResource(name, language.Id) : ""; - } - - public string GetResource(string resourceKey, string languageId, string defaultValue = "", - bool returnEmptyIfNotFound = false) - { - return translationService.GetResource(resourceKey, languageId, defaultValue, returnEmptyIfNotFound); - } - - public Task GetTranslateResourceById(string translateResourceId) - { - return translationService.GetTranslateResourceById(translateResourceId); - } - - public Task GetTranslateResourceByName(string name, string languageId) - { - return translationService.GetTranslateResourceByName(name, languageId); - } - - public IList GetAllResources(string languageId) - { - return translationService.GetAllResources(languageId); - } - - public Task InsertTranslateResource(TranslationResource translateResource) - { - return translationService.InsertTranslateResource(translateResource); - } - - public Task UpdateTranslateResource(TranslationResource translateResource) - { - return translationService.UpdateTranslateResource(translateResource); - } - - public Task DeleteTranslateResource(TranslationResource translateResource) - { - return translationService.DeleteTranslateResource(translateResource); - } - - public Task ExportResourcesToXml(Language language) - { - return translationService.ExportResourcesToXml(language); - } - - public Task ImportResourcesFromXml(Language language, string xml) - { - return translationService.ImportResourcesFromXml(language, xml); - } - - public Task ImportResourcesFromXmlInstall(Language language, string xml) - { - return translationService.ImportResourcesFromXmlInstall(language, xml); - } -} diff --git a/src/Web/Grand.Web.Common/Localization/RequestTranslationService.cs b/src/Web/Grand.Web.Common/Localization/RequestTranslationService.cs new file mode 100644 index 0000000000..5a8a32bf10 --- /dev/null +++ b/src/Web/Grand.Web.Common/Localization/RequestTranslationService.cs @@ -0,0 +1,20 @@ +using Grand.Business.Common.Services.Localization; +using Grand.Data; +using Grand.Domain.Localization; +using Grand.Infrastructure; +using Grand.Mediator; + +namespace Grand.Web.Common.Localization; + +public class RequestTranslationService( + IRepository trRepository, + IMediator mediator, + IContextAccessor contextAccessor) + : TranslationService(trRepository, mediator), IRequestTranslationService +{ + public string GetResource(string name) + { + var language = contextAccessor.WorkContext?.WorkingLanguage; + return language != null ? GetResource(name, language.Id) : ""; + } +}