diff --git a/.gitignore b/.gitignore index 76bb7a7d5..9f35f6d82 100644 --- a/.gitignore +++ b/.gitignore @@ -344,4 +344,5 @@ healthchecksdb # BlobStorage BlobStorage/ -BlobStorageTestFolder/ \ No newline at end of file +BlobStorageTestFolder/ +/Streetcode/StreetCode.Client diff --git a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/Create/CreateCoordinateHandler.cs b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/Create/CreateCoordinateHandler.cs index 835f3940c..f2092281c 100644 --- a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/Create/CreateCoordinateHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/Create/CreateCoordinateHandler.cs @@ -1,6 +1,8 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.AdditionalContent.Coordinate.Create; @@ -9,11 +11,19 @@ public class CreateCoordinateHandler : IRequestHandler _stringLocalizer; + private readonly IStringLocalizer _stringLocalizerFaild; - public CreateCoordinateHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper) + public CreateCoordinateHandler( + IRepositoryWrapper repositoryWrapper, + IMapper mapper, + IStringLocalizer stringLocalizer, + IStringLocalizer stringLocalizerFaild) { + _stringLocalizer = stringLocalizer; _repositoryWrapper = repositoryWrapper; _mapper = mapper; + _stringLocalizerFaild = stringLocalizerFaild; } public async Task> Handle(CreateCoordinateCommand request, CancellationToken cancellationToken) @@ -22,12 +32,12 @@ public async Task> Handle(CreateCoordinateCommand request, Cancella if (streetcodeCoordinate is null) { - return Result.Fail(new Error("Cannot convert null to streetcodeCoordinate")); + return Result.Fail(new Error(_stringLocalizer?["CannotConvertNullToStreetcodeCoordinate"].Value)); } _repositoryWrapper.StreetcodeCoordinateRepository.Create(streetcodeCoordinate); var resultIsSuccess = await _repositoryWrapper.SaveChangesAsync() > 0; - return resultIsSuccess ? Result.Ok(Unit.Value) : Result.Fail(new Error("Failed to create a streetcodeCoordinate")); + return resultIsSuccess ? Result.Ok(Unit.Value) : Result.Fail(new Error(_stringLocalizerFaild?["FailedToCreateStreetcodeCoordinate"].Value)); } } \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/Delete/DeleteCoordinateHandler.cs b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/Delete/DeleteCoordinateHandler.cs index 98d9f3e25..d0baca984 100644 --- a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/Delete/DeleteCoordinateHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/Delete/DeleteCoordinateHandler.cs @@ -1,5 +1,8 @@ -using FluentResults; +using System.Xml.Linq; +using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.AdditionalContent.Coordinate.Delete; @@ -7,10 +10,17 @@ namespace Streetcode.BLL.MediatR.AdditionalContent.Coordinate.Delete; public class DeleteCoordinateHandler : IRequestHandler> { private readonly IRepositoryWrapper _repositoryWrapper; + private readonly IStringLocalizer _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerFailedToDelete; - public DeleteCoordinateHandler(IRepositoryWrapper repositoryWrapper) + public DeleteCoordinateHandler( + IRepositoryWrapper repositoryWrapper, + IStringLocalizer stringLocalizerCannotFind, + IStringLocalizer stringLocalizerFailedToDelete) { _repositoryWrapper = repositoryWrapper; + _stringLocalizerCannotFind = stringLocalizerCannotFind; + _stringLocalizerFailedToDelete = stringLocalizerFailedToDelete; } public async Task> Handle(DeleteCoordinateCommand request, CancellationToken cancellationToken) @@ -19,12 +29,12 @@ public async Task> Handle(DeleteCoordinateCommand request, Cancella if (streetcodeCoordinate is null) { - return Result.Fail(new Error($"Cannot find a coordinate with corresponding categoryId: {request.Id}")); + return Result.Fail(new Error(_stringLocalizerCannotFind["CannotFindCoordinateWithCorrespondingCategoryId", request.Id].Value)); } _repositoryWrapper.StreetcodeCoordinateRepository.Delete(streetcodeCoordinate); var resultIsSuccess = await _repositoryWrapper.SaveChangesAsync() > 0; - return resultIsSuccess ? Result.Ok(Unit.Value) : Result.Fail(new Error("Failed to delete a coordinate")); + return resultIsSuccess ? Result.Ok(Unit.Value) : Result.Fail(new Error(_stringLocalizerFailedToDelete["FailedToDeleteStreetcodeCoordinate"].Value)); } } \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/GetByStreetcodeId/GetCoordinatesByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/GetByStreetcodeId/GetCoordinatesByStreetcodeIdHandler.cs index 51077c78c..b69f9d156 100644 --- a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/GetByStreetcodeId/GetCoordinatesByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/GetByStreetcodeId/GetCoordinatesByStreetcodeIdHandler.cs @@ -1,7 +1,9 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.AdditionalContent.Coordinates.Types; +using Streetcode.BLL.SharedResource; using Streetcode.BLL.Interfaces.Logging; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -12,12 +14,14 @@ public class GetCoordinatesByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetCoordinatesByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) - { + public GetCoordinatesByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) + { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetCoordinatesByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -25,7 +29,7 @@ public async Task>> Handle(GetCoordi if ((await _repositoryWrapper.StreetcodeRepository.GetFirstOrDefaultAsync(s => s.Id == request.StreetcodeId)) is null) { return Result.Fail( - new Error($"Cannot find a coordinates by a streetcode id: {request.StreetcodeId}, because such streetcode doesn`t exist")); + new Error(_stringLocalizerCannotFind["CannotFindCoordinatesByStreetcodeId", request.StreetcodeId].Value)); } var coordinates = await _repositoryWrapper.StreetcodeCoordinateRepository @@ -33,7 +37,7 @@ public async Task>> Handle(GetCoordi if (coordinates is null) { - string errorMsg = $"Cannot find a coordinates by a streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindCoordinatesByStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/Update/UpdateCoordinateHanler.cs b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/Update/UpdateCoordinateHanler.cs index 07e01d941..4c6da94b0 100644 --- a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/Update/UpdateCoordinateHanler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Coordinate/Update/UpdateCoordinateHanler.cs @@ -1,6 +1,8 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.AdditionalContent.Coordinate.Update; @@ -9,11 +11,19 @@ public class UpdateCoordinateHandler : IRequestHandler _stringLocalizerCannotConvert; + private readonly IStringLocalizer _stringLocalizerFailedToCreate; - public UpdateCoordinateHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper) + public UpdateCoordinateHandler( + IRepositoryWrapper repositoryWrapper, + IMapper mapper, + IStringLocalizer stringLocalizerCannotConvert, + IStringLocalizer stringLocalizerFailedToCreate) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; + _stringLocalizerCannotConvert = stringLocalizerCannotConvert; + _stringLocalizerFailedToCreate = stringLocalizerFailedToCreate; } public async Task> Handle(UpdateCoordinateCommand request, CancellationToken cancellationToken) @@ -22,12 +32,12 @@ public async Task> Handle(UpdateCoordinateCommand request, Cancella if (streetcodeCoordinate is null) { - return Result.Fail(new Error("Cannot convert null to streetcodeCoordinate")); + return Result.Fail(new Error(_stringLocalizerCannotConvert?["CannotConvertNullToStreetcodeCoordinate"].Value)); } _repositoryWrapper.StreetcodeCoordinateRepository.Update(streetcodeCoordinate); var resultIsSuccess = await _repositoryWrapper.SaveChangesAsync() > 0; - return resultIsSuccess ? Result.Ok(Unit.Value) : Result.Fail(new Error("Failed to update a streetcodeCoordinate")); + return resultIsSuccess ? Result.Ok(Unit.Value) : Result.Fail(new Error(_stringLocalizerFailedToCreate?["FailedToCreateStreetcodeCoordinate"].Value)); } } \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Subtitle/GetAll/GetAllSubtitlesHandler.cs b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Subtitle/GetAll/GetAllSubtitlesHandler.cs index da8df58d9..ed84dcd3f 100644 --- a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Subtitle/GetAll/GetAllSubtitlesHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Subtitle/GetAll/GetAllSubtitlesHandler.cs @@ -1,8 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.AdditionalContent.Subtitle.GetAll; @@ -12,12 +14,14 @@ public class GetAllSubtitlesHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllSubtitlesHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllSubtitlesHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetAllSubtitlesQuery request, CancellationToken cancellationToken) @@ -26,7 +30,7 @@ public async Task>> Handle(GetAllSubtitlesQuery if (subtitles is null) { - const string errorMsg = $"Cannot find any subtitles"; + string errorMsg = _stringLocalizerCannotFind?["CannotFindAnySubtitles"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); diff --git a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Subtitle/GetById/GetSubtitleByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Subtitle/GetById/GetSubtitleByIdHandler.cs index cd6ce61d5..7ac406b46 100644 --- a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Subtitle/GetById/GetSubtitleByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Subtitle/GetById/GetSubtitleByIdHandler.cs @@ -1,9 +1,11 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.AdditionalContent.GetById; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.AdditionalContent.Subtitle.GetById; @@ -13,12 +15,14 @@ public class GetSubtitleByIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetSubtitleByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetSubtitleByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetSubtitleByIdQuery request, CancellationToken cancellationToken) @@ -27,7 +31,7 @@ public async Task> Handle(GetSubtitleByIdQuery request, Canc if (subtitle is null) { - string errorMsg = $"Cannot find a subtitle with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindSubtitleWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Subtitle/GetByStreetcodeId/GetSubtitlesByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Subtitle/GetByStreetcodeId/GetSubtitlesByStreetcodeIdHandler.cs index 92a115129..295448ddf 100644 --- a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Subtitle/GetByStreetcodeId/GetSubtitlesByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Subtitle/GetByStreetcodeId/GetSubtitlesByStreetcodeIdHandler.cs @@ -1,6 +1,7 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.ResultVariations; diff --git a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetAll/GetAllTagsHandler.cs b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetAll/GetAllTagsHandler.cs index c331f5d0c..79757e25a 100644 --- a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetAll/GetAllTagsHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetAll/GetAllTagsHandler.cs @@ -1,9 +1,11 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.AdditionalContent; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; using Streetcode.BLL.DTO.AdditionalContent.Tag; +using Streetcode.BLL.SharedResource; using Streetcode.BLL.Interfaces.Logging; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -14,12 +16,14 @@ public class GetAllTagsHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllTagsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllTagsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer CannotFindSharedResource) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = CannotFindSharedResource; } public async Task>> Handle(GetAllTagsQuery request, CancellationToken cancellationToken) @@ -28,7 +32,7 @@ public async Task>> Handle(GetAllTagsQuery request, C if (tags is null) { - const string errorMsg = $"Cannot find any tags"; + string errorMsg = _stringLocalizerCannotFind?["CannotFindAnyTags"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetById/GetTagByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetById/GetTagByIdHandler.cs index bc19bc0b9..2a7d9f977 100644 --- a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetById/GetTagByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetById/GetTagByIdHandler.cs @@ -1,7 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.AdditionalContent; +using Streetcode.BLL.MediatR.AdditionalContent.Tag.GetAll; +using Streetcode.BLL.SharedResource; using Streetcode.BLL.Interfaces.Logging; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -12,12 +15,14 @@ public class GetTagByIdHandler : IRequestHandler private readonly IMapper _mapper; private readonly IRepositoryWrapper _repositoryWrapper; private readonly ILoggerService _logger; + private readonly IStringLocalizer _stringLocalizerCannotFind; - public GetTagByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetTagByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetTagByIdQuery request, CancellationToken cancellationToken) @@ -26,7 +31,7 @@ public async Task> Handle(GetTagByIdQuery request, CancellationTo if (tag is null) { - string errorMsg = $"Cannot find a Tag with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind?["CannotFindTagWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetByStreetcodeId/GetTagByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetByStreetcodeId/GetTagByStreetcodeIdHandler.cs index fa24f3bf0..997582e1f 100644 --- a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetByStreetcodeId/GetTagByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetByStreetcodeId/GetTagByStreetcodeIdHandler.cs @@ -3,9 +3,11 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.AdditionalContent.Tag; using Streetcode.BLL.Interfaces.Logging; using Streetcode.DAL.Entities.Streetcode; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.AdditionalContent.Tag.GetByStreetcodeId; @@ -15,23 +17,18 @@ public class GetTagByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetTagByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetTagByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetTagByStreetcodeIdQuery request, CancellationToken cancellationToken) { - /* - StreetcodeContent streetcode = await _repositoryWrapper.StreetcodeRepository.GetFirstOrDefaultAsync(s => s.Id == request.StreetcodeId); - if(streetcode is null) - { - return Result.Fail(new Error($"Streetcode with id: {request.StreetcodeId} doesn`t exist")); - } - */ var tagIndexed = await _repositoryWrapper.StreetcodeTagIndexRepository .GetAllAsync( t => t.StreetcodeId == request.StreetcodeId, @@ -39,7 +36,7 @@ public async Task>> Handle(GetTagByStreetco if (tagIndexed is null) { - string errorMsg = $"Cannot find any tag by the streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind?["CannotFindAnyTagByTheStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetTagByTitle/GetTagByTitleHandler.cs b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetTagByTitle/GetTagByTitleHandler.cs index aef9777ab..3ae45f9c7 100644 --- a/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetTagByTitle/GetTagByTitleHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/AdditionalContent/Tag/GetTagByTitle/GetTagByTitleHandler.cs @@ -1,9 +1,11 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.AdditionalContent; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.AdditionalContent.Tag.GetByStreetcodeId; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.AdditionalContent.Tag.GetTagByTitle; @@ -13,12 +15,18 @@ public class GetTagByTitleHandler : IRequestHandler _stringLocalizerCannotFind; - public GetTagByTitleHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetTagByTitleHandler( + IRepositoryWrapper repositoryWrapper, + IMapper mapper, + ILoggerService logger, + IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetTagByTitleQuery request, CancellationToken cancellationToken) @@ -27,7 +35,7 @@ public async Task> Handle(GetTagByTitleQuery request, Cancellatio if (tag is null) { - string errorMsg = $"Cannot find any tag by the title: {request.Title}"; + string errorMsg = _stringLocalizerCannotFind?["CannotFindAnyTagByTheTitle", request.Title].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/Create/CreateStatisticRecordHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/Create/CreateStatisticRecordHandler.cs index 78585b8a8..05e1efe07 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/Create/CreateStatisticRecordHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/Create/CreateStatisticRecordHandler.cs @@ -1,8 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Analytics; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; using Entity = Streetcode.DAL.Entities.Analytics.StatisticRecord; @@ -14,12 +16,21 @@ public class CreateStatisticRecordHandler : IRequestHandler? _stringLocalizerNo; + private readonly IStringLocalizer _stringLocalizer; - public CreateStatisticRecordHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public CreateStatisticRecordHandler( + IMapper mapper, + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizer, + IStringLocalizer stringLocalizerNo) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizer = stringLocalizer; + _stringLocalizerNo = stringLocalizerNo; } public async Task> Handle(CreateStatisticRecordCommand request, CancellationToken cancellationToken) @@ -28,7 +39,7 @@ public async Task> Handle(CreateStatisticRecordComman if (statRecord == null) { - const string errorMsg = "Mapped record is null"; + string errorMsg = _stringLocalizerNo?["NoMappedRecord"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -37,7 +48,7 @@ public async Task> Handle(CreateStatisticRecordComman if (createdRecord == null) { - const string errorMsg = "Created record is null"; + string errorMsg = _stringLocalizer?["NoCreatedRecord"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -46,7 +57,7 @@ public async Task> Handle(CreateStatisticRecordComman if (!resultIsSuccess) { - const string errorMsg = "Cannot save created record"; + string? errorMsg = _stringLocalizer?["CannotSaveCreatedRecord"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -55,7 +66,7 @@ public async Task> Handle(CreateStatisticRecordComman if (mappedCreatedRecord == null) { - const string errorMsg = "Mapped created record is null"; + string? errorMsg = _stringLocalizer?["NoMappedCreatedRecord"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/Delete/DeleteStatisticRecordHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/Delete/DeleteStatisticRecordHandler.cs index 72c15cd4c..4fbe80e55 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/Delete/DeleteStatisticRecordHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/Delete/DeleteStatisticRecordHandler.cs @@ -1,7 +1,9 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; using Entity = Streetcode.DAL.Entities.Analytics.StatisticRecord; @@ -12,12 +14,21 @@ public class DeleteStatisticRecordHandler : IRequestHandler _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerFailedToDelete; - public DeleteStatisticRecordHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public DeleteStatisticRecordHandler( + IMapper mapper, + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizerCannotFind, + IStringLocalizer stringLocalizerFailedToDelete) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; + _stringLocalizerFailedToDelete = stringLocalizerFailedToDelete; } public async Task> Handle(DeleteStatisticRecordCommand request, CancellationToken cancellationToken) @@ -27,7 +38,7 @@ public async Task> Handle(DeleteStatisticRecordCommand request, Can if (statRecord is null) { - const string errorMsg = "Cannot find record for qrId"; + string errorMsg = _stringLocalizerCannotFind["CannotFindRecordWithQrId"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -36,13 +47,13 @@ public async Task> Handle(DeleteStatisticRecordCommand request, Can var resultIsSuccess = _repositoryWrapper.SaveChanges() > 0; - if(resultIsSuccess) + if (resultIsSuccess) { return Result.Ok(Unit.Value); } else { - const string errorMsg = "Cannot delete the record"; + string errorMsg = _stringLocalizerFailedToDelete["FailedToDeleteTheRecord"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/GetAll/GetAllStatisticRecordsHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/GetAll/GetAllStatisticRecordsHandler.cs index 044606cc7..8f1b460ef 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/GetAll/GetAllStatisticRecordsHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/GetAll/GetAllStatisticRecordsHandler.cs @@ -3,8 +3,10 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Analytics; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Analytics.StatisticRecord.GetAll @@ -14,12 +16,21 @@ public class GetAllStatisticRecordsHandler : IRequestHandler _stringLocalizerCannotGet; + private readonly IStringLocalizer _stringLocalizerCannotMap; - public GetAllStatisticRecordsHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public GetAllStatisticRecordsHandler( + IMapper mapper, + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizerCannotGet, + IStringLocalizer stringLocalizerCannotMap) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerCannotGet = stringLocalizerCannotGet; + _stringLocalizerCannotMap = stringLocalizerCannotMap; } public async Task>> Handle(GetAllStatisticRecordsQuery request, CancellationToken cancellationToken) @@ -29,7 +40,7 @@ public async Task>> Handle(GetAllStatisti if(statisticRecords == null) { - const string errorMsg = "Cannot get records"; + string errorMsg = _stringLocalizerCannotGet["CannotGetRecords"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -38,7 +49,7 @@ public async Task>> Handle(GetAllStatisti if(mappedEntities == null) { - const string errorMsg = "Cannot map records"; + string errorMsg = _stringLocalizerCannotMap["CannotMapRecords"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/GetByQrId/GetStatisticRecordByQrIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/GetByQrId/GetStatisticRecordByQrIdHandler.cs index 8d2f8afea..d4d4bb15a 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/GetByQrId/GetStatisticRecordByQrIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/GetByQrId/GetStatisticRecordByQrIdHandler.cs @@ -2,7 +2,9 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Analytics; +using Streetcode.BLL.SharedResource; using Streetcode.BLL.Interfaces.Logging; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -13,12 +15,21 @@ public class GetStatisticRecordByQrIdHandler : IRequestHandler _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerCannotMap; - public GetStatisticRecordByQrIdHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public GetStatisticRecordByQrIdHandler( + IMapper mapper, + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizerCannotMap, + IStringLocalizer stringLocalizerCannotFind) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerCannotMap = stringLocalizerCannotMap; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetStatisticRecordByQrIdQuery request, CancellationToken cancellationToken) @@ -30,7 +41,7 @@ public async Task> Handle(GetStatisticRecordByQrIdQue if (statRecord == null) { - const string errorMsg = "Cannot find record with qrId"; + string errorMsg = _stringLocalizerCannotFind["CannotFindRecordWithQrId"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -39,7 +50,7 @@ public async Task> Handle(GetStatisticRecordByQrIdQue if(statRecordDTO == null) { - const string errorMsg = $"Cannot map record"; + string errorMsg = _stringLocalizerCannotMap["CannotMapRecord"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/UpdateCount/UpdateCountStatisticRecordHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/UpdateCount/UpdateCountStatisticRecordHandler.cs index 990898bff..3e2e7cbe4 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/UpdateCount/UpdateCountStatisticRecordHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Analytics/StatisticRecord/UpdateCount/UpdateCountStatisticRecordHandler.cs @@ -2,6 +2,8 @@ using FluentResults; using MediatR; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Analytics.StatisticRecord.UpdateCount @@ -11,12 +13,21 @@ public class UpdateCountStatisticRecordHandler : IRequestHandler _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerCannotSave; + + public UpdateCountStatisticRecordHandler( + IMapper mapper, + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizerCannotSave, + IStringLocalizer stringLocalizerCannotFind) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerCannotSave = stringLocalizerCannotSave; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(UpdateCountStatisticRecordCommand request, CancellationToken cancellationToken) @@ -26,7 +37,7 @@ public async Task> Handle(UpdateCountStatisticRecordCommand request if (statRecord == null) { - const string errorMsg = "Cannot find record by qrId"; + string errorMsg = _stringLocalizerCannotFind["CannotFindRecordWithQrId"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -39,7 +50,7 @@ public async Task> Handle(UpdateCountStatisticRecordCommand request if (!resultIsSuccess) { - const string errorMsg = "Cannot save the data"; + string errorMsg = _stringLocalizerCannotSave["CannotSaveTheData"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Email/SendEmailHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Email/SendEmailHandler.cs index c86a570a1..c697e3334 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Email/SendEmailHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Email/SendEmailHandler.cs @@ -1,5 +1,6 @@ using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.Interfaces.Email; using Streetcode.BLL.Interfaces.Logging; using Streetcode.DAL.Entities.AdditionalContent.Email; @@ -10,11 +11,13 @@ public class SendEmailHandler : IRequestHandler> { private readonly IEmailService _emailService; private readonly ILoggerService _logger; + private readonly IStringLocalizer _stringLocalizer; - public SendEmailHandler(IEmailService emailService, ILoggerService logger) + public SendEmailHandler(IEmailService emailService, ILoggerService logger, IStringLocalizer stringLocalizer) { _emailService = emailService; _logger = logger; + _stringLocalizer = stringLocalizer; } public async Task> Handle(SendEmailCommand request, CancellationToken cancellationToken) @@ -28,7 +31,7 @@ public async Task> Handle(SendEmailCommand request, CancellationTok } else { - const string errorMsg = $"Failed to send email message"; + string errorMsg = _stringLocalizer["FailedToSendEmailMessage"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Art/GetAll/GetAllArtsHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Art/GetAll/GetAllArtsHandler.cs index c798a8bc1..821edb8d8 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Art/GetAll/GetAllArtsHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Art/GetAll/GetAllArtsHandler.cs @@ -4,7 +4,9 @@ using Streetcode.BLL.DTO.AdditionalContent.Subtitles; using Streetcode.BLL.DTO.Media.Images; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Art; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Art.GetAll; @@ -14,12 +16,14 @@ public class GetAllArtsHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllArtsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllArtsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetAllArtsQuery request, CancellationToken cancellationToken) @@ -28,7 +32,7 @@ public async Task>> Handle(GetAllArtsQuery request, C if (arts is null) { - const string errorMsg = $"Cannot find any arts"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyArts"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Art/GetById/GetArtByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Art/GetById/GetArtByIdHandler.cs index fbc36b4b8..519ea0656 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Art/GetById/GetArtByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Art/GetById/GetArtByIdHandler.cs @@ -4,7 +4,9 @@ using Streetcode.BLL.DTO.AdditionalContent.Subtitles; using Streetcode.BLL.DTO.Media.Images; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Art; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Art.GetById; @@ -14,12 +16,14 @@ public class GetArtByIdHandler : IRequestHandler private readonly IMapper _mapper; private readonly IRepositoryWrapper _repositoryWrapper; private readonly ILoggerService _logger; + private readonly IStringLocalizer _stringLocalizerCannotFind; - public GetArtByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetArtByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetArtByIdQuery request, CancellationToken cancellationToken) @@ -28,7 +32,7 @@ public async Task> Handle(GetArtByIdQuery request, CancellationTo if (art is null) { - string errorMsg = $"Cannot find an art with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyArtWithCorrespondingStreetcodeId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Art/GetByStreetcodeId/GetArtsByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Art/GetByStreetcodeId/GetArtsByStreetcodeIdHandler.cs index b9860f5dd..be242a541 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Art/GetByStreetcodeId/GetArtsByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Art/GetByStreetcodeId/GetArtsByStreetcodeIdHandler.cs @@ -6,6 +6,8 @@ using Microsoft.EntityFrameworkCore; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.DTO.Media.Art; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.BLL.MediatR.Media.Art.GetByStreetcodeId { @@ -15,17 +17,20 @@ public class GetArtsByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; public GetArtsByStreetcodeIdHandler( IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, - ILoggerService logger) + ILoggerService logger, + IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _blobService = blobService; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetArtsByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -45,7 +50,7 @@ public async Task>> Handle(GetArtsByStreetcodeIdQuery if (arts is null) { - string errorMsg = $"Cannot find any art with corresponding streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyArtWithCorrespondingStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Audio/Create/CreateAudioHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Audio/Create/CreateAudioHandler.cs index ef1c7d4c8..5414d45f5 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Audio/Create/CreateAudioHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Audio/Create/CreateAudioHandler.cs @@ -1,9 +1,11 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Audio; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Audio.Create; @@ -14,17 +16,20 @@ public class CreateAudioHandler : IRequestHandler _stringLocalizer; public CreateAudioHandler( IBlobService blobService, IRepositoryWrapper repositoryWrapper, + ILoggerService logger, IMapper mapper, - ILoggerService logger) + IStringLocalizer stringLocalizer) { _blobService = blobService; _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizer = stringLocalizer; } public async Task> Handle(CreateAudioCommand request, CancellationToken cancellationToken) @@ -50,7 +55,7 @@ public async Task> Handle(CreateAudioCommand request, Cancellat } else { - const string errorMsg = $"Failed to create an audio"; + string? errorMsg = _stringLocalizer?["FailedToCreateAudio"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Audio/Delete/DeleteAudioHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Audio/Delete/DeleteAudioHandler.cs index 32110f766..a967e6e68 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Audio/Delete/DeleteAudioHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Audio/Delete/DeleteAudioHandler.cs @@ -1,7 +1,9 @@ using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Audio.Delete; @@ -11,12 +13,21 @@ public class DeleteAudioHandler : IRequestHandler _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerFailedToDelete; - public DeleteAudioHandler(IRepositoryWrapper repositoryWrapper, IBlobService blobService, ILoggerService logger) + public DeleteAudioHandler( + IRepositoryWrapper repositoryWrapper, + IBlobService blobService, + ILoggerService logger, + IStringLocalizer stringLocalizerFailedToDelete, + IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _blobService = blobService; _logger = logger; + _stringLocalizerFailedToDelete = stringLocalizerFailedToDelete; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(DeleteAudioCommand request, CancellationToken cancellationToken) @@ -25,7 +36,7 @@ public async Task> Handle(DeleteAudioCommand request, CancellationT if (audio is null) { - string errorMsg = $"Cannot find an audio with corresponding categoryId: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnAudioWithCorrespondingCategoryId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -46,7 +57,7 @@ public async Task> Handle(DeleteAudioCommand request, CancellationT } else { - string errorMsg = $"Failed to delete an audio"; + string errorMsg = _stringLocalizerFailedToDelete["FailedToDeleteAudio"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetAll/GetAllAudiosHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetAll/GetAllAudiosHandler.cs index 8b70c2e65..4fa5cbf45 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetAll/GetAllAudiosHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetAll/GetAllAudiosHandler.cs @@ -6,6 +6,8 @@ using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; using Streetcode.DAL.Repositories.Interfaces.Base; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.BLL.MediatR.Media.Audio.GetAll; @@ -15,13 +17,15 @@ public class GetAllAudiosHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllAudiosHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger) + public GetAllAudiosHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _blobService = blobService; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetAllAudiosQuery request, CancellationToken cancellationToken) @@ -30,7 +34,7 @@ public async Task>> Handle(GetAllAudiosQuery reques if (audios is null) { - const string errorMsg = "Cannot find any audios"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyAudios"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetBaseAudio/GetBaseAudioHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetBaseAudio/GetBaseAudioHandler.cs index 42166f22c..d0f967ee1 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetBaseAudio/GetBaseAudioHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetBaseAudio/GetBaseAudioHandler.cs @@ -1,7 +1,9 @@ using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Audio.GetBaseAudio; @@ -11,12 +13,14 @@ public class GetBaseAudioHandler : IRequestHandler _stringLocalizerCannotFind; - public GetBaseAudioHandler(IBlobService blobService, IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public GetBaseAudioHandler(IBlobService blobService, IRepositoryWrapper repositoryWrapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _blobStorage = blobService; _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetBaseAudioQuery request, CancellationToken cancellationToken) @@ -25,7 +29,7 @@ public async Task> Handle(GetBaseAudioQuery request, Cancel if (audio is null) { - string errorMsg = $"Cannot find an audio with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnAudioWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetById/GetAudioByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetById/GetAudioByIdHandler.cs index b4a92ddd6..60f31ee27 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetById/GetAudioByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetById/GetAudioByIdHandler.cs @@ -1,9 +1,11 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Audio; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Audio.GetById; @@ -14,13 +16,15 @@ public class GetAudioByIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAudioByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger) + public GetAudioByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _blobService = blobService; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetAudioByIdQuery request, CancellationToken cancellationToken) @@ -29,7 +33,7 @@ public async Task> Handle(GetAudioByIdQuery request, Cancellati if (audio is null) { - string errorMsg = $"Cannot find an audio with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnAudioWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetByStreetcodeId/GetAudioByStreetcodeIdQueryHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetByStreetcodeId/GetAudioByStreetcodeIdQueryHandler.cs index f1aa00422..74e81b17f 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetByStreetcodeId/GetAudioByStreetcodeIdQueryHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Audio/GetByStreetcodeId/GetAudioByStreetcodeIdQueryHandler.cs @@ -2,11 +2,13 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Audio; using Streetcode.BLL.DTO.Transactions; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.MediatR.ResultVariations; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Audio.GetByStreetcodeId; @@ -17,13 +19,15 @@ public class GetAudioByStreetcodeIdQueryHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAudioByStreetcodeIdQueryHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger) + public GetAudioByStreetcodeIdQueryHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _blobService = blobService; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetAudioByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -33,7 +37,7 @@ public async Task> Handle(GetAudioByStreetcodeIdQuery request, include: q => q.Include(s => s.Audio) !); if (streetcode == null) { - string errorMsg = $"Cannot find an audio with the corresponding streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnAudioWithTheCorrespondingStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Audio/Update/UpdateAudioHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Audio/Update/UpdateAudioHandler.cs index aeed222ff..593da045a 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Audio/Update/UpdateAudioHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Audio/Update/UpdateAudioHandler.cs @@ -1,9 +1,11 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Audio; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Audio.Update; @@ -14,13 +16,23 @@ public class UpdateAudioHandler : IRequestHandler _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerFailedToUpdate; - public UpdateAudioHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, IBlobService blobService, ILoggerService logger) + public UpdateAudioHandler( + IMapper mapper, + IRepositoryWrapper repositoryWrapper, + IBlobService blobService, + ILoggerService logger, + IStringLocalizer stringLocalizerFailedToUpdate, + IStringLocalizer stringLocalizerCannotFind) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _blobService = blobService; _logger = logger; + _stringLocalizerFailedToUpdate = stringLocalizerFailedToUpdate; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(UpdateAudioCommand request, CancellationToken cancellationToken) @@ -30,7 +42,7 @@ public async Task> Handle(UpdateAudioCommand request, Cancellat if (existingAudio is null) { - string errorMsg = $"Cannot find an audio with corresponding categoryId: {request.Audio.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnAudioWithTheCorrespondingStreetcodeId", request.Audio.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -57,7 +69,7 @@ public async Task> Handle(UpdateAudioCommand request, Cancellat } else { - const string errorMsg = "Failed to update an audio"; + string errorMsg = _stringLocalizerFailedToUpdate["FailedToUpdateAudio"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Image/Create/CreateImageHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Image/Create/CreateImageHandler.cs index 7d50a3f05..797bddf4f 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Image/Create/CreateImageHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Image/Create/CreateImageHandler.cs @@ -1,9 +1,11 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Images; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Image.Create; @@ -14,17 +16,20 @@ public class CreateImageHandler : IRequestHandler _stringLocalizer; public CreateImageHandler( IBlobService blobService, IRepositoryWrapper repositoryWrapper, + ILoggerService logger, IMapper mapper, - ILoggerService logger) + IStringLocalizer stringLocalizer) { _blobService = blobService; _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizer = stringLocalizer; } public async Task> Handle(CreateImageCommand request, CancellationToken cancellationToken) @@ -51,7 +56,7 @@ public async Task> Handle(CreateImageCommand request, Cancellat } else { - const string errorMsg = "Failed to create an image"; + string? errorMsg = _stringLocalizer?["FailedToCreateAnImage"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Image/Delete/DeleteImageHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Image/Delete/DeleteImageHandler.cs index be01bfa49..104b71797 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Image/Delete/DeleteImageHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Image/Delete/DeleteImageHandler.cs @@ -1,9 +1,11 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.Media.Audio.Delete; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Image.Delete; @@ -13,12 +15,21 @@ public class DeleteImageHandler : IRequestHandler _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerFailedToDelete; - public DeleteImageHandler(IRepositoryWrapper repositoryWrapper, IBlobService blobService, ILoggerService logger) + public DeleteImageHandler( + IRepositoryWrapper repositoryWrapper, + IBlobService blobService, + ILoggerService logger, + IStringLocalizer stringLocalizerFailedToDelete, + IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _blobService = blobService; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; + _stringLocalizerFailedToDelete = stringLocalizerFailedToDelete; } public async Task> Handle(DeleteImageCommand request, CancellationToken cancellationToken) @@ -30,7 +41,7 @@ public async Task> Handle(DeleteImageCommand request, CancellationT if (image is null) { - string errorMsg = $"Cannot find an image with corresponding categoryId: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyImage", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -50,7 +61,7 @@ public async Task> Handle(DeleteImageCommand request, CancellationT } else { - const string errorMsg = $"Failed to delete an image"; + string errorMsg = _stringLocalizerFailedToDelete["FailedToDeleteImage"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetAll/GetAllImagesHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetAll/GetAllImagesHandler.cs index d81adc219..d15d05d4e 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetAll/GetAllImagesHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetAll/GetAllImagesHandler.cs @@ -2,9 +2,11 @@ using FluentResults; using MediatR; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Images; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Image.GetAll; @@ -15,13 +17,15 @@ public class GetAllImagesHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllImagesHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger) + public GetAllImagesHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _blobService = blobService; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetAllImagesQuery request, CancellationToken cancellationToken) @@ -30,7 +34,7 @@ public async Task>> Handle(GetAllImagesQuery reques if (images is null) { - const string errorMsg = $"Cannot find any image"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyImage"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetBaseImage/GetBaseImageHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetBaseImage/GetBaseImageHandler.cs index 70b42ca4d..798a5db24 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetBaseImage/GetBaseImageHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetBaseImage/GetBaseImageHandler.cs @@ -1,6 +1,8 @@ using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.Interfaces.BlobStorage; +using Streetcode.BLL.SharedResource; using Streetcode.BLL.Interfaces.Logging; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -11,12 +13,14 @@ public class GetBaseImageHandler : IRequestHandler _stringLocalizerCannotFind; - public GetBaseImageHandler(IBlobService blobService, IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public GetBaseImageHandler(IBlobService blobService, IRepositoryWrapper repositoryWrapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _blobStorage = blobService; _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetBaseImageQuery request, CancellationToken cancellationToken) @@ -25,7 +29,7 @@ public async Task> Handle(GetBaseImageQuery request, Cancel if (image is null) { - string errorMsg = $"Cannot find an image with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnAudioWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetById/GetImageByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetById/GetImageByIdHandler.cs index e3e689bd2..dfd729733 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetById/GetImageByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetById/GetImageByIdHandler.cs @@ -2,9 +2,11 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Images; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Image.GetById; @@ -15,13 +17,14 @@ public class GetImageByIdHandler : IRequestHandler _stringLocalizerCannotFind; + public GetImageByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _blobService = blobService; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetImageByIdQuery request, CancellationToken cancellationToken) @@ -32,7 +35,7 @@ public async Task> Handle(GetImageByIdQuery request, Cancellati if (image is null) { - string errorMsg = $"Cannot find a image with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnImageWithCorrespondingCategoryId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetByStreetcodeId/GetImageByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetByStreetcodeId/GetImageByStreetcodeIdHandler.cs index 02bb4f6b2..338a57f2f 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetByStreetcodeId/GetImageByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Image/GetByStreetcodeId/GetImageByStreetcodeIdHandler.cs @@ -2,9 +2,11 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Images; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Image.GetByStreetcodeId; @@ -15,13 +17,15 @@ public class GetImageByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetImageByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger) + public GetImageByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _blobService = blobService; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetImageByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -33,7 +37,7 @@ public async Task>> Handle(GetImageByStreetcodeIdQu if (images is null || images.Count() == 0) { - string errorMsg = $"Cannot find an image with the corresponding streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnImageWithTheCorrespondingStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Image/Update/UpdateImageHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Image/Update/UpdateImageHandler.cs index 763b5c707..d6ba0432d 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Image/Update/UpdateImageHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Image/Update/UpdateImageHandler.cs @@ -1,9 +1,11 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Images; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Image.Update; @@ -14,13 +16,23 @@ public class UpdateImageHandler : IRequestHandler _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerFailedToUpdate; - public UpdateImageHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, IBlobService blobService, ILoggerService logger) + public UpdateImageHandler( + IMapper mapper, + IRepositoryWrapper repositoryWrapper, + IBlobService blobService, + ILoggerService logger, + IStringLocalizer stringLocalizerFailedToUpdate, + IStringLocalizer stringLocalizerCannotFind) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _blobService = blobService; _logger = logger; + _stringLocalizerFailedToUpdate = stringLocalizerFailedToUpdate; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(UpdateImageCommand request, CancellationToken cancellationToken) @@ -30,7 +42,7 @@ public async Task> Handle(UpdateImageCommand request, Cancellat if (existingImage is null) { - string errorMsg = $"Cannot find an image with corresponding categoryId: {request.Image.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnImageWithCorrespondingCategoryId", request.Image.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -59,7 +71,7 @@ public async Task> Handle(UpdateImageCommand request, Cancellat } else { - const string errorMsg = "Failed to update an image"; + string errorMsg = _stringLocalizerFailedToUpdate["FailedToUpdateImage"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/StreetcodeArt/GetByStreetcodeId/GetStreetcodeArtByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/StreetcodeArt/GetByStreetcodeId/GetStreetcodeArtByStreetcodeIdHandler.cs index cd0bf07ac..4097c3c51 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/StreetcodeArt/GetByStreetcodeId/GetStreetcodeArtByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/StreetcodeArt/GetByStreetcodeId/GetStreetcodeArtByStreetcodeIdHandler.cs @@ -3,9 +3,11 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Art; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.StreetcodeArt.GetByStreetcodeId @@ -16,17 +18,20 @@ public class GetStreetcodeArtByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; public GetStreetcodeArtByStreetcodeIdHandler( IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, - ILoggerService logger) + ILoggerService logger, + IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _blobService = blobService; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetStreetcodeArtByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -49,7 +54,7 @@ public async Task>> Handle(GetStreetcodeArt if (art is null) { - string errorMsg = $"Cannot find an art with corresponding streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyArtWithCorrespondingStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Video/GetAll/GetAllVideosHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Video/GetAll/GetAllVideosHandler.cs index d19d6d949..78c3fe361 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Video/GetAll/GetAllVideosHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Video/GetAll/GetAllVideosHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Video; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.AdditionalContent.Coordinates; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -14,12 +16,14 @@ public class GetAllVideosHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllVideosHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllVideosHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetAllVideosQuery request, CancellationToken cancellationToken) @@ -28,7 +32,7 @@ public async Task>> Handle(GetAllVideosQuery reques if (videos is null) { - const string errorMsg = "Cannot find any videos"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyVideos"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Video/GetById/GetVideoByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Video/GetById/GetVideoByIdHandler.cs index cd8d24315..8b619e20b 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Video/GetById/GetVideoByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Video/GetById/GetVideoByIdHandler.cs @@ -1,8 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Video; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Video.GetById; @@ -12,12 +14,14 @@ public class GetVideoByIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetVideoByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetVideoByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetVideoByIdQuery request, CancellationToken cancellationToken) @@ -26,7 +30,7 @@ public async Task> Handle(GetVideoByIdQuery request, Cancellati if (video is null) { - string errorMsg = $"Cannot find a video with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindVideoWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Media/Video/GetByStreetcodeId/GetVideoByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Media/Video/GetByStreetcodeId/GetVideoByStreetcodeIdHandler.cs index 2086cf509..a876ae31f 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Media/Video/GetByStreetcodeId/GetVideoByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Media/Video/GetByStreetcodeId/GetVideoByStreetcodeIdHandler.cs @@ -3,10 +3,12 @@ using MediatR; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; using Streetcode.BLL.DTO.Media.Audio; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Video; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.ResultVariations; using Streetcode.DAL.Entities.Streetcode; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Media.Video.GetByStreetcodeId; @@ -16,12 +18,14 @@ public class GetVideoByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetVideoByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetVideoByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetVideoByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -33,7 +37,7 @@ public async Task> Handle(GetVideoByStreetcodeIdQuery request, StreetcodeContent? streetcode = await _repositoryWrapper.StreetcodeRepository.GetFirstOrDefaultAsync(x => x.Id == request.StreetcodeId); if (streetcode is null) { - string errorMsg = $"Streetcode with id: {request.StreetcodeId} doesn`t exist"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyVideoByTheStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Newss/Create/CreateNewsHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Newss/Create/CreateNewsHandler.cs index 5e97e51da..af6d6821a 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Newss/Create/CreateNewsHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Newss/Create/CreateNewsHandler.cs @@ -1,8 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.News; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.News; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -13,11 +15,20 @@ public class CreateNewsHandler : IRequestHandler _stringLocalizerCannot; + private readonly IStringLocalizer _stringLocalizerFailed; + public CreateNewsHandler( + IMapper mapper, + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizerFailed, + IStringLocalizer stringLocalizerCannot) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerFailed = stringLocalizerFailed; + _stringLocalizerCannot = stringLocalizerCannot; } public async Task> Handle(CreateNewsCommand request, CancellationToken cancellationToken) @@ -25,7 +36,7 @@ public async Task> Handle(CreateNewsCommand request, Cancellatio var newNews = _mapper.Map(request.newNews); if (newNews is null) { - const string errorMsg = "Cannot convert null to news"; + string errorMsg = _stringLocalizerCannot["CannotConvertNullToNews"].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } @@ -43,7 +54,7 @@ public async Task> Handle(CreateNewsCommand request, Cancellatio } else { - const string errorMsg = "Failed to create a news"; + string errorMsg = _stringLocalizerFailed["FailedToCreateNews"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Newss/Delete/DeleteNewsHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Newss/Delete/DeleteNewsHandler.cs index a0e5a3f96..1d24a1efb 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Newss/Delete/DeleteNewsHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Newss/Delete/DeleteNewsHandler.cs @@ -2,6 +2,8 @@ using FluentResults; using MediatR; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.News; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -11,10 +13,14 @@ public class DeleteNewsHandler : IRequestHandler { private readonly IRepositoryWrapper _repositoryWrapper; private readonly ILoggerService _logger; - public DeleteNewsHandler(IRepositoryWrapper repositoryWrapper, ILoggerService logger) + private readonly IStringLocalizer _stringLocalizerFailedToDelete; + private readonly IStringLocalizer _stringLocalizerNo; + public DeleteNewsHandler(IRepositoryWrapper repositoryWrapper, ILoggerService logger, IStringLocalizer stringLocalizerNo, IStringLocalizer stringLocalizerFailedToDelete) { _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; + _stringLocalizerFailedToDelete = stringLocalizerFailedToDelete; } public async Task> Handle(DeleteNewsCommand request, CancellationToken cancellationToken) @@ -23,7 +29,7 @@ public async Task> Handle(DeleteNewsCommand request, CancellationTo var news = await _repositoryWrapper.NewsRepository.GetFirstOrDefaultAsync(n => n.Id == id); if (news == null) { - string errorMsg = $"No news found by entered Id - {id}"; + string errorMsg = _stringLocalizerNo["NoNewsFoundByEnteredId", id].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } @@ -41,7 +47,7 @@ public async Task> Handle(DeleteNewsCommand request, CancellationTo } else { - string errorMsg = "Failed to delete news"; + string errorMsg = _stringLocalizerFailedToDelete["FailedToDeleteNews"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Newss/GetAll/GetAllNewsHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Newss/GetAll/GetAllNewsHandler.cs index 6bda74272..cd3d7290d 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Newss/GetAll/GetAllNewsHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Newss/GetAll/GetAllNewsHandler.cs @@ -7,6 +7,8 @@ using Microsoft.EntityFrameworkCore; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.BLL.MediatR.Newss.GetAll { @@ -16,13 +18,15 @@ public class GetAllNewsHandler : IRequestHandler _stringLocalizerNo; - public GetAllNewsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger) + public GetAllNewsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger, IStringLocalizer stringLocalizerNo) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _blobService = blobService; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; } public async Task>> Handle(GetAllNewsQuery request, CancellationToken cancellationToken) @@ -31,7 +35,7 @@ public async Task>> Handle(GetAllNewsQuery request, include: cat => cat.Include(img => img.Image)); if (news == null) { - const string errorMsg = "There are no news in the database"; + string errorMsg = _stringLocalizerNo["NoNewsInTheDatabase"].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Newss/GetById/GetNewsByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Newss/GetById/GetNewsByIdHandler.cs index 6c0c327db..22182de3a 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Newss/GetById/GetNewsByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Newss/GetById/GetNewsByIdHandler.cs @@ -7,6 +7,8 @@ using Streetcode.DAL.Repositories.Interfaces.Base; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.BLL.MediatR.Newss.GetById { @@ -16,12 +18,14 @@ public class GetNewsByIdHandler : IRequestHandler _stringLocalizerNo; + public GetNewsByIdHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, IBlobService blobService, ILoggerService logger, IStringLocalizer stringLocalizerNo) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _blobService = blobService; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; } public async Task> Handle(GetNewsByIdQuery request, CancellationToken cancellationToken) @@ -33,7 +37,7 @@ public async Task> Handle(GetNewsByIdQuery request, Cancellation .Include(sc => sc.Image))); if(newsDTO is null) { - string errorMsg = $"No news by entered Id - {id}"; + string errorMsg = _stringLocalizerNo["NoNewsByEnteredId", id].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Newss/GetByUrl/GetNewsByUrlHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Newss/GetByUrl/GetNewsByUrlHandler.cs index 5f54d4ad1..019988170 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Newss/GetByUrl/GetNewsByUrlHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Newss/GetByUrl/GetNewsByUrlHandler.cs @@ -7,6 +7,8 @@ using Streetcode.DAL.Repositories.Interfaces.Base; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.BLL.MediatR.Newss.GetByUrl { @@ -16,12 +18,14 @@ public class GetNewsByUrlHandler : IRequestHandler _stringLocalizerNo; + public GetNewsByUrlHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, IBlobService blobService, ILoggerService logger, IStringLocalizer stringLocalizerNo) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _blobService = blobService; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; } public async Task> Handle(GetNewsByUrlQuery request, CancellationToken cancellationToken) @@ -33,7 +37,7 @@ public async Task> Handle(GetNewsByUrlQuery request, Cancellatio .Include(sc => sc.Image))); if(newsDTO is null) { - string errorMsg = $"No news by entered Url - {url}"; + string errorMsg = _stringLocalizerNo["NoNewsByEnteredUrl", url].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Newss/GetNewsAndLinksByUrl/GetNewsAndLinksByUrlHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Newss/GetNewsAndLinksByUrl/GetNewsAndLinksByUrlHandler.cs index 5f5df0641..f17e24372 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Newss/GetNewsAndLinksByUrl/GetNewsAndLinksByUrlHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Newss/GetNewsAndLinksByUrl/GetNewsAndLinksByUrlHandler.cs @@ -7,6 +7,8 @@ using Streetcode.DAL.Repositories.Interfaces.Base; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.BLL.MediatR.Newss.GetNewsAndLinksByUrl { @@ -16,12 +18,14 @@ public class GetNewsAndLinksByUrlHandler : IRequestHandler _stringLocalizerNo; + public GetNewsAndLinksByUrlHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, IBlobService blobService, ILoggerService logger, IStringLocalizer stringLocalizerNo) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _blobService = blobService; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; } public async Task> Handle(GetNewsAndLinksByUrlQuery request, CancellationToken cancellationToken) @@ -34,7 +38,7 @@ public async Task> Handle(GetNewsAndLinksByUrlQuery requ if (newsDTO is null) { - string errorMsg = $"No news by entered Url - {url}"; + string errorMsg = _stringLocalizerNo["NoNewsByEnteredUrl", url].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } @@ -89,7 +93,7 @@ public async Task> Handle(GetNewsAndLinksByUrlQuery requ if (newsDTOWithUrls is null) { - string errorMsg = $"No news by entered Url - {url}"; + string errorMsg = _stringLocalizerNo["NoNewsByEnteredUrl", url].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Newss/SortedByDateTime/SortedByDateTimeHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Newss/SortedByDateTime/SortedByDateTimeHandler.cs index a44f255ac..0d0df21bd 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Newss/SortedByDateTime/SortedByDateTimeHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Newss/SortedByDateTime/SortedByDateTimeHandler.cs @@ -7,6 +7,8 @@ using Streetcode.DAL.Repositories.Interfaces.Base; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.BLL.MediatR.Newss.SortedByDateTime { @@ -16,13 +18,15 @@ public class SortedByDateTimeHandler : IRequestHandler _stringLocalizerNo; - public SortedByDateTimeHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger) + public SortedByDateTimeHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger, IStringLocalizer stringLocalizerNo) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _blobService = blobService; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; } public async Task>> Handle(SortedByDateTimeQuery request, CancellationToken cancellationToken) @@ -31,7 +35,7 @@ public async Task>> Handle(SortedByDateTimeQuery request, C include: cat => cat.Include(img => img.Image)); if (news == null) { - const string errorMsg = "There are no news in the database"; + string errorMsg = _stringLocalizerNo["NoNewsInTheDatabase"].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Newss/Update/UpdateNewsHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Newss/Update/UpdateNewsHandler.cs index f13815985..d198f0b93 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Newss/Update/UpdateNewsHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Newss/Update/UpdateNewsHandler.cs @@ -1,9 +1,11 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.News; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.News; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -15,12 +17,22 @@ public class UpdateNewsHandler : IRequestHandler _stringLocalizerCannotConvertNull; + private readonly IStringLocalizer _stringLocalizerFailedToUpdate; + public UpdateNewsHandler( + IRepositoryWrapper repositoryWrapper, + IMapper mapper, + IBlobService blobService, + ILoggerService logger, + IStringLocalizer stringLocalizerFailedToUpdate, + IStringLocalizer stringLocalizerCannotConvertNull) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _blobSevice = blobService; _logger = logger; + _stringLocalizerFailedToUpdate = stringLocalizerFailedToUpdate; + _stringLocalizerCannotConvertNull = stringLocalizerCannotConvertNull; } public async Task> Handle(UpdateNewsCommand request, CancellationToken cancellationToken) @@ -28,7 +40,7 @@ public async Task> Handle(UpdateNewsCommand request, Cancellatio var news = _mapper.Map(request.news); if (news is null) { - const string errorMsg = $"Cannot convert null to news"; + string errorMsg = _stringLocalizerCannotConvertNull["CannotConvertNullToNews"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -57,7 +69,7 @@ public async Task> Handle(UpdateNewsCommand request, Cancellatio } else { - const string errorMsg = $"Failed to update news"; + string errorMsg = _stringLocalizerFailedToUpdate["FailedToUpdateNews"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Partners/Delete/DeletePartnerHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Partners/Delete/DeletePartnerHandler.cs index 8879382e6..649ca7afd 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Partners/Delete/DeletePartnerHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Partners/Delete/DeletePartnerHandler.cs @@ -1,8 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Partners; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Partners.Delete @@ -12,12 +14,14 @@ public class DeletePartnerHandler : IRequestHandler _stringLocalizerNo; - public DeletePartnerHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public DeletePartnerHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerNo) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; } public async Task> Handle(DeletePartnerQuery request, CancellationToken cancellationToken) @@ -25,7 +29,7 @@ public async Task> Handle(DeletePartnerQuery request, Cancell var partner = await _repositoryWrapper.PartnersRepository.GetFirstOrDefaultAsync(p => p.Id == request.id); if (partner == null) { - const string errorMsg = "No partner with such id"; + string? errorMsg = _stringLocalizerNo?["NoPartnerWithSuchId"].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Partners/GetAll/GetAllPartnersHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Partners/GetAll/GetAllPartnersHandler.cs index 7c12c91dc..fab82583a 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Partners/GetAll/GetAllPartnersHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Partners/GetAll/GetAllPartnersHandler.cs @@ -3,8 +3,10 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Partners; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.AdditionalContent.Coordinates; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -15,12 +17,14 @@ public class GetAllPartnersHandler : IRequestHandler _stringLocalizeCannotFind; - public GetAllPartnersHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllPartnersHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizeCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizeCannotFind = stringLocalizeCannotFind; } public async Task>> Handle(GetAllPartnersQuery request, CancellationToken cancellationToken) @@ -34,7 +38,7 @@ public async Task>> Handle(GetAllPartnersQuery re if (partners is null) { - const string errorMsg = $"Cannot find any partners"; + string? errorMsg = _stringLocalizeCannotFind["CannotFindAnyPartners"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Partners/GetAllPartnerShort/GetAllPartnerShortHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Partners/GetAllPartnerShort/GetAllPartnerShortHandler.cs index bf4a7c2ac..81a7183a6 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Partners/GetAllPartnerShort/GetAllPartnerShortHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Partners/GetAllPartnerShort/GetAllPartnerShortHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Partners; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Partners.GetAllPartnerShort @@ -13,12 +15,14 @@ internal class GetAllPartnerShortHandler : IRequestHandler _stringLocalizer; - public GetAllPartnerShortHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllPartnerShortHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizer) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizer = stringLocalizer; } public async Task>> Handle(GetAllPartnersShortQuery request, CancellationToken cancellationToken) @@ -27,7 +31,7 @@ public async Task>> Handle(GetAllPartnersSho if (partners is null) { - const string errorMsg = $"Cannot find any partners"; + string? errorMsg = _stringLocalizer?["CannotFindAnyPartners"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Partners/GetById/GetPartnerByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Partners/GetById/GetPartnerByIdHandler.cs index c79de5b8f..2545edda0 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Partners/GetById/GetPartnerByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Partners/GetById/GetPartnerByIdHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Partners; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Partners.GetById; @@ -13,12 +15,14 @@ public class GetPartnerByIdHandler : IRequestHandler? _stringLocalizer; - public GetPartnerByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetPartnerByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizer) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizer = stringLocalizer; } public async Task> Handle(GetPartnerByIdQuery request, CancellationToken cancellationToken) @@ -32,7 +36,7 @@ public async Task> Handle(GetPartnerByIdQuery request, Cancel if (partner is null) { - string errorMsg = $"Cannot find any partner with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizer?["CannotFindAnyPartnerWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Partners/GetByStreetcodeId/GetPartnersByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Partners/GetByStreetcodeId/GetPartnersByStreetcodeIdHandler.cs index 09b7e8f8c..cd1e7e5b1 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Partners/GetByStreetcodeId/GetPartnersByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Partners/GetByStreetcodeId/GetPartnersByStreetcodeIdHandler.cs @@ -3,8 +3,10 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Partners; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Partners.GetByStreetcodeId; @@ -14,12 +16,14 @@ public class GetPartnersByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetPartnersByStreetcodeIdHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public GetPartnersByStreetcodeIdHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetPartnersByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -29,7 +33,7 @@ public async Task>> Handle(GetPartnersByStreetcod if (streetcode is null) { - string errorMsg = $"Cannot find any partners with corresponding streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind?["CannotFindAnyStreetcodeWithCorrespondingStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -41,7 +45,7 @@ public async Task>> Handle(GetPartnersByStreetcod if (partners is null) { - string errorMsg = $"Cannot find a partners by a streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind?["CannotFindPartnersByStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Partners/GetToUpdateByStreetcodeId/GetPartnersToUpdateByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Partners/GetToUpdateByStreetcodeId/GetPartnersToUpdateByStreetcodeIdHandler.cs index 8f03bf897..503e05e8f 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Partners/GetToUpdateByStreetcodeId/GetPartnersToUpdateByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Partners/GetToUpdateByStreetcodeId/GetPartnersToUpdateByStreetcodeIdHandler.cs @@ -6,6 +6,8 @@ using Streetcode.DAL.Repositories.Interfaces.Base; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.BLL.MediatR.Partners.GetByStreetcodeIdToUpdate { @@ -14,12 +16,14 @@ public class GetPartnersToUpdateByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetPartnersToUpdateByStreetcodeIdHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public GetPartnersToUpdateByStreetcodeIdHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetPartnersToUpdateByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -29,7 +33,7 @@ public async Task>> Handle(GetPartnersToUpdateByS if (streetcode is null) { - string errorMsg = $"Cannot find any streetcode with corresponding streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyStreetcodeWithCorrespondingStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -41,7 +45,7 @@ public async Task>> Handle(GetPartnersToUpdateByS if (partners is null) { - string errorMsg = $"Cannot find a partners by a streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindPartnersByStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Payment/CreateInvoiceHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Payment/CreateInvoiceHandler.cs index 42834d4fd..b9100736a 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Payment/CreateInvoiceHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Payment/CreateInvoiceHandler.cs @@ -1,6 +1,7 @@ using FluentResults; using MediatR; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; using Streetcode.BLL.Interfaces.Payment; using Streetcode.DAL.Entities.Payment; @@ -12,16 +13,18 @@ public class CreateInvoiceHandler : IRequestHandler _stringlocalization; - public CreateInvoiceHandler(IPaymentService paymentService, ILoggerService logger) + public CreateInvoiceHandler(IPaymentService paymentService, ILoggerService logger, IStringLocalizer stringLocalizer) { _paymentService = paymentService; _logger = logger; + _stringlocalization = stringLocalizer; } public async Task> Handle(CreateInvoiceCommand request, CancellationToken cancellationToken) { - var invoice = new Invoice(request.Payment.Amount * _currencyMultiplier, _hryvnyaCurrencyCode, new MerchantPaymentInfo { Destination = "Добровільний внесок на статутну діяльність ГО «Історична Платформа»" }, request.Payment.RedirectUrl); + var invoice = new Invoice(request.Payment.Amount * _currencyMultiplier, _hryvnyaCurrencyCode, new MerchantPaymentInfo { Destination = _stringlocalization["VoluntaryContribution"].Value }, request.Payment.RedirectUrl); return Result.Ok(await _paymentService.CreateInvoiceAsync(invoice)); } } diff --git a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/Create/CreateCategoryHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/Create/CreateCategoryHandler.cs index 226a8833f..31b7bdc35 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/Create/CreateCategoryHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/Create/CreateCategoryHandler.cs @@ -2,7 +2,9 @@ using FluentResults; using MediatR; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; using Streetcode.BLL.MediatR.Streetcode.Fact.Create; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Sources.SourceLink.Create @@ -12,12 +14,21 @@ public class CreateCategoryHandler : IRequestHandler _stringLocalizerCannot; + private readonly IStringLocalizer _stringLocalizerFailed; - public CreateCategoryHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public CreateCategoryHandler( + IRepositoryWrapper repositoryWrapper, + IMapper mapper, + ILoggerService logger, + IStringLocalizer stringLocalizerFailed, + IStringLocalizer stringLocalizerCannot) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerFailed = stringLocalizerFailed; + _stringLocalizerCannot = stringLocalizerCannot; } public async Task> Handle(CreateCategoryCommand request, CancellationToken cancellationToken) @@ -30,7 +41,7 @@ public CreateCategoryHandler(IRepositoryWrapper repositoryWrapper, IMapper mappe if (category is null) { - const string errorMsg = "Cannot convert null to Category"; + string errorMsg = _stringLocalizerCannot["CannotConvertNullToCategory"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -43,7 +54,7 @@ public CreateCategoryHandler(IRepositoryWrapper repositoryWrapper, IMapper mappe } else { - const string errorMsg = "Failed to create a category"; + string errorMsg = _stringLocalizerFailed["FailedToCreateCategory"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/Delete/DeleteCategoryHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/Delete/DeleteCategoryHandler.cs index 3ec29ec58..010bf29fb 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/Delete/DeleteCategoryHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/Delete/DeleteCategoryHandler.cs @@ -1,6 +1,8 @@ using FluentResults; using MediatR; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Sources.SourceLink.Delete @@ -9,11 +11,19 @@ public class DeleteCategoryHandler : IRequestHandler _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerFailedToDelete; - public DeleteCategoryHandler(IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public DeleteCategoryHandler( + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizerFailedToDelete, + IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerFailedToDelete = stringLocalizerFailedToDelete; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(DeleteCategoryCommand request, CancellationToken cancellationToken) @@ -22,7 +32,7 @@ public async Task> Handle(DeleteCategoryCommand request, Cancellati if (category is null) { - string errorMsg = $"Cannot find a category with corresponding categoryId: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindCategoryWithCorrespondingCategoryId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -36,7 +46,7 @@ public async Task> Handle(DeleteCategoryCommand request, Cancellati } else { - string errorMsg = "Failed to delete a category"; + string errorMsg = _stringLocalizerFailedToDelete["FailedToDeleteCategory"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetAll/GetAllCategoriesHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetAll/GetAllCategoriesHandler.cs index 349277884..661662d7b 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetAll/GetAllCategoriesHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetAll/GetAllCategoriesHandler.cs @@ -2,11 +2,13 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Images; using Streetcode.BLL.DTO.Sources; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.Services.BlobStorageService; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Sources.SourceLinkCategory.GetAll @@ -16,13 +18,15 @@ public class GetAllCategoriesHandler : IRequestHandler _stringLocalizerNo; private readonly ILoggerService _logger; - public GetAllCategoriesHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger) + public GetAllCategoriesHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger, IStringLocalizer stringLocalizerNo) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _blobService = blobService; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; } public async Task>> Handle(GetAllCategoriesQuery request, CancellationToken cancellationtoken) @@ -31,7 +35,7 @@ public async Task>> Handle(GetAllCateg include: cat => cat.Include(img => img.Image) !); if (allCategories == null) { - const string errorMsg = $"Categories is null"; + string errorMsg = _stringLocalizerNo["NoCategories"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetAll/GetAllCategoryNamesHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetAll/GetAllCategoryNamesHandler.cs index 20f8d1b45..38d31bc23 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetAll/GetAllCategoryNamesHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetAll/GetAllCategoryNamesHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Sources; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Sources.SourceLinkCategory.GetAll @@ -13,12 +15,14 @@ public class GetAllCategoryNamesHandler : IRequestHandler _stringLocalizerNo; - public GetAllCategoryNamesHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllCategoryNamesHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerNo) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; } public async Task>> Handle(GetAllCategoryNamesQuery request, CancellationToken cancellationToken) @@ -27,7 +31,7 @@ public async Task>> Handle(GetAllCategor if (allCategories == null) { - const string errorMsg = $"Categories is null"; + string errorMsg = _stringLocalizerNo["NoCategories"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetCategoriesByStreetcodeId/GetCategoriesByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetCategoriesByStreetcodeId/GetCategoriesByStreetcodeIdHandler.cs index 039453f4a..17f55e3e4 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetCategoriesByStreetcodeId/GetCategoriesByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetCategoriesByStreetcodeId/GetCategoriesByStreetcodeIdHandler.cs @@ -3,9 +3,11 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Sources; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Sources.SourceLink.GetCategoriesByStreetcodeId; @@ -16,13 +18,15 @@ public class GetCategoriesByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetCategoriesByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger) + public GetCategoriesByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _blobService = blobService; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetCategoriesByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -35,7 +39,7 @@ public async Task>> Handle(GetCategori if (srcCategories is null) { - string errorMsg = $"Cant find any source category with the streetcode id {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnySourceCategoryWithTheStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetCategoryById/GetCategoryByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetCategoryById/GetCategoryByIdHandler.cs index fa7abde5f..67f34e12a 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetCategoryById/GetCategoryByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetCategoryById/GetCategoryByIdHandler.cs @@ -2,9 +2,11 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Sources; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.AdditionalContent.Coordinates; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -16,17 +18,20 @@ public class GetCategoryByIdHandler : IRequestHandler _stringLocalizerCannotFind; public GetCategoryByIdHandler( IRepositoryWrapper repositoryWrapper, IMapper mapper, IBlobService blobService, - ILoggerService logger) + ILoggerService logger, + IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _blobService = blobService; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetCategoryByIdQuery request, CancellationToken cancellationToken) @@ -41,7 +46,7 @@ public async Task> Handle(GetCategoryByIdQuery req if (srcCategories is null) { - string errorMsg = $"Cannot find any srcCategory by the corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnySrcCategoryByTheCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetCategoryContentByStreetcodeId/GetCategoryContentByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetCategoryContentByStreetcodeId/GetCategoryContentByStreetcodeIdHandler.cs index 00ec1c40a..bd8679a7f 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetCategoryContentByStreetcodeId/GetCategoryContentByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/GetCategoryContentByStreetcodeId/GetCategoryContentByStreetcodeIdHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Sources; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Sources.SourceLinkCategory.GetCategoryContentByStreetcodeId @@ -13,12 +15,14 @@ public class GetCategoryContentByStreetcodeIdHandler : IRequestHandler _stringLocalizerNo; - public GetCategoryContentByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetCategoryContentByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerNo) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; } public async Task> Handle(GetCategoryContentByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -26,7 +30,7 @@ public async Task> Handle(GetCategoryConten if((await _repositoryWrapper.StreetcodeRepository .GetFirstOrDefaultAsync(s => s.Id == request.streetcodeId)) == null) { - string errorMsg = $"No such streetcode with id = {request.streetcodeId}"; + string errorMsg = _stringLocalizerNo["NoSuchStreetcodeWithId", request.streetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -37,7 +41,7 @@ public async Task> Handle(GetCategoryConten if (streetcodeContent == null) { - string errorMsg = "The streetcode content is null"; + string errorMsg = _stringLocalizerNo["NoStreetcodeContentExist"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/Update/UpdateCategoryHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/Update/UpdateCategoryHandler.cs index d5bf40579..4592edb7a 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/Update/UpdateCategoryHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Sources/SourceLinkCategory/Update/UpdateCategoryHandler.cs @@ -1,9 +1,11 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.Streetcode.Fact.Update; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Sources.SourceLink.Update @@ -13,11 +15,20 @@ public class UpdateCategoryHandler : IRequestHandler _stringLocalizerCannotConvert; + private readonly IStringLocalizer _stringLocalizerFailedToUpdate; + public UpdateCategoryHandler( + IRepositoryWrapper repositoryWrapper, + IMapper mapper, + ILoggerService logger, + IStringLocalizer stringLocalizerFailedToUpdate, + IStringLocalizer stringLocalizerCannotConvert) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerFailedToUpdate = stringLocalizerFailedToUpdate; + _stringLocalizerCannotConvert = stringLocalizerCannotConvert; } public async Task> Handle(UpdateCategoryCommand request, CancellationToken cancellationToken) @@ -25,7 +36,7 @@ public async Task> Handle(UpdateCategoryCommand request, Cancellati var category = _mapper.Map(request.Category); if (category is null) { - const string errorMsg = "Cannot convert null to Category"; + string errorMsg = _stringLocalizerCannotConvert["CannotConvertNullToCategory"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -39,7 +50,7 @@ public async Task> Handle(UpdateCategoryCommand request, Cancellati } else { - const string errorMsg = "Failed to update a category"; + string errorMsg = _stringLocalizerFailedToUpdate["FailedToUpdateCategory"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/Create/CreateFactHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/Create/CreateFactHandler.cs index da832d866..dfe766545 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/Create/CreateFactHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/Create/CreateFactHandler.cs @@ -2,6 +2,8 @@ using FluentResults; using MediatR; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Fact.Create; @@ -11,12 +13,21 @@ public class CreateFactHandler : IRequestHandler private readonly IMapper _mapper; private readonly IRepositoryWrapper _repositoryWrapper; private readonly ILoggerService _logger; + private readonly IStringLocalizer _stringLocalizerCannot; + private readonly IStringLocalizer _stringLocalizerFailed; - public CreateFactHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public CreateFactHandler( + IRepositoryWrapper repositoryWrapper, + IMapper mapper, + ILoggerService logger, + IStringLocalizer stringLocalizerFailed, + IStringLocalizer stringLocalizerCannot) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerFailed = stringLocalizerFailed; + _stringLocalizerCannot = stringLocalizerCannot; } public async Task> Handle(CreateFactCommand request, CancellationToken cancellationToken) @@ -25,7 +36,7 @@ public async Task> Handle(CreateFactCommand request, CancellationTo if (fact is null) { - const string errorMsg = "Cannot convert null to Fact"; + string errorMsg = _stringLocalizerCannot["CannotConvertNullToFact"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -39,7 +50,7 @@ public async Task> Handle(CreateFactCommand request, CancellationTo } else { - const string errorMsg = "Failed to create a fact"; + string errorMsg = _stringLocalizerFailed["FailedToCreateFact"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/Delete/DeleteFactHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/Delete/DeleteFactHandler.cs index b665da855..dfb8526ab 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/Delete/DeleteFactHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/Delete/DeleteFactHandler.cs @@ -1,6 +1,8 @@ using FluentResults; using MediatR; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Fact.Delete; @@ -9,11 +11,19 @@ public class DeleteFactHandler : IRequestHandler { private readonly IRepositoryWrapper _repositoryWrapper; private readonly ILoggerService _logger; + private readonly IStringLocalizer _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerFailedToDelete; - public DeleteFactHandler(IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public DeleteFactHandler( + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizerFailedToDelete, + IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerFailedToDelete = stringLocalizerFailedToDelete; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(DeleteFactCommand request, CancellationToken cancellationToken) @@ -22,7 +32,7 @@ public async Task> Handle(DeleteFactCommand request, CancellationTo if (fact is null) { - string errorMsg = $"Cannot find a fact with corresponding categoryId: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindFactWithCorrespondingCategoryId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -36,7 +46,7 @@ public async Task> Handle(DeleteFactCommand request, CancellationTo } else { - string errorMsg = "Failed to delete a fact"; + string errorMsg = _stringLocalizerFailedToDelete["FailedToDeleteFact"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/GetAll/GetAllFactsHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/GetAll/GetAllFactsHandler.cs index 163e2b380..0e17d1a37 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/GetAll/GetAllFactsHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/GetAll/GetAllFactsHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode.TextContent.Fact; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Fact.GetAll; @@ -13,12 +15,14 @@ public class GetAllFactsHandler : IRequestHandler _stringLocalizeCannotFind; - public GetAllFactsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllFactsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizeCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizeCannotFind = stringLocalizeCannotFind; } public async Task>> Handle(GetAllFactsQuery request, CancellationToken cancellationToken) @@ -27,7 +31,7 @@ public async Task>> Handle(GetAllFactsQuery request, if (facts is null) { - const string errorMsg = $"Cannot find any fact"; + string errorMsg = _stringLocalizeCannotFind["CannotFindAnyFact"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/GetById/GetFactByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/GetById/GetFactByIdHandler.cs index 6503cd686..101fc2402 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/GetById/GetFactByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/GetById/GetFactByIdHandler.cs @@ -1,8 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode.TextContent.Fact; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Fact.GetById; @@ -12,12 +14,14 @@ public class GetFactByIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetFactByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetFactByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetFactByIdQuery request, CancellationToken cancellationToken) @@ -26,7 +30,7 @@ public async Task> Handle(GetFactByIdQuery request, Cancellation if (facts is null) { - string errorMsg = $"Cannot find any fact with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindFactWithCorrespondingCategoryId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/GetByStreetcodeId/GetFactByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/GetByStreetcodeId/GetFactByStreetcodeIdHandler.cs index c5b29c9df..53b4fc00a 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/GetByStreetcodeId/GetFactByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/GetByStreetcodeId/GetFactByStreetcodeIdHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode.TextContent.Fact; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Fact.GetByStreetcodeId; @@ -13,12 +15,14 @@ public class GetFactByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetFactByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetFactByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetFactByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -28,7 +32,7 @@ public async Task>> Handle(GetFactByStreetcodeIdQuer if (fact is null) { - string errorMsg = $"Cannot find any fact by the streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyFactByTheStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/Update/UpdateFactHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/Update/UpdateFactHandler.cs index 4dcbb7471..562b83109 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/Update/UpdateFactHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Fact/Update/UpdateFactHandler.cs @@ -2,6 +2,8 @@ using FluentResults; using MediatR; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Fact.Update; @@ -11,12 +13,21 @@ public class UpdateFactHandler : IRequestHandler private readonly IMapper _mapper; private readonly IRepositoryWrapper _repositoryWrapper; private readonly ILoggerService _logger; + private readonly IStringLocalizer _stringLocalizerCannotConvert; + private readonly IStringLocalizer _stringLocalizerFailedToUpdate; - public UpdateFactHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public UpdateFactHandler( + IRepositoryWrapper repositoryWrapper, + IMapper mapper, + ILoggerService logger, + IStringLocalizer stringLocalizerFailedToUpdate, + IStringLocalizer stringLocalizerCannotConvert) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerFailedToUpdate = stringLocalizerFailedToUpdate; + _stringLocalizerCannotConvert = stringLocalizerCannotConvert; } public async Task> Handle(UpdateFactCommand request, CancellationToken cancellationToken) @@ -25,7 +36,7 @@ public async Task> Handle(UpdateFactCommand request, CancellationTo if (fact is null) { - const string errorMsg = "Cannot convert null to Fact"; + string errorMsg = _stringLocalizerCannotConvert["CannotConvertNullToFact"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -39,7 +50,7 @@ public async Task> Handle(UpdateFactCommand request, CancellationTo } else { - const string errorMsg = "Failed to update a fact"; + string errorMsg = _stringLocalizerFailedToUpdate["FailedToUpdateFact"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/Delete/DeleteRelatedFigureHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/Delete/DeleteRelatedFigureHandler.cs index 469469179..9275e1ee5 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/Delete/DeleteRelatedFigureHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/Delete/DeleteRelatedFigureHandler.cs @@ -1,6 +1,8 @@ using FluentResults; using MediatR; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.RelatedFigure.Delete; @@ -9,11 +11,19 @@ public class DeleteRelatedFigureHandler : IRequestHandler _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerFailedToDelete; - public DeleteRelatedFigureHandler(IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public DeleteRelatedFigureHandler( + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizerFailedToDelete, + IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerFailedToDelete = stringLocalizerFailedToDelete; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(DeleteRelatedFigureCommand request, CancellationToken cancellationToken) @@ -25,7 +35,7 @@ public async Task> Handle(DeleteRelatedFigureCommand request, Cance if (relation is null) { - string errorMsg = $"Cannot find a relation between streetcodes with corresponding ids: {request.ObserverId} & {request.TargetId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindRelationBetweenStreetcodesWithCorrespondingIds", request.ObserverId, request.TargetId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -39,7 +49,7 @@ public async Task> Handle(DeleteRelatedFigureCommand request, Cance } else { - const string errorMsg = "Failed to delete a relation."; + string errorMsg = _stringLocalizerFailedToDelete["FailedToDeleteRelation"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/GetByStreetcodeId/GetRelatedFiguresByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/GetByStreetcodeId/GetRelatedFiguresByStreetcodeIdHandler.cs index f3476fcf0..f50f6aba3 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/GetByStreetcodeId/GetRelatedFiguresByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/GetByStreetcodeId/GetRelatedFiguresByStreetcodeIdHandler.cs @@ -3,10 +3,12 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode.RelatedFigure; using Streetcode.DAL.Entities.Streetcode; using Streetcode.DAL.Enums; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.RelatedFigure.GetByStreetcodeId; @@ -16,12 +18,14 @@ public class GetRelatedFiguresByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetRelatedFiguresByStreetcodeIdHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public GetRelatedFiguresByStreetcodeIdHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetRelatedFigureByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -30,7 +34,7 @@ public async Task>> Handle(GetRelatedFigure if (relatedFigureIds is null) { - string errorMsg = $"Cannot find any related figures by a streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyRelatedFiguresByStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -42,7 +46,7 @@ public async Task>> Handle(GetRelatedFigure if (relatedFigures is null) { - string errorMsg = $"Cannot find any related figures by a streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyRelatedFiguresByStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/GetByTagId/GetRelatedFiguresByTagIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/GetByTagId/GetRelatedFiguresByTagIdHandler.cs index 67e7c3c76..adc4321a9 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/GetByTagId/GetRelatedFiguresByTagIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/GetByTagId/GetRelatedFiguresByTagIdHandler.cs @@ -3,9 +3,11 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode.RelatedFigure; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.Streetcode.Streetcode.GetByIndex; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.Streetcode.Types; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -16,12 +18,14 @@ internal class GetRelatedFiguresByTagIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetRelatedFiguresByTagIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetRelatedFiguresByTagIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetRelatedFiguresByTagIdQuery request, CancellationToken cancellationToken) @@ -36,7 +40,7 @@ public async Task>> Handle(GetRelatedFigure if (streetcodes is null) { - string errorMsg = $"Cannot find any streetcode with corresponding tagid: {request.tagId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyFactWithCorrespondingId", request.tagId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git "a/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/\320\241reate/CreateRelatedFigureHandler.cs" "b/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/\320\241reate/CreateRelatedFigureHandler.cs" index 2ed658196..d4c5faf3e 100644 --- "a/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/\320\241reate/CreateRelatedFigureHandler.cs" +++ "b/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedFigure/\320\241reate/CreateRelatedFigureHandler.cs" @@ -1,8 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using NLog.Targets; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.Streetcode; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -13,12 +15,20 @@ public class CreateRelatedFigureHandler : IRequestHandler _stringLocalizerNo; + private readonly IStringLocalizer _stringLocalizerFailed; + public CreateRelatedFigureHandler( + IRepositoryWrapper repositoryWrapper, + IMapper mapper, + ILoggerService logger, + IStringLocalizer stringLocalizerNo, + IStringLocalizer stringLocalizerFailed) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerFailed = stringLocalizerFailed; + _stringLocalizerNo = stringLocalizerNo; } public async Task> Handle(CreateRelatedFigureCommand request, CancellationToken cancellationToken) @@ -28,14 +38,14 @@ public async Task> Handle(CreateRelatedFigureCommand request, Cance if (observerEntity is null) { - string errorMsg = $"No existing streetcode with id: {request.ObserverId}"; + string errorMsg = _stringLocalizerNo["NoExistingStreetcodeWithId", request.ObserverId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } if (targetEntity is null) { - string errorMsg = $"No existing streetcode with id: {request.TargetId}"; + string errorMsg = _stringLocalizerNo["NoExistingStreetcodeWithId", request.TargetId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -55,7 +65,7 @@ public async Task> Handle(CreateRelatedFigureCommand request, Cance } else { - string errorMsg = "Failed to create a relation."; + string errorMsg = _stringLocalizerFailed["FailedToCreateRelation"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedTerm/Create/CreateRelatedTermHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedTerm/Create/CreateRelatedTermHandler.cs index 9e41fb495..25e4bc7bb 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedTerm/Create/CreateRelatedTermHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedTerm/Create/CreateRelatedTermHandler.cs @@ -1,8 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode.TextContent; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; using Entity = Streetcode.DAL.Entities.Streetcode.TextContent.RelatedTerm; @@ -14,12 +16,27 @@ public class CreateRelatedTermHandler : IRequestHandler _stringLocalizerCannotCreate; + private readonly IStringLocalizer _stringLocalizerCannotSave; + private readonly IStringLocalizer _stringLocalizerCannotMap; + private readonly IStringLocalizer _stringLocalizer; - public CreateRelatedTermHandler(IRepositoryWrapper repository, IMapper mapper, ILoggerService logger) + public CreateRelatedTermHandler( + IRepositoryWrapper repository, + IMapper mapper, + ILoggerService logger, + IStringLocalizer stringLocalizerCannotSave, + IStringLocalizer stringLocalizerCannotMap, + IStringLocalizer stringLocalizer, + IStringLocalizer stringLocalizerCannotCreate) { _repository = repository; _mapper = mapper; _logger = logger; + _stringLocalizerCannotSave = stringLocalizerCannotSave; + _stringLocalizerCannotMap = stringLocalizerCannotMap; + _stringLocalizer = stringLocalizer; + _stringLocalizerCannotCreate = stringLocalizerCannotCreate; } public async Task> Handle(CreateRelatedTermCommand request, CancellationToken cancellationToken) @@ -28,7 +45,7 @@ public async Task> Handle(CreateRelatedTermCommand reques if (relatedTerm is null) { - const string errorMsg = "Cannot create new related word for a term!"; + string errorMsg = _stringLocalizerCannotCreate["CannotCreateNewRelatedWordForTerm"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -39,7 +56,7 @@ public async Task> Handle(CreateRelatedTermCommand reques if (existingTerms is null || existingTerms.Any()) { - const string errorMsg = "Слово з цим визначенням уже існує"; + string errorMsg = _stringLocalizer["WordWithThisDefinitionAlreadyExists"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -50,7 +67,7 @@ public async Task> Handle(CreateRelatedTermCommand reques if(!isSuccessResult) { - const string errorMsg = "Cannot save changes in the database after related word creation!"; + string errorMsg = _stringLocalizerCannotSave["CannotSaveChangesInTheDatabaseAfterRelatedWordCreation"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -63,7 +80,7 @@ public async Task> Handle(CreateRelatedTermCommand reques } else { - const string errorMsg = "Cannot map entity!"; + string errorMsg = _stringLocalizerCannotMap["CannotMapEntity"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedTerm/Delete/DeleteRelatedTermHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedTerm/Delete/DeleteRelatedTermHandler.cs index c548249c8..5183223bb 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedTerm/Delete/DeleteRelatedTermHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedTerm/Delete/DeleteRelatedTermHandler.cs @@ -3,6 +3,8 @@ using MediatR; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.DTO.Streetcode.TextContent; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.RelatedTerm.Delete @@ -12,12 +14,21 @@ public class DeleteRelatedTermHandler : IRequestHandler _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerFailedToDelete; - public DeleteRelatedTermHandler(IRepositoryWrapper repository, IMapper mapper, ILoggerService logger) + public DeleteRelatedTermHandler( + IRepositoryWrapper repository, + IMapper mapper, + ILoggerService logger, + IStringLocalizer stringLocalizerFailedToDelete, + IStringLocalizer stringLocalizerCannotFind) { _repository = repository; _mapper = mapper; _logger = logger; + _stringLocalizerFailedToDelete = stringLocalizerFailedToDelete; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(DeleteRelatedTermCommand request, CancellationToken cancellationToken) @@ -26,7 +37,7 @@ public async Task> Handle(DeleteRelatedTermCommand reques if (relatedTerm is null) { - string errorMsg = $"Cannot find a related term: {request.word}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindRelatedTermWithCorrespondingId", request.word].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -41,7 +52,7 @@ public async Task> Handle(DeleteRelatedTermCommand reques } else { - const string errorMsg = "Failed to delete a related term"; + string errorMsg = _stringLocalizerFailedToDelete["FailedToDeleteRelatedTerm"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedTerm/GetAllByTermId/GetAllRelatedTermsByTermIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedTerm/GetAllByTermId/GetAllRelatedTermsByTermIdHandler.cs index d50fa0130..23c58fb3f 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedTerm/GetAllByTermId/GetAllRelatedTermsByTermIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/RelatedTerm/GetAllByTermId/GetAllRelatedTermsByTermIdHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode.TextContent; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.RelatedTerm.GetAllByTermId @@ -13,12 +15,21 @@ public record GetAllRelatedTermsByTermIdHandler : IRequestHandler _stringLocalizerCannotGet; + private readonly IStringLocalizer _stringLocalizerCannotCreate; - public GetAllRelatedTermsByTermIdHandler(IMapper mapper, IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public GetAllRelatedTermsByTermIdHandler( + IMapper mapper, + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizerCannotGet, + IStringLocalizer stringLocalizerCannotCreate) { _mapper = mapper; _repository = repositoryWrapper; _logger = logger; + _stringLocalizerCannotCreate = stringLocalizerCannotCreate; + _stringLocalizerCannotGet = stringLocalizerCannotGet; } public async Task>> Handle(GetAllRelatedTermsByTermIdQuery request, CancellationToken cancellationToken) @@ -30,7 +41,7 @@ public async Task>> Handle(GetAllRelatedTerms if (relatedTerms is null) { - const string errorMsg = "Cannot get words by term id"; + string errorMsg = _stringLocalizerCannotGet["CannotGetWordsByTermId"].Value; _logger.LogError(request, errorMsg); return new Error(errorMsg); } @@ -39,7 +50,7 @@ public async Task>> Handle(GetAllRelatedTerms if (relatedTermsDTO is null) { - const string errorMsg = "Cannot create DTOs for related words!"; + string errorMsg = _stringLocalizerCannotCreate["CannotCreateDTOsForRelatedWords"].Value; _logger.LogError(request, errorMsg); return new Error(errorMsg); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/Create/CreateStreetcodeHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/Create/CreateStreetcodeHandler.cs index 5b9d92ebe..706c56edd 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/Create/CreateStreetcodeHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/Create/CreateStreetcodeHandler.cs @@ -19,6 +19,8 @@ using Streetcode.BLL.DTO.Streetcode.TextContent.Fact; using Streetcode.BLL.DTO.Media.Images; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.BLL.MediatR.Streetcode.Streetcode.Create; @@ -27,12 +29,21 @@ public class CreateStreetcodeHandler : IRequestHandler _stringLocalizerFailedToCreate; + private readonly IStringLocalizer _stringLocalizerAnErrorOccurred; + + public CreateStreetcodeHandler( + IMapper mapper, + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizerAnErrorOccurred, + IStringLocalizer stringLocalizerFailedToCreate) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerAnErrorOccurred = stringLocalizerAnErrorOccurred; + _stringLocalizerFailedToCreate = stringLocalizerFailedToCreate; } public async Task> Handle(CreateStreetcodeCommand request, CancellationToken cancellationToken) @@ -69,14 +80,14 @@ public async Task> Handle(CreateStreetcodeCommand request, Cancellat } else { - const string errorMsg = "Failed to create a streetcode"; + string errorMsg = _stringLocalizerFailedToCreate["FailedToCreateStreetcode"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } } catch(Exception ex) { - string errorMsg = $"An error occurred while creating a streetcode. Message: {ex.Message}"; + string errorMsg = _stringLocalizerAnErrorOccurred["AnErrorOccurredWhileCreating", ex.Message].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/Delete/DeleteStreetcodeHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/Delete/DeleteStreetcodeHandler.cs index e79f02519..0d4765032 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/Delete/DeleteStreetcodeHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/Delete/DeleteStreetcodeHandler.cs @@ -3,6 +3,8 @@ using MediatR; using Streetcode.DAL.Repositories.Interfaces.Base; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.BLL.MediatR.Streetcode.Streetcode.Delete; @@ -10,11 +12,19 @@ public class DeleteStreetcodeHandler : IRequestHandler _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerFailedToDelete; + + public DeleteStreetcodeHandler( + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizerFailedToDelete, + IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerFailedToDelete = stringLocalizerFailedToDelete; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(DeleteStreetcodeCommand request, CancellationToken cancellationToken) @@ -25,7 +35,7 @@ public async Task> Handle(DeleteStreetcodeCommand request, Cancella if (streetcode is null) { - string errorMsg = $"Cannot find a streetcode with corresponding categoryId: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindStreetcodeWithCorrespondingCategoryId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -44,7 +54,7 @@ public async Task> Handle(DeleteStreetcodeCommand request, Cancella } else { - const string errorMsg = "Failed to delete a streetcode"; + string errorMsg = _stringLocalizerFailedToDelete["FailedToDeleteStreetcode"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/DeleteSoft/DeleteSoftStreetcodeHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/DeleteSoft/DeleteSoftStreetcodeHandler.cs index fe07ccdd2..1b40981d4 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/DeleteSoft/DeleteSoftStreetcodeHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/DeleteSoft/DeleteSoftStreetcodeHandler.cs @@ -1,6 +1,8 @@ using FluentResults; using MediatR; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Streetcode.DeleteSoft; @@ -9,11 +11,15 @@ public class DeleteSoftStreetcodeHandler : IRequestHandler _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerFailedToUpdate; - public DeleteSoftStreetcodeHandler(IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public DeleteSoftStreetcodeHandler(IRepositoryWrapper repositoryWrapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind, IStringLocalizer stringLocalizerFailedToUpdate) { _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; + _stringLocalizerFailedToUpdate = stringLocalizerFailedToUpdate; } public async Task> Handle(DeleteSoftStreetcodeCommand request, CancellationToken cancellationToken) @@ -23,7 +29,7 @@ public async Task> Handle(DeleteSoftStreetcodeCommand request, Canc if (streetcode is null) { - string errorMsg = $"Cannot find a streetcode with corresponding categoryId: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindStreetcodeWithCorrespondingCategoryId", request.Id].Value; _logger.LogError(request, errorMsg); throw new ArgumentNullException(errorMsg); } @@ -41,7 +47,7 @@ public async Task> Handle(DeleteSoftStreetcodeCommand request, Canc } else { - const string errorMsg = "Failed to change status of streetcode to deleted"; + string errorMsg = _stringLocalizerFailedToUpdate["FailedToChangeStatusOfStreetcodeToDeleted"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllCatalog/GetAllStreetcodesCatalogHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllCatalog/GetAllStreetcodesCatalogHandler.cs index e14efc851..c3d920e2d 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllCatalog/GetAllStreetcodesCatalogHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllCatalog/GetAllStreetcodesCatalogHandler.cs @@ -3,26 +3,28 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.DTO.Streetcode.CatalogItem; -using Streetcode.BLL.DTO.Streetcode.RelatedFigure; using Streetcode.BLL.Interfaces.Logging; -using Streetcode.DAL.Entities.Media.Images; using Streetcode.DAL.Enums; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Streetcode.GetAllCatalog { - public class GetAllStreetcodesCatalogHandler : IRequestHandler>> { private readonly IMapper _mapper; private readonly IRepositoryWrapper _repositoryWrapper; private readonly ILoggerService _logger; + private readonly IStringLocalizer _stringLocalizerNo; - public GetAllStreetcodesCatalogHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllStreetcodesCatalogHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerNo) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; } public async Task>> Handle(GetAllStreetcodesCatalogQuery request, CancellationToken cancellationToken) @@ -43,7 +45,7 @@ public async Task>> Handle(GetAllStreetcodesCata return Result.Ok(_mapper.Map>(skipped)); } - const string errorMsg = $"Cannot find any subtitles"; + string errorMsg = _stringLocalizerNo["NoStreetcodesExistNow"].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllMainPage/GetAllStreetcodesMainPageHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllMainPage/GetAllStreetcodesMainPageHandler.cs index 85506d029..7461e0ee3 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllMainPage/GetAllStreetcodesMainPageHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllMainPage/GetAllStreetcodesMainPageHandler.cs @@ -2,9 +2,11 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.Streetcode.Streetcode.GetAllStreetcodesMainPage; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Streetcode.GetAllMainPage @@ -15,12 +17,14 @@ public class GetAllStreetcodesMainPageHandler : IRequestHandler _stringLocalizerNo; - public GetAllStreetcodesMainPageHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllStreetcodesMainPageHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerNo) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; } public async Task>> Handle(GetAllStreetcodesMainPageQuery request, CancellationToken cancellationToken) @@ -31,10 +35,13 @@ public async Task>> Handle(GetAllStree if (streetcodes != null) { - return Result.Ok(_mapper.Map>(streetcodes)); + var random = new Random(); + var shuffledStreetcodes = streetcodes.OrderBy(sc => random.Next()); + + return Result.Ok(_mapper.Map>(shuffledStreetcodes)); } - const string errorMsg = "No streetcodes exist now"; + string errorMsg = _stringLocalizerNo["NoStreetcodesExistNow"].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllShort/GetAllStreetcodesShortHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllShort/GetAllStreetcodesShortHandler.cs index f03fe0e7d..b8de3bcf5 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllShort/GetAllStreetcodesShortHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetAllShort/GetAllStreetcodesShortHandler.cs @@ -1,8 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Streetcode.GetAllShort @@ -13,12 +15,14 @@ public class GetAllStreetcodesShortHandler : IRequestHandler _stringLocalizerNo; - public GetAllStreetcodesShortHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllStreetcodesShortHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerNo) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; } public async Task>> Handle(GetAllStreetcodesShortQuery request, CancellationToken cancellationToken) @@ -29,7 +33,7 @@ public async Task>> Handle(GetAllStreetco return Result.Ok(_mapper.Map>(streetcodes)); } - const string errorMsg = "No streetcodes exist now"; + string errorMsg = _stringLocalizerNo["NoStreetcodesExistNow"].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetById/GetStreetcodeByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetById/GetStreetcodeByIdHandler.cs index 24baa0715..ad1cb6a6f 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetById/GetStreetcodeByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetById/GetStreetcodeByIdHandler.cs @@ -3,9 +3,11 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.AdditionalContent.Tag; using Streetcode.BLL.DTO.Streetcode; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Streetcode.GetById; @@ -15,12 +17,14 @@ public class GetStreetcodeByIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetStreetcodeByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetStreetcodeByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetStreetcodeByIdQuery request, CancellationToken cancellationToken) @@ -30,7 +34,7 @@ public async Task> Handle(GetStreetcodeByIdQuery request, if (streetcode is null) { - string errorMsg = $"Cannot find any streetcode with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyStreetcodeWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetByIndex/GetStreetcodeByIndexHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetByIndex/GetStreetcodeByIndexHandler.cs index 48997289d..538679797 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetByIndex/GetStreetcodeByIndexHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetByIndex/GetStreetcodeByIndexHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Streetcode.GetByIndex; @@ -13,12 +15,14 @@ public class GetStreetcodeByIndexHandler : IRequestHandler _stringLocalizerCannotFind; - public GetStreetcodeByIndexHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetStreetcodeByIndexHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetStreetcodeByIndexQuery request, CancellationToken cancellationToken) @@ -29,7 +33,7 @@ public async Task> Handle(GetStreetcodeByIndexQuery reques if (streetcode is null) { - string errorMsg = $"Cannot find any streetcode with corresponding index: {request.Index}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyStreetcodeWithCorrespondingIndex", request.Index].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetByTransliterationUrl/GetStreetcodeByTransliterationUrlHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetByTransliterationUrl/GetStreetcodeByTransliterationUrlHandler.cs index e93c76e5e..b3b1896bd 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetByTransliterationUrl/GetStreetcodeByTransliterationUrlHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetByTransliterationUrl/GetStreetcodeByTransliterationUrlHandler.cs @@ -2,9 +2,11 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.AdditionalContent.Tag; using Streetcode.BLL.DTO.Streetcode; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Streetcode.GetByTransliterationUrl @@ -14,12 +16,14 @@ public class GetStreetcodeByTransliterationUrlHandler : IRequestHandler _stringLocalizerCannotFind; - public GetStreetcodeByTransliterationUrlHandler(IRepositoryWrapper repository, IMapper mapper, ILoggerService logger) + public GetStreetcodeByTransliterationUrlHandler(IRepositoryWrapper repository, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repository = repository; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetStreetcodeByTransliterationUrlQuery request, CancellationToken cancellationToken) @@ -30,7 +34,7 @@ public async Task> Handle(GetStreetcodeByTransliterationUr if (streetcode == null) { - string errorMsg = $"Cannot find streetcode by transliteration url: {request.url}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindStreetcodeByTransliterationUrl", request.url].Value; _logger.LogError(request, errorMsg); return new Error(errorMsg); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetCount/GetStreetcodesCountHander.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetCount/GetStreetcodesCountHander.cs index 879146ab4..d9405bd15 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetCount/GetStreetcodesCountHander.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetCount/GetStreetcodesCountHander.cs @@ -6,9 +6,11 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.Streetcode.Streetcode.GetAllShort; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Streetcode.GetCount @@ -18,11 +20,13 @@ public class GetStreetcodesCountHander : IRequestHandler _stringLocalizerNo; - public GetStreetcodesCountHander(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetStreetcodesCountHander(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerNo) { _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; } public async Task> Handle(GetStreetcodesCountQuery request, CancellationToken cancellationToken) @@ -34,7 +38,7 @@ public async Task> Handle(GetStreetcodesCountQuery request, Cancella return Result.Ok(streetcodes.Count()); } - const string errorMsg = "No streetcodes exist now"; + string errorMsg = _stringLocalizerNo["NoStreetcodesExistNow"].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetShortById/GetStreetcodeShortByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetShortById/GetStreetcodeShortByIdHandler.cs index b3970122e..849105f2d 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetShortById/GetStreetcodeShortByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetShortById/GetStreetcodeShortByIdHandler.cs @@ -1,8 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Streetcode.GetShortById @@ -12,12 +14,21 @@ public class GetStreetcodeShortByIdHandler : IRequestHandler _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerCannotMap; - public GetStreetcodeShortByIdHandler(IMapper mapper, IRepositoryWrapper repository, ILoggerService logger) + public GetStreetcodeShortByIdHandler( + IMapper mapper, + IRepositoryWrapper repository, + ILoggerService logger, + IStringLocalizer stringLocalizerCannotMap, + IStringLocalizer stringLocalizerCannotFind) { _mapper = mapper; _repository = repository; _logger = logger; + _stringLocalizerCannotMap = stringLocalizerCannotMap; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetStreetcodeShortByIdQuery request, CancellationToken cancellationToken) @@ -26,7 +37,7 @@ public async Task> Handle(GetStreetcodeShortByIdQuery if (streetcode == null) { - const string errorMsg = "Cannot find streetcode by id"; + string errorMsg = _stringLocalizerCannotFind["CannotFindStreetcodeById"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -35,7 +46,7 @@ public async Task> Handle(GetStreetcodeShortByIdQuery if(streetcodeShortDTO == null) { - const string errorMsg = "Cannot map streetcode to shortDTO"; + string errorMsg = _stringLocalizerCannotMap["CannotMapStreetcodeToShortDTO"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetUrlByQrId/GetStreetcodeUrlByQrIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetUrlByQrId/GetStreetcodeUrlByQrIdHandler.cs index 80c173a50..6ffa12dcf 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetUrlByQrId/GetStreetcodeUrlByQrIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/GetUrlByQrId/GetStreetcodeUrlByQrIdHandler.cs @@ -2,6 +2,8 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Streetcode.GetUrlByQrId @@ -10,10 +12,12 @@ public class GetStreetcodeUrlByQrIdHandler : IRequestHandler _stringLocalizerCannotFind; + public GetStreetcodeUrlByQrIdHandler(IRepositoryWrapper repository, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repository = repository; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetStreetcodeUrlByQrIdQuery request, CancellationToken cancellationToken) @@ -25,7 +29,7 @@ public async Task> Handle(GetStreetcodeUrlByQrIdQuery request, Ca if (statisticRecord == null) { - const string errorMsg = "Cannot find record by qrid"; + string errorMsg = _stringLocalizerCannotFind["CannotFindRecordWithQrId"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -34,7 +38,7 @@ public async Task> Handle(GetStreetcodeUrlByQrIdQuery request, Ca if(streetcode == null) { - const string errorMsg = "Cannot find streetcode by id"; + string errorMsg = _stringLocalizerCannotFind["CannotFindStreetcodeById"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/Update/UpdateStreetcodeHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/Update/UpdateStreetcodeHandler.cs index 447303729..5c6ab7505 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/Update/UpdateStreetcodeHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/Update/UpdateStreetcodeHandler.cs @@ -2,6 +2,7 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Media.Audio; using Streetcode.BLL.DTO.Media.Images; using Streetcode.BLL.DTO.Streetcode.TextContent.Text; @@ -12,6 +13,7 @@ using Streetcode.BLL.Enums; using Streetcode.BLL.Factories.Streetcode; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.Media; using Streetcode.DAL.Entities.Media.Images; using Streetcode.DAL.Entities.Streetcode; @@ -26,12 +28,20 @@ public class UpdateStreetcodeHandler : IRequestHandler _stringLocalizerFailedToUpdate; + private readonly IStringLocalizer _stringLocalizerAnErrorOccurred; + + public UpdateStreetcodeHandler( + IMapper mapper, + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizerAnErrorOccurred, + IStringLocalizer stringLocalizerFailedToUpdate) { _mapper = mapper; _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerAnErrorOccurred = stringLocalizerAnErrorOccurred; } public async Task> Handle(UpdateStreetcodeCommand request, CancellationToken cancellationToken) @@ -78,14 +88,14 @@ public async Task> Handle(UpdateStreetcodeCommand request, Cancellat } else { - const string errorMsg = "Failed to update a streetcode"; + string errorMsg = _stringLocalizerFailedToUpdate["FailedToUpdateStreetcode"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } } catch(Exception) { - const string errorMsg = "An error occurred while updating a streetcode"; + string errorMsg = _stringLocalizerAnErrorOccurred["AnErrorOccurredWhileUpdatin"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/UpdateStatus/UpdateStatusStreetcodeByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/UpdateStatus/UpdateStatusStreetcodeByIdHandler.cs index b48a8fedd..a72907ebc 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/UpdateStatus/UpdateStatusStreetcodeByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Streetcode/UpdateStatus/UpdateStatusStreetcodeByIdHandler.cs @@ -1,6 +1,8 @@ using FluentResults; using MediatR; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Streetcode.UpdateStatus; @@ -9,11 +11,19 @@ public class UpdateStatusStreetcodeByIdHandler : IRequestHandler _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerFailedToUpdate; + + public UpdateStatusStreetcodeByIdHandler( + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizerFailedToUpdate, + IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerFailedToUpdate = stringLocalizerFailedToUpdate; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(UpdateStatusStreetcodeByIdCommand request, CancellationToken cancellationToken) @@ -23,7 +33,7 @@ public async Task> Handle(UpdateStatusStreetcodeByIdCommand request if (streetcode is null) { - string errorMsg = $"Cannot find any streetcode with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyStreetcodeWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -41,7 +51,7 @@ public async Task> Handle(UpdateStatusStreetcodeByIdCommand request } else { - const string errorMsg = "Failed to update status of streetcode"; + string errorMsg = _stringLocalizerFailedToUpdate["FailedToUpdateStatusOfStreetcode"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Create/CreateTermHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Create/CreateTermHandler.cs index 482096b1e..c3104f1b5 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Create/CreateTermHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Create/CreateTermHandler.cs @@ -1,8 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode.TextContent; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; using Streetcode.DAL.Repositories.Realizations.Base; @@ -13,12 +15,24 @@ public class CreateTermHandler : IRequestHandler _stringLocalizerCannotConvert; + private readonly IStringLocalizer _stringLocalizerCannotCreate; + private readonly IStringLocalizer _stringLocalizerFailedToCreate; - public CreateTermHandler(IMapper mapper, IRepositoryWrapper repository, ILoggerService logger) + public CreateTermHandler( + IMapper mapper, + IRepositoryWrapper repository, + ILoggerService logger, + IStringLocalizer stringLocalizerCannotCreate, + IStringLocalizer stringLocalizerFailedToCreate, + IStringLocalizer stringLocalizerCannotConvert) { _mapper = mapper; _repository = repository; _logger = logger; + _stringLocalizerCannotCreate = stringLocalizerCannotCreate; + _stringLocalizerFailedToCreate = stringLocalizerFailedToCreate; + _stringLocalizerCannotConvert = stringLocalizerCannotConvert; } public async Task> Handle(CreateTermCommand request, CancellationToken cancellationToken) @@ -27,7 +41,7 @@ public async Task> Handle(CreateTermCommand request, Cancellatio if (term is null) { - const string errorMsg = "Cannot convert null to Term"; + string errorMsg = _stringLocalizerCannotConvert["CannotConvertNullToTerm"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -36,7 +50,7 @@ public async Task> Handle(CreateTermCommand request, Cancellatio if (createdTerm is null) { - const string errorMsg = "Cannot create term"; + string errorMsg = _stringLocalizerCannotCreate["CannotCreateTerm"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -45,7 +59,7 @@ public async Task> Handle(CreateTermCommand request, Cancellatio if(!resultIsSuccess) { - const string errorMsg = "Failed to create a term"; + string errorMsg = _stringLocalizerFailedToCreate["FailedToCreateTerm"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -58,7 +72,7 @@ public async Task> Handle(CreateTermCommand request, Cancellatio } else { - const string errorMsg = "Failed to map created term"; + string errorMsg = _stringLocalizerFailedToCreate["FailedToMapCreatedTerm"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Delete/DeleteTermHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Delete/DeleteTermHandler.cs index 57ce43d93..60e1db946 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Delete/DeleteTermHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Delete/DeleteTermHandler.cs @@ -2,6 +2,8 @@ using FluentResults; using MediatR; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Term.Delete @@ -10,11 +12,15 @@ public class DeleteTermHandler : IRequestHandler { private readonly IRepositoryWrapper _repository; private readonly ILoggerService _logger; + private readonly IStringLocalizer _stringLocalizerCannotConvert; + private readonly IStringLocalizer _stringLocalizerFailedToDelete; - public DeleteTermHandler(IRepositoryWrapper repository, ILoggerService logger) + public DeleteTermHandler(IRepositoryWrapper repository, ILoggerService logger, IStringLocalizer stringLocalizerFailedToDelete, IStringLocalizer stringLocalizerCannotConvert) { _repository = repository; _logger = logger; + _stringLocalizerFailedToDelete = stringLocalizerFailedToDelete; + _stringLocalizerCannotConvert = stringLocalizerCannotConvert; } public async Task> Handle(DeleteTermCommand request, CancellationToken cancellationToken) @@ -23,7 +29,7 @@ public async Task> Handle(DeleteTermCommand request, CancellationTo if (term is null) { - const string errorMsg = "Cannot convert null to Term"; + string errorMsg = _stringLocalizerCannotConvert["CannotConvertNullToTerm"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -37,7 +43,7 @@ public async Task> Handle(DeleteTermCommand request, CancellationTo } else { - const string errorMsg = "Failed to delete a term"; + string errorMsg = _stringLocalizerFailedToDelete["FailedToDeleteTerm"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetAll/GetAllTermsHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetAll/GetAllTermsHandler.cs index be52b7278..68ca4e439 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetAll/GetAllTermsHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetAll/GetAllTermsHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode.TextContent; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.AdditionalContent.Coordinates; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -14,12 +16,14 @@ public class GetAllTermsHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllTermsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllTermsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetAllTermsQuery request, CancellationToken cancellationToken) @@ -28,7 +32,7 @@ public async Task>> Handle(GetAllTermsQuery request, if (terms is null) { - const string errorMsg = $"Cannot find any term"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyTerm"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetById/GetTermByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetById/GetTermByIdHandler.cs index f2ad991c3..e65178f24 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetById/GetTermByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/GetById/GetTermByIdHandler.cs @@ -1,8 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode.TextContent; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Term.GetById; @@ -12,12 +14,14 @@ public class GetTermByIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetTermByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetTermByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetTermByIdQuery request, CancellationToken cancellationToken) @@ -26,7 +30,7 @@ public async Task> Handle(GetTermByIdQuery request, Cancellation if (term is null) { - string errorMsg = $"Cannot find any term with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyTermWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Update/UpdateTermHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Update/UpdateTermHandler.cs index bb2ec8060..547866ba8 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Update/UpdateTermHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Term/Update/UpdateTermHandler.cs @@ -2,6 +2,8 @@ using FluentResults; using MediatR; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Term.Update @@ -11,12 +13,16 @@ public class UpdateTermHandler : IRequestHandler private readonly IMapper _mapper; private readonly IRepositoryWrapper _repository; private readonly ILoggerService _logger; + private readonly IStringLocalizer _stringLocalizerCannotConvertNull; + private readonly IStringLocalizer _stringLocalizerFailedToUpdate; - public UpdateTermHandler(IMapper mapper, IRepositoryWrapper repository, ILoggerService logger) + public UpdateTermHandler(IMapper mapper, IRepositoryWrapper repository, ILoggerService logger, IStringLocalizer stringLocalizerFailedToUpdate, IStringLocalizer stringLocalizerCannotConvertNull) { _mapper = mapper; _repository = repository; _logger = logger; + _stringLocalizerFailedToUpdate = stringLocalizerFailedToUpdate; + _stringLocalizerCannotConvertNull = stringLocalizerCannotConvertNull; } public async Task> Handle(UpdateTermCommand request, CancellationToken cancellationToken) @@ -24,7 +30,7 @@ public async Task> Handle(UpdateTermCommand request, CancellationTo var term = _mapper.Map(request.Term); if (term is null) { - const string errorMsg = "Cannot convert null to Term"; + string errorMsg = _stringLocalizerCannotConvertNull["CannotConvertNullToTerm"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -38,7 +44,7 @@ public async Task> Handle(UpdateTermCommand request, CancellationTo } else { - const string errorMsg = "Failed to update a term"; + string errorMsg = _stringLocalizerFailedToUpdate["FailedToUpdateTerm"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/Delete/DeleteTextHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/Delete/DeleteTextHandler.cs index 1bfcbdaa4..8c357bed5 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/Delete/DeleteTextHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/Delete/DeleteTextHandler.cs @@ -1,6 +1,8 @@ using FluentResults; using MediatR; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Text.Delete; @@ -9,11 +11,19 @@ public class DeleteTextHandler : IRequestHandler { private readonly IRepositoryWrapper _repositoryWrapper; private readonly ILoggerService _logger; + private readonly IStringLocalizer _stringLocalizerCannotFind; + private readonly IStringLocalizer _stringLocalizerFailedToDelete; - public DeleteTextHandler(IRepositoryWrapper repositoryWrapper, ILoggerService logger) + public DeleteTextHandler( + IRepositoryWrapper repositoryWrapper, + ILoggerService logger, + IStringLocalizer stringLocalizerFailedToDelete, + IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _logger = logger; + _stringLocalizerFailedToDelete = stringLocalizerFailedToDelete; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(DeleteTextCommand request, CancellationToken cancellationToken) @@ -22,7 +32,7 @@ public async Task> Handle(DeleteTextCommand request, CancellationTo if (text is null) { - string errorMsg = $"Cannot find a text with corresponding categoryId: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindTextWithCorrespondingCategoryId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -36,7 +46,7 @@ public async Task> Handle(DeleteTextCommand request, CancellationTo } else { - const string errorMsg = "Failed to delete a text"; + string errorMsg = _stringLocalizerFailedToDelete["FailedToDeleteText"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/GetAll/GetAllTextsHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/GetAll/GetAllTextsHandler.cs index 638fb7951..46d6a2b7c 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/GetAll/GetAllTextsHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/GetAll/GetAllTextsHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode.TextContent.Text; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.AdditionalContent.Coordinates; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -14,12 +16,14 @@ public class GetAllTextsHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllTextsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllTextsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetAllTextsQuery request, CancellationToken cancellationToken) @@ -28,7 +32,7 @@ public async Task>> Handle(GetAllTextsQuery request, if (texts is null) { - const string errorMsg = $"Cannot find any text"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyText"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/GetById/GetTextByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/GetById/GetTextByIdHandler.cs index 49a698ce4..45905607e 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/GetById/GetTextByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/GetById/GetTextByIdHandler.cs @@ -1,8 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode.TextContent.Text; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Text.GetById; @@ -12,12 +14,14 @@ public class GetTextByIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetTextByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetTextByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetTextByIdQuery request, CancellationToken cancellationToken) @@ -26,7 +30,7 @@ public async Task> Handle(GetTextByIdQuery request, Cancellation if (text is null) { - string errorMsg = $"Cannot find any text with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyTextWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/GetByStreetcodeId/GetTextByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/GetByStreetcodeId/GetTextByStreetcodeIdHandler.cs index df676cc1c..398eb72e0 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/GetByStreetcodeId/GetTextByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Streetcode/Text/GetByStreetcodeId/GetTextByStreetcodeIdHandler.cs @@ -1,11 +1,13 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Streetcode.TextContent.Text; using Streetcode.BLL.DTO.Transactions; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.Interfaces.Text; using Streetcode.BLL.MediatR.ResultVariations; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Streetcode.Text.GetByStreetcodeId; @@ -16,13 +18,15 @@ public class GetTextByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetTextByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ITextService textService, ILoggerService logger) + public GetTextByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ITextService textService, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _textService = textService; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetTextByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -35,7 +39,7 @@ public GetTextByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMappe if (await _repositoryWrapper.StreetcodeRepository .GetFirstOrDefaultAsync(s => s.Id == request.StreetcodeId) == null) { - string errorMsg = $"Cannot find a transaction link by a streetcode id: {request.StreetcodeId}, because such streetcode doesn`t exist"; + string errorMsg = _stringLocalizerCannotFind["CannotFindTransactionLinkByStreetcodeIdBecause", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Team/Delete/DeleteTeamHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Team/Delete/DeleteTeamHandler.cs index bcd1b302e..c35a949cb 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Team/Delete/DeleteTeamHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Team/Delete/DeleteTeamHandler.cs @@ -1,10 +1,12 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Partners; using Streetcode.BLL.DTO.Team; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.Partners.Delete; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Team.Delete @@ -14,12 +16,14 @@ public class DeleteTeamHandler : IRequestHandler _stringLocalizerNo; - public DeleteTeamHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public DeleteTeamHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerNo) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerNo = stringLocalizerNo; } public async Task> Handle(DeleteTeamQuery request, CancellationToken cancellationToken) @@ -27,7 +31,7 @@ public async Task> Handle(DeleteTeamQuery request, Cancell var team = await _repositoryWrapper.TeamRepository.GetFirstOrDefaultAsync(p => p.Id == request.id); if (team == null) { - const string errorMsg = "No team with such id"; + string errorMsg = _stringLocalizerNo["NoTeamWithSuchId"].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Team/GetAll/GetAllTeamHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Team/GetAll/GetAllTeamHandler.cs index 2b7009133..28f023c2b 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Team/GetAll/GetAllTeamHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Team/GetAll/GetAllTeamHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Team; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Team.GetAll @@ -13,12 +15,14 @@ public class GetAllTeamHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllTeamHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllTeamHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetAllTeamQuery request, CancellationToken cancellationToken) @@ -29,7 +33,7 @@ public async Task>> Handle(GetAllTeamQuery req if (team is null) { - const string errorMsg = $"Cannot find any team"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyTeam"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Team/GetAllMain/GetAllMainTeamHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Team/GetAllMain/GetAllMainTeamHandler.cs index 3fd1c1878..4df4d4648 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Team/GetAllMain/GetAllMainTeamHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Team/GetAllMain/GetAllMainTeamHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Team; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Team.GetAll @@ -13,12 +15,14 @@ public class GetAllMainTeamHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllMainTeamHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllMainTeamHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetAllMainTeamQuery request, CancellationToken cancellationToken) @@ -29,7 +33,7 @@ public async Task>> Handle(GetAllMainTeamQuery if (team is null) { - const string errorMsg = $"Cannot find any team"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyTeam"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Team/GetById/GetByIdTeamHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Team/GetById/GetByIdTeamHandler.cs index 5e3874919..b581e271b 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Team/GetById/GetByIdTeamHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Team/GetById/GetByIdTeamHandler.cs @@ -2,10 +2,12 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Partners; using Streetcode.BLL.DTO.Team; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.Partners.GetById; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Team.GetById @@ -15,12 +17,14 @@ public class GetByIdTeamHandler : IRequestHandler _stringLocalizerCannotFind; - public GetByIdTeamHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetByIdTeamHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetByIdTeamQuery request, CancellationToken cancellationToken) @@ -34,7 +38,7 @@ public async Task> Handle(GetByIdTeamQuery request, Cancel if (team is null) { - string errorMsg = $"Cannot find any team with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyTeamWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Team/Position/GetAll/GetAllPositionsHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Team/Position/GetAll/GetAllPositionsHandler.cs index 053342f0f..0309b013a 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Team/Position/GetAll/GetAllPositionsHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Team/Position/GetAll/GetAllPositionsHandler.cs @@ -2,9 +2,11 @@ using FluentResults; using MediatR; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Team; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.Team.GetAll; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Team.Position.GetAll @@ -14,12 +16,14 @@ public class GetAllPositionsHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllPositionsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllPositionsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetAllPositionsQuery request, CancellationToken cancellationToken) @@ -30,7 +34,7 @@ public async Task>> Handle(GetAllPositionsQuery if (positions is null) { - const string errorMsg = $"Cannot find any positions"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyPositions"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Team/TeamMembersLinks/Create/CreateTeamLinkHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Team/TeamMembersLinks/Create/CreateTeamLinkHandler.cs index 6ece4e08d..050323fcd 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Team/TeamMembersLinks/Create/CreateTeamLinkHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Team/TeamMembersLinks/Create/CreateTeamLinkHandler.cs @@ -1,9 +1,11 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Team; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.Team.Create; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Team.TeamMembersLinks.Create @@ -13,11 +15,23 @@ public class CreateTeamLinkHandler : IRequestHandler _stringLocalizerCannotConvert; + private readonly IStringLocalizer _stringLocalizerCannotCreate; + private readonly IStringLocalizer _stringLocalizerFailedToCreate; - public CreateTeamLinkHandler(IMapper mapper, IRepositoryWrapper repository, ILoggerService logger) + public CreateTeamLinkHandler( + IMapper mapper, + IRepositoryWrapper repository, + ILoggerService logger, + IStringLocalizer stringLocalizerCannotCreate, + IStringLocalizer stringLocalizerFailedToCreate, + IStringLocalizer stringLocalizerCannotConvert) { _mapper = mapper; _repository = repository; + _stringLocalizerCannotCreate = stringLocalizerCannotCreate; + _stringLocalizerFailedToCreate = stringLocalizerFailedToCreate; + _stringLocalizerCannotConvert = stringLocalizerCannotConvert; _logger = logger; } @@ -27,7 +41,7 @@ public async Task> Handle(CreateTeamLinkQuery request, if (teamMemberLink is null) { - const string errorMsg = "Cannot convert null to team link"; + string errorMsg = _stringLocalizerCannotConvert["CannotConvertNullToTeamLink"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -36,7 +50,7 @@ public async Task> Handle(CreateTeamLinkQuery request, if (createdTeamLink is null) { - const string errorMsg = "Cannot create team link"; + string errorMsg = _stringLocalizerCannotCreate["CannotCreateTeamLink"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -45,7 +59,7 @@ public async Task> Handle(CreateTeamLinkQuery request, if (!resultIsSuccess) { - const string errorMsg = "Failed to create a team"; + string errorMsg = _stringLocalizerFailedToCreate["FailedToCreateTeam"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } @@ -58,7 +72,7 @@ public async Task> Handle(CreateTeamLinkQuery request, } else { - const string errorMsg = "Failed to map created team link"; + string errorMsg = _stringLocalizerFailedToCreate["FailedToMapCreatedTeamLink"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Team/TeamMembersLinks/GetAll/GetAllTeamLinkHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Team/TeamMembersLinks/GetAll/GetAllTeamLinkHandler.cs index 8c4e2d0cf..a0e97ed78 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Team/TeamMembersLinks/GetAll/GetAllTeamLinkHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Team/TeamMembersLinks/GetAll/GetAllTeamLinkHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Team; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Team.TeamMembersLinks.GetAll @@ -13,12 +15,14 @@ public class GetAllTeamLinkHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllTeamLinkHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllTeamLinkHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetAllTeamLinkQuery request, CancellationToken cancellationToken) @@ -29,7 +33,7 @@ public async Task>> Handle(GetAllTeamLinkQ if (teamLinks is null) { - const string errorMsg = $"Cannot find any team links"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyTeamLinks"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Timeline/HistoricalContext/GetAll/GetAllHistoricalContextHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Timeline/HistoricalContext/GetAll/GetAllHistoricalContextHandler.cs index b63afe391..666849bfc 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Timeline/HistoricalContext/GetAll/GetAllHistoricalContextHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Timeline/HistoricalContext/GetAll/GetAllHistoricalContextHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Timeline; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Timeline.HistoricalContext.GetAll @@ -13,12 +15,14 @@ public class GetAllHistoricalContextHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllHistoricalContextHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllHistoricalContextHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetAllHistoricalContextQuery request, CancellationToken cancellationToken) @@ -29,7 +33,7 @@ public async Task>> Handle(GetAllHistor if (historicalContextItems is null) { - const string errorMsg = $"Cannot find any historical contexts"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyHistoricalContexts"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Timeline/TimelineItem/GetAll/GetAllTimelineItemsHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Timeline/TimelineItem/GetAll/GetAllTimelineItemsHandler.cs index b7acee631..082d319c3 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Timeline/TimelineItem/GetAll/GetAllTimelineItemsHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Timeline/TimelineItem/GetAll/GetAllTimelineItemsHandler.cs @@ -3,8 +3,10 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Timeline; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.AdditionalContent.Coordinates; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -15,12 +17,14 @@ public class GetAllTimelineItemsHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllTimelineItemsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllTimelineItemsHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetAllTimelineItemsQuery request, CancellationToken cancellationToken) @@ -33,7 +37,7 @@ public async Task>> Handle(GetAllTimelineIte if (timelineItems is null) { - const string errorMsg = $"Cannot find any timelineItem"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyTimelineItem"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Timeline/TimelineItem/GetById/GetTimelineItemByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Timeline/TimelineItem/GetById/GetTimelineItemByIdHandler.cs index 470b9e184..2c27e68c9 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Timeline/TimelineItem/GetById/GetTimelineItemByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Timeline/TimelineItem/GetById/GetTimelineItemByIdHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Timeline; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Timeline.TimelineItem.GetById; @@ -13,12 +15,14 @@ public class GetTimelineItemByIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetTimelineItemByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetTimelineItemByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetTimelineItemByIdQuery request, CancellationToken cancellationToken) @@ -32,7 +36,7 @@ public async Task> Handle(GetTimelineItemByIdQuery reque if (timelineItem is null) { - string errorMsg = $"Cannot find a timeline item with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindTimelineItemWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Timeline/TimelineItem/GetByStreetcodeId/GetTimelineItemsByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Timeline/TimelineItem/GetByStreetcodeId/GetTimelineItemsByStreetcodeIdHandler.cs index 490908ff9..aacbfd5c9 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Timeline/TimelineItem/GetByStreetcodeId/GetTimelineItemsByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Timeline/TimelineItem/GetByStreetcodeId/GetTimelineItemsByStreetcodeIdHandler.cs @@ -3,8 +3,10 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Timeline; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Timeline.TimelineItem.GetByStreetcodeId; @@ -14,12 +16,14 @@ public class GetTimelineItemsByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetTimelineItemsByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetTimelineItemsByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetTimelineItemsByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -33,7 +37,7 @@ public async Task>> Handle(GetTimelineItemsB if (timelineItems is null) { - string errorMsg = $"Cannot find any timeline item by the streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyTimelineItemByTheStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Toponyms/GetById/GetToponymByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Toponyms/GetById/GetToponymByIdHandler.cs index 0abd35c78..2b1712165 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Toponyms/GetById/GetToponymByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Toponyms/GetById/GetToponymByIdHandler.cs @@ -1,8 +1,10 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Toponyms; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Toponyms.GetById; @@ -12,12 +14,14 @@ public class GetToponymByIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetToponymByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetToponymByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetToponymByIdQuery request, CancellationToken cancellationToken) @@ -27,7 +31,7 @@ public async Task> Handle(GetToponymByIdQuery request, Cancel if (toponym is null) { - string errorMsg = $"Cannot find any toponym with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyToponymWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Toponyms/GetByStreetcodeId/GetToponymsByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Toponyms/GetByStreetcodeId/GetToponymsByStreetcodeIdHandler.cs index 01b3e97b7..4648bb9da 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Toponyms/GetByStreetcodeId/GetToponymsByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Toponyms/GetByStreetcodeId/GetToponymsByStreetcodeIdHandler.cs @@ -3,8 +3,10 @@ using MediatR; using Microsoft.EntityFrameworkCore; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Toponyms; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Toponyms.GetByStreetcodeId; @@ -14,12 +16,14 @@ public class GetToponymsByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetToponymsByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetToponymsByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetToponymsByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -33,7 +37,7 @@ public async Task>> Handle(GetToponymsByStreetcod toponyms.DistinctBy(x => x.StreetName); if (toponyms is null) { - string errorMsg = $"Cannot find any toponym by the streetcode id: {request.StreetcodeId}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyToponymByTheStreetcodeId", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Transactions/TransactionLink/GetAll/GetAllTransactLinksHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Transactions/TransactionLink/GetAll/GetAllTransactLinksHandler.cs index 5a9e40d56..21a86e952 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Transactions/TransactionLink/GetAll/GetAllTransactLinksHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Transactions/TransactionLink/GetAll/GetAllTransactLinksHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Transactions; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Transactions.TransactionLink.GetAll; @@ -13,12 +15,14 @@ public class GetAllTransactLinksHandler : IRequestHandler _stringLocalizerCannotFind; - public GetAllTransactLinksHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetAllTransactLinksHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task>> Handle(GetAllTransactLinksQuery request, CancellationToken cancellationToken) @@ -27,7 +31,7 @@ public async Task>> Handle(GetAllTransactLin if (transactLinks is null) { - const string errorMsg = $"Cannot find any transaction link"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyTransactionLink"].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Transactions/TransactionLink/GetById/GetTransactLinkByIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Transactions/TransactionLink/GetById/GetTransactLinkByIdHandler.cs index 3193e9203..79b70e514 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Transactions/TransactionLink/GetById/GetTransactLinkByIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Transactions/TransactionLink/GetById/GetTransactLinkByIdHandler.cs @@ -2,8 +2,10 @@ using FluentResults; using MediatR; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Transactions; using Streetcode.BLL.Interfaces.Logging; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Transactions.TransactionLink.GetById; @@ -13,12 +15,14 @@ public class GetTransactLinkByIdHandler : IRequestHandler _stringLocalizerCannotFind; - public GetTransactLinkByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger) + public GetTransactLinkByIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetTransactLinkByIdQuery request, CancellationToken cancellationToken) @@ -28,7 +32,7 @@ public async Task> Handle(GetTransactLinkByIdQuery reque if (transactLink is null) { - string errorMsg = $"Cannot find any transaction link with corresponding id: {request.Id}"; + string errorMsg = _stringLocalizerCannotFind["CannotFindAnyTransactionLinkWithCorrespondingId", request.Id].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Transactions/TransactionLink/GetByStreetcodeId/GetTransactLinkByStreetcodeIdHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Transactions/TransactionLink/GetByStreetcodeId/GetTransactLinkByStreetcodeIdHandler.cs index 5c03681b6..8ed185b07 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Transactions/TransactionLink/GetByStreetcodeId/GetTransactLinkByStreetcodeIdHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Transactions/TransactionLink/GetByStreetcodeId/GetTransactLinkByStreetcodeIdHandler.cs @@ -3,10 +3,12 @@ using MediatR; using Microsoft.AspNetCore.Rewrite; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Sources; using Streetcode.BLL.DTO.Transactions; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.ResultVariations; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; namespace Streetcode.BLL.MediatR.Transactions.TransactionLink.GetByStreetcodeId; @@ -16,11 +18,14 @@ public class GetTransactLinkByStreetcodeIdHandler : IRequestHandler _stringLocalizerCannotFind; + + public GetTransactLinkByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ILoggerService logger, IStringLocalizer stringLocalizerCannotFind) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _logger = logger; + _stringLocalizerCannotFind = stringLocalizerCannotFind; } public async Task> Handle(GetTransactLinkByStreetcodeIdQuery request, CancellationToken cancellationToken) @@ -33,7 +38,7 @@ public GetTransactLinkByStreetcodeIdHandler(IRepositoryWrapper repositoryWrapper if (await _repositoryWrapper.StreetcodeRepository .GetFirstOrDefaultAsync(s => s.Id == request.StreetcodeId) == null) { - string errorMsg = $"Cannot find a transaction link by a streetcode id: {request.StreetcodeId}, because such streetcode doesn`t exist"; + string errorMsg = _stringLocalizerCannotFind["CannotFindTransactionLinkByStreetcodeIdBecause", request.StreetcodeId].Value; _logger.LogError(request, errorMsg); return Result.Fail(new Error(errorMsg)); } diff --git a/Streetcode/Streetcode.BLL/MediatR/Users/Login/LoginHandler.cs b/Streetcode/Streetcode.BLL/MediatR/Users/Login/LoginHandler.cs index ed0ea972f..1baf1454f 100644 --- a/Streetcode/Streetcode.BLL/MediatR/Users/Login/LoginHandler.cs +++ b/Streetcode/Streetcode.BLL/MediatR/Users/Login/LoginHandler.cs @@ -2,6 +2,7 @@ using AutoMapper; using FluentResults; using MediatR; +using Microsoft.Extensions.Localization; using Streetcode.BLL.DTO.Users; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.Interfaces.Users; @@ -16,13 +17,15 @@ public class LoginHandler : IRequestHandler> private readonly IRepositoryWrapper _repositoryWrapper; private readonly ITokenService _tokenService; private readonly ILoggerService _logger; + private readonly IStringLocalizer _stringLocalizer; - public LoginHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ITokenService tokenService, ILoggerService logger) + public LoginHandler(IRepositoryWrapper repositoryWrapper, IMapper mapper, ITokenService tokenService, ILoggerService logger, IStringLocalizer stringLocalizer) { _repositoryWrapper = repositoryWrapper; _mapper = mapper; _tokenService = tokenService; _logger = logger; + _stringLocalizer = stringLocalizer; } public async Task> Handle(LoginQuery request, CancellationToken cancellationToken) @@ -41,7 +44,7 @@ public async Task> Handle(LoginQuery request, Cancellatio }); } - const string errorMsg = "User not found"; + string errorMsg = _stringLocalizer["UserNotFound"].Value; _logger.LogError(request, errorMsg); return Result.Fail(errorMsg); } diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Email.SendEmailHandler.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/MediatR.Email.SendEmailHandler.en-US.Designer.cs new file mode 100644 index 000000000..ac9f70b4b --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Email.SendEmailHandler.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class MediatR_Email_SendEmailHandler_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MediatR_Email_SendEmailHandler_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediatR.Email.SendEmailHandler", typeof(MediatR_Email_SendEmailHandler_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Email.SendEmailHandler.en-US.resx b/Streetcode/Streetcode.BLL/Resources/MediatR.Email.SendEmailHandler.en-US.resx new file mode 100644 index 000000000..efd5cc6a5 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Email.SendEmailHandler.en-US.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Failed to send email message + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Email.SendEmailHandler.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/MediatR.Email.SendEmailHandler.uk-UA.Designer.cs new file mode 100644 index 000000000..83a5cbac7 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Email.SendEmailHandler.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class MediatR_Email_SendEmailHandler_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MediatR_Email_SendEmailHandler_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediatR.Email.SendEmailHandler", typeof(MediatR_Email_SendEmailHandler_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Email.SendEmailHandler.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/MediatR.Email.SendEmailHandler.uk-UA.resx new file mode 100644 index 000000000..1469682eb --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Email.SendEmailHandler.uk-UA.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Не вдалося надіслати повідомлення електронної пошти + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Payment.CreateInvoiceHandler.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/MediatR.Payment.CreateInvoiceHandler.en-US.Designer.cs new file mode 100644 index 000000000..358f5bb25 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Payment.CreateInvoiceHandler.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class MediatR_Payment_CreateInvoiceHandler_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MediatR_Payment_CreateInvoiceHandler_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediatR.Payment.CreateInvoiceHandler", typeof(MediatR_Payment_CreateInvoiceHandler_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Payment.CreateInvoiceHandler.en-US.resx b/Streetcode/Streetcode.BLL/Resources/MediatR.Payment.CreateInvoiceHandler.en-US.resx new file mode 100644 index 000000000..f695c5c5a --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Payment.CreateInvoiceHandler.en-US.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Voluntary contribution to the statutory activities of the NGO «Historical Platform» + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Payment.CreateInvoiceHandler.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/MediatR.Payment.CreateInvoiceHandler.uk-UA.Designer.cs new file mode 100644 index 000000000..652a6818e --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Payment.CreateInvoiceHandler.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class MediatR_Payment_CreateInvoiceHandler_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MediatR_Payment_CreateInvoiceHandler_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediatR.Payment.CreateInvoiceHandler", typeof(MediatR_Payment_CreateInvoiceHandler_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Payment.CreateInvoiceHandler.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/MediatR.Payment.CreateInvoiceHandler.uk-UA.resx new file mode 100644 index 000000000..bace9f09e --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Payment.CreateInvoiceHandler.uk-UA.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Добровільний внесок на статутну діяльність ГО «Історична Платформа» + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.en-US.Designer.cs new file mode 100644 index 000000000..9780560d0 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class MediatR_Streetcode_RelatedTerm_Create_CreateRelatedTermHandler_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MediatR_Streetcode_RelatedTerm_Create_CreateRelatedTermHandler_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler", typeof(MediatR_Streetcode_RelatedTerm_Create_CreateRelatedTermHandler_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.en-US.resx b/Streetcode/Streetcode.BLL/Resources/MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.en-US.resx new file mode 100644 index 000000000..1271cd72f --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.en-US.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Word with this definition already exists + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.uk-UA.Designer.cs new file mode 100644 index 000000000..e227b6c41 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class MediatR_Streetcode_RelatedTerm_Create_CreateRelatedTermHandler_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MediatR_Streetcode_RelatedTerm_Create_CreateRelatedTermHandler_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler", typeof(MediatR_Streetcode_RelatedTerm_Create_CreateRelatedTermHandler_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.uk-UA.resx new file mode 100644 index 000000000..82111cb43 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.uk-UA.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Слово з цим визначенням вже існує + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Users.Login.LoginHandler.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/MediatR.Users.Login.LoginHandler.en-US.Designer.cs new file mode 100644 index 000000000..136343d9e --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Users.Login.LoginHandler.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class MediatR_Users_Login_LoginHandler_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MediatR_Users_Login_LoginHandler_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediatR.Users.Login.LoginHandler", typeof(MediatR_Users_Login_LoginHandler_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Users.Login.LoginHandler.en-US.resx b/Streetcode/Streetcode.BLL/Resources/MediatR.Users.Login.LoginHandler.en-US.resx new file mode 100644 index 000000000..c0c948d86 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Users.Login.LoginHandler.en-US.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + User not found + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Users.Login.LoginHandler.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/MediatR.Users.Login.LoginHandler.uk-UA.Designer.cs new file mode 100644 index 000000000..0b70de230 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Users.Login.LoginHandler.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class MediatR_Users_Login_LoginHandler_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal MediatR_Users_Login_LoginHandler_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MediatR.Users.Login.LoginHandler", typeof(MediatR_Users_Login_LoginHandler_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/MediatR.Users.Login.LoginHandler.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/MediatR.Users.Login.LoginHandler.uk-UA.resx new file mode 100644 index 000000000..9c24dd398 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/MediatR.Users.Login.LoginHandler.uk-UA.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Користувача не знайдено + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/Services.Users.TokenService.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/Services.Users.TokenService.en-US.Designer.cs new file mode 100644 index 000000000..a07c5919f --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/Services.Users.TokenService.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Services_Users_TokenService_en_UK { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Services_Users_TokenService_en_UK() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Services.Users.TokenService", typeof(Services_Users_TokenService_en_UK).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/Services.Users.TokenService.en-US.resx b/Streetcode/Streetcode.BLL/Resources/Services.Users.TokenService.en-US.resx new file mode 100644 index 000000000..7ab4d1280 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/Services.Users.TokenService.en-US.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Invalid Token + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/Services.Users.TokenService.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/Services.Users.TokenService.uk-UA.Designer.cs new file mode 100644 index 000000000..237321edd --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/Services.Users.TokenService.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Services_Users_TokenService_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Services_Users_TokenService_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Services.Users.TokenService", typeof(Services_Users_TokenService_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/Services.Users.TokenService.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/Services.Users.TokenService.uk-UA.resx new file mode 100644 index 000000000..c023ad2d9 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/Services.Users.TokenService.uk-UA.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Некоректний токен + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.AnErrorOccurredSharedResource.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.AnErrorOccurredSharedResource.en-US.Designer.cs new file mode 100644 index 000000000..9a83c7f51 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.AnErrorOccurredSharedResource.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_AnErrorOccurredSharedResource_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_AnErrorOccurredSharedResource_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.AnErrorOccurredSharedResource", typeof(SharedResource_AnErrorOccurredSharedResource_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.AnErrorOccurredSharedResource.en-US.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.AnErrorOccurredSharedResource.en-US.resx new file mode 100644 index 000000000..b0c80d987 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.AnErrorOccurredSharedResource.en-US.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + An error occurred while creating a streetcode. Message: {0} + + + An error occurred while updating a streetcode + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.AnErrorOccurredSharedResource.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.AnErrorOccurredSharedResource.uk-UA.Designer.cs new file mode 100644 index 000000000..c2352367a --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.AnErrorOccurredSharedResource.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_AnErrorOccurredSharedResource_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_AnErrorOccurredSharedResource_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.AnErrorOccurredSharedResource", typeof(SharedResource_AnErrorOccurredSharedResource_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.AnErrorOccurredSharedResource.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.AnErrorOccurredSharedResource.uk-UA.resx new file mode 100644 index 000000000..6d3550ead --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.AnErrorOccurredSharedResource.uk-UA.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Під час створення стріткоду сталася помилка. Повідомлення: {0} + + + Під час оновлення стріткоду сталася помилка + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotConvertNullSharedResource.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotConvertNullSharedResource.en-US.Designer.cs new file mode 100644 index 000000000..918076212 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotConvertNullSharedResource.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_CannotConvertNullSharedResource_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_CannotConvertNullSharedResource_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.CannotConvertNullSharedResource", typeof(SharedResource_CannotConvertNullSharedResource_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotConvertNullSharedResource.en-US.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotConvertNullSharedResource.en-US.resx new file mode 100644 index 000000000..7da222a51 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotConvertNullSharedResource.en-US.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cannot convert null to Category + + + Cannot convert null to Fact + + + Cannot convert null to news + + + Cannot convert null to streetcodeCoordinate + + + Cannot convert null to team link + + + Cannot convert null to Term + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotConvertNullSharedResource.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotConvertNullSharedResource.uk-UA.Designer.cs new file mode 100644 index 000000000..a0f20147c --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotConvertNullSharedResource.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_CannotConvertNullSharedResource_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_CannotConvertNullSharedResource_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.CannotConvertNullSharedResource.uk-UA", typeof(SharedResource_CannotConvertNullSharedResource_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotConvertNullSharedResource.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotConvertNullSharedResource.uk-UA.resx new file mode 100644 index 000000000..6e7950085 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotConvertNullSharedResource.uk-UA.resx @@ -0,0 +1,138 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Неможливо перетворити null у категорію + + + Не вдалося перетворити null на факт + + + Не вдалося перетворити null на новини + + + Неможливо перетворити null на streetcodeCoordinate + + + Неможливо перетворити null на командне посилання + + + Не вдалося перетворити null на термін + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotCreateSharedResource.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotCreateSharedResource.en-US.Designer.cs new file mode 100644 index 000000000..39e498127 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotCreateSharedResource.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_CannotCreateSharedResource_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_CannotCreateSharedResource_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.CannotCreateSharedResource", typeof(SharedResource_CannotCreateSharedResource_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotCreateSharedResource.en-US.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotCreateSharedResource.en-US.resx new file mode 100644 index 000000000..c6eedb601 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotCreateSharedResource.en-US.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cannot create DTOs for related words + + + Cannot create new related word for a term + + + Cannot create team link + + + Cannot create term + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotCreateSharedResource.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotCreateSharedResource.uk-UA.Designer.cs new file mode 100644 index 000000000..a0a7c98d5 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotCreateSharedResource.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_CannotCreateSharedResource_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_CannotCreateSharedResource_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.CannotCreateSharedResource", typeof(SharedResource_CannotCreateSharedResource_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotCreateSharedResource.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotCreateSharedResource.uk-UA.resx new file mode 100644 index 000000000..3d6601170 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotCreateSharedResource.uk-UA.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Не вдалося створити DTO для споріднених слів + + + Не вдалося створити нове споріднене слово для терміна + + + Неможливо створити посилання команди + + + Неможливо створити термін + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotFindSharedResource.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotFindSharedResource.en-US.Designer.cs new file mode 100644 index 000000000..4dcd5bd6f --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotFindSharedResource.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_CannotFindSharedResource_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_CannotFindSharedResource_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.CannotFindSharedResource", typeof(SharedResource_CannotFindSharedResource_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotFindSharedResource.en-US.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotFindSharedResource.en-US.resx new file mode 100644 index 000000000..a3b179211 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotFindSharedResource.en-US.resx @@ -0,0 +1,309 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cannot find an art with corresponding id: {0} + + + Cannot find an audio with corresponding categoryId: {0} + + + Cannot find an audio with corresponding id: {0} + + + Cannot find an audio with the corresponding streetcode id: {0} + + + Cannot find an image with corresponding categoryId: {0} + + + Cannot find an image with the corresponding streetcode id: {0} + + + Cannot find any arts + + + Cannot find any art with corresponding streetcode id: {0} + + + Cannot find any audios + + + Cannot find any fact + + + Cannot find any fact by the streetcode id: {0} + + + Cannot find any fact with corresponding id: {0} + + + Cannot find any historical contexts + + + Cannot find any image + + + Cannot find any partners + + + Cannot find any partner with corresponding id: {0} + + + Cannot find any positions + + + Cannot find any related figures by a streetcode id: {0} + + + Cannot find any source category with the streetcode id {0} + + + Cannot find any srcCategory by the corresponding id: {0} + + + Cannot find any streetcode with corresponding id: {0} + + + Cannot find any streetcode with corresponding index: {0} + + + Cannot find any streetcode with corresponding streetcode id: {0} + + + Cannot find any streetcode with corresponding tagid: {0} + + + Cannot find any subtitle by the streetcode id: {0} + + + Cannot find any subtitles + + + Cannot find any tag by the streetcode id: {0} + + + Cannot find any tag by the title: {0} + + + Cannot find any tags + + + Cannot find any team + + + Cannot find any team links + + + Cannot find any team with corresponding id: {0} + + + Cannot find any term + + + Cannot find any term with corresponding id: {0} + + + Cannot find any text + + + Cannot find any text with corresponding id: {0} + + + Cannot find any timelineItem + + + Cannot find any timeline item by the streetcode id: {0} + + + Cannot find any toponym by the streetcode id: {0} + + + Cannot find any toponym with corresponding id: {0} + + + Cannot find any transaction link + + + Cannot find any transaction link with corresponding id: {0} + + + Cannot find any video by the streetcode id: {0} + + + Cannot find any videos + + + Cannot find a category with corresponding categoryId: {0} + + + Cannot find coordinates by streetcodeId: {0} + + + Cannot find coordinate with corresponding categoryId: {0} + + + Cannot find a fact with corresponding categoryId: {0} + + + Cannot find an image with corresponding id: {0} + + + Cannot find a partners by a streetcode id: {0} + + + Cannot find record for qrId + + + Cannot find a related term with corresponding id: {0} + + + Cannot find a relation between streetcodes with corresponding ids: {0} & {1} + + + Cannot find streetcode by id + + + Cannot find streetcode by transliteration url: {0} + + + Cannot find a streetcode with corresponding categoryId: {0} + + + Cannot find a subtitle with corresponding id: {0} + + + Cannot find a Tag with corresponding id: {0} + + + Cannot find a text with corresponding categoryId: {0} + + + Cannot find a timeline item with corresponding id: {0} + + + Cannot find a transaction link by a streetcode id: {0} + + + Cannot find a transaction link by a streetcode id: {0}, because such streetcode doesn`t exist + + + Cannot find a video with corresponding id: {0} + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotFindSharedResource.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotFindSharedResource.uk-UA.Designer.cs new file mode 100644 index 000000000..0424869da --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotFindSharedResource.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_CannotFindSharedResource_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_CannotFindSharedResource_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.CannotFindSharedResource", typeof(SharedResource_CannotFindSharedResource_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotFindSharedResource.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotFindSharedResource.uk-UA.resx new file mode 100644 index 000000000..f11a2a130 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotFindSharedResource.uk-UA.resx @@ -0,0 +1,309 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Не вдалося знайти арт з відповідним ідентифікатором: {0} + + + Не вдалося знайти аудіо з відповідною CategoryId: {0} + + + Не вдалося знайти аудіо з відповідним ідентифікатором: {0} + + + Не вдалося знайти аудіо з відповідним ідентифікатором стріткоду: {0} + + + Не вдалося знайти зображення з відповідною CategoryId: {0} + + + Не вдалося знайти зображення з відповідним ідентифікатором стріткоду: {0} + + + Не вдалося знайти жодних артів + + + Не вдалося знайти жодного арту з відповідним ідентифікатором стріткоду: {0} + + + Не вдалося знайти жодного аудіо + + + Не вдалося знайти жодного факту + + + Не вдалося знайти жодного факту за ідентифікатором стріткоду: {0} + + + Не вдалося знайти жодного факту з відповідним ідентифікатором: {0} + + + Не вдалося знайти жодного історичного контексту + + + Не вдалося знайти жодного зображення + + + Не вдалося знайти партнерів + + + Не вдалося знайти партнера з відповідним ідентифікатором: {0} + + + Не вдалося знайти жодної позиції + + + Не вдалося знайти будь-які пов'язані цифри за ідентифікатором стріткоду: {0} + + + Не вдалося знайти жодної вихідної категорії з ідентифікатором стріткоду {0} + + + Не вдалося знайти жодної srcCategory за відповідним ідентифікатором: {0} + + + Не вдалося знайти жодний стріткод з відповідним ідентифікатором: {0} + + + Не вдалося знайти жодний стріткод з відповідним індексом: {0} + + + Не вдалося знайти жодний стріткод з відповідним ідентифікатором стріткоду: {0} + + + Не вдалося знайти жодний стріткод з відповідним TagId: {0} + + + Не вдалося знайти жодного субтитра за ідентифікатором стріткоду: {0} + + + Не вдалося знайти субтитри + + + Не вдалося знайти жодного тега за ідентифікатором стріткоду: {0} + + + Не вдалося знайти жодного тега за назвою: {0} + + + Не вдалося знайти жодних теґів + + + Не вдалося знайти жодної команди + + + Не вдалося знайти посилання команди + + + Не вдалося знайти жодної команди з відповідним ідентифікатором: {0} + + + Не вдалося знайти жодного терміна + + + Не вдалося знайти жодного терміна з відповідним ідентифікатором: {0} + + + Не вдалося знайти жодного тексту + + + Не вдалося знайти жодного тексту з відповідним ідентифікатором: {0} + + + Неможливо знайти жодного timelineItem + + + Не вдалося знайти жодного елемента часової шкали за ідентифікатором стріткоду: {0} + + + Не вдалося знайти топонім за ідентифікатором стріткоду: {0} + + + Не вдалося знайти жодного топоніма з відповідним ідентифікатором: {0} + + + Не вдалося знайти посилання на транзакцію + + + Не вдалося знайти жодного посилання на транзакцію з відповідним ідентифікатором: {0} + + + Не вдалося знайти відео за ідентифікатором стріткоду: {0} + + + Не вдалося знайти жодного відео + + + Не вдалося знайти категорію з відповідним CategoryId: {0} + + + Не вдалося знайти координати за стріткод ідентифікатором: {0} + + + Не вдалося знайти координату з відповідним CategoryId: {0} + + + Не вдалося знайти факт з відповідним CategoryId: {0} + + + Не вдалося знайти зображення з відповідним ідентифікатором: {0} + + + Не вдалося знайти партнерів за ідентифікатором стріткоду: {0} + + + Не вдалося знайти запис для Qr - ідентифікатора + + + Не вдалося знайти пов'язаний термін з відповідним ідентифікатором: {0} + + + Не вдалося знайти відношення між стріткодами з відповідними ідентифікаторами: {0} & {1} + + + Не вдалося знайти стріткод за id + + + Не вдалося знайти стріткод за адресою транслітерації: {0} + + + Не вдалося знайти стріткод з відповідною категорієюId: {0} + + + Не вдалося знайти підзаголовок з відповідним ідентифікатором: {0} + + + Не вдалося знайти мітку з відповідним ідентифікатором: {0} + + + Не вдалося знайти текст з відповідною CategoryId: {0} + + + Не вдалося знайти елемент часової шкали з відповідним ідентифікатором: {0} + + + Не вдалося знайти посилання на транзакцію за ідентифікатором стріткоду: {0} + + + Неможливо знайти посилання на транзакцію за ідентифікатором стріткоду: {0}, оскільки такого стріткоду не існує + + + Не вдалося знайти відео з відповідним ідентифікатором: {0} + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotGetSharedResource.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotGetSharedResource.en-US.Designer.cs new file mode 100644 index 000000000..3745bd5ba --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotGetSharedResource.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_CannotGetSharedResource_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_CannotGetSharedResource_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.CannotGetSharedResource", typeof(SharedResource_CannotGetSharedResource_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotGetSharedResource.en-US.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotGetSharedResource.en-US.resx new file mode 100644 index 000000000..639a0dd96 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotGetSharedResource.en-US.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cannot get records + + + Cannot get words by term id + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotGetSharedResource.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotGetSharedResource.uk-UA.Designer.cs new file mode 100644 index 000000000..1c36b16b3 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotGetSharedResource.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_CannotGetSharedResource_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_CannotGetSharedResource_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.CannotGetSharedResource", typeof(SharedResource_CannotGetSharedResource_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotGetSharedResource.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotGetSharedResource.uk-UA.resx new file mode 100644 index 000000000..e7f6a0bd4 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotGetSharedResource.uk-UA.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Не вдається отримати записи + + + Не вдається отримати слова за ідентифікатором терміна + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotMapSharedResource.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotMapSharedResource.en-US.Designer.cs new file mode 100644 index 000000000..64374cc22 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotMapSharedResource.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_CannotMapSharedResource_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_CannotMapSharedResource_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.CannotMapSharedResource", typeof(SharedResource_CannotMapSharedResource_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotMapSharedResource.en-US.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotMapSharedResource.en-US.resx new file mode 100644 index 000000000..09993238b --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotMapSharedResource.en-US.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cannot map entity + + + Cannot map record + + + Cannot map records + + + Cannot map streetcode to shortDTO + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotMapSharedResource.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotMapSharedResource.uk-UA.Designer.cs new file mode 100644 index 000000000..bed117e7c --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotMapSharedResource.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_CannotMapSharedResource_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_CannotMapSharedResource_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.CannotMapSharedResource", typeof(SharedResource_CannotMapSharedResource_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotMapSharedResource.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotMapSharedResource.uk-UA.resx new file mode 100644 index 000000000..4560f1e65 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotMapSharedResource.uk-UA.resx @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Неможливо зіставити сутність + + + Неможливо зіставити запис + + + Неможливо зіставити записи + + + Неможливо прив'язати стріткод до shortDTO + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotSaveSharedResource.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotSaveSharedResource.en-US.Designer.cs new file mode 100644 index 000000000..429fffbfb --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotSaveSharedResource.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_CannotSaveSharedResource_en_US1 { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_CannotSaveSharedResource_en_US1() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.CannotSaveSharedResource", typeof(SharedResource_CannotSaveSharedResource_en_US1).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotSaveSharedResource.en-US.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotSaveSharedResource.en-US.resx new file mode 100644 index 000000000..941846d69 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotSaveSharedResource.en-US.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Cannot save changes in the database after related word creation + + + Cannot save created record + + + Cannot save the data + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotSaveSharedResource.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotSaveSharedResource.uk-UA.Designer.cs new file mode 100644 index 000000000..dc659a22a --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotSaveSharedResource.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_CannotSaveSharedResource_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_CannotSaveSharedResource_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.CannotSaveSharedResource", typeof(SharedResource_CannotSaveSharedResource_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotSaveSharedResource.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotSaveSharedResource.uk-UA.resx new file mode 100644 index 000000000..705fc4097 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.CannotSaveSharedResource.uk-UA.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Не вдалося зберегти зміни в базі даних після створення відповідного слова + + + Не вдалося зберегти створений запис + + + Не вдалося зберегти дані + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToCreateSharedResource.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToCreateSharedResource.en-US.Designer.cs new file mode 100644 index 000000000..53a9935e3 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToCreateSharedResource.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_FailedToCreateSharedResource_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_FailedToCreateSharedResource_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.FailedToCreateSharedResource", typeof(SharedResource_FailedToCreateSharedResource_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToCreateSharedResource.en-US.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToCreateSharedResource.en-US.resx new file mode 100644 index 000000000..37f537f6a --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToCreateSharedResource.en-US.resx @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Failed to create an image + + + Failed to create an audio + + + Failed to create a category + + + Failed to create a fact + + + Failed to create a news + + + Failed to create a relation + + + Failed to create a streetcode + + + Failed to create a streetcodeCoordinate + + + Failed to create a team + + + Failed to create a term + + + Failed to map created team link + + + Failed to map created term + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToCreateSharedResource.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToCreateSharedResource.uk-UA.Designer.cs new file mode 100644 index 000000000..9ba0b035a --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToCreateSharedResource.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_FailedToCreateSharedResource_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_FailedToCreateSharedResource_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.FailedToCreateSharedResource", typeof(SharedResource_FailedToCreateSharedResource_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToCreateSharedResource.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToCreateSharedResource.uk-UA.resx new file mode 100644 index 000000000..7230b58d6 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToCreateSharedResource.uk-UA.resx @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Не вдалося створити зображення + + + Не вдалося створити аудіо + + + Не вдалося створити категорію + + + Не вдалося створити факт + + + Не вдалося створити новину + + + Не вдалося створити відношення + + + Не вдалося створити стріткод + + + Не вдалося створити координату стріткоду + + + Не вдалося створити команду + + + Не вдалося створити термін + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToDeleteSharedResource.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToDeleteSharedResource.en-US.Designer.cs new file mode 100644 index 000000000..0a7c237c2 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToDeleteSharedResource.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_FailedToDeleteSharedResource_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_FailedToDeleteSharedResource_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.FailedToDeleteSharedResource.en-US", typeof(SharedResource_FailedToDeleteSharedResource_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToDeleteSharedResource.en-US.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToDeleteSharedResource.en-US.resx new file mode 100644 index 000000000..da12e1853 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToDeleteSharedResource.en-US.resx @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Failed to delete an audio + + + Failed to delete a category + + + Failed to delete a fact + + + Failed to delete an image + + + Failed to delete news + + + Failed to delete a related term + + + Failed to delete a relation + + + Failed to delete a streetcode + + + Failed to delete a streetcodeCoordinate + + + Failed to delete a term + + + Failed to delete a text + + + Failed to delete the record + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToDeleteSharedResource.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToDeleteSharedResource.uk-UA.Designer.cs new file mode 100644 index 000000000..4232f96a6 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToDeleteSharedResource.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_FailedToDeleteSharedResource_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_FailedToDeleteSharedResource_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.FailedToDeleteSharedResource", typeof(SharedResource_FailedToDeleteSharedResource_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToDeleteSharedResource.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToDeleteSharedResource.uk-UA.resx new file mode 100644 index 000000000..6d3c0e188 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToDeleteSharedResource.uk-UA.resx @@ -0,0 +1,156 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Не вдалося видалити аудіо + + + Не вдалося видалити категорію + + + Не вдалося видалити факт + + + Не вдалося видалити зображення + + + Не вдалося видалити новини + + + Не вдалося вилучити пов'язаний термін + + + Не вдалося видалити зв'язки + + + Не вдалося вилучити стріткод + + + Не вдалося видалити коородинату стріткоду + + + Не вдалося вилучити термін + + + Не вдалося вилучити текст + + + Не вдалося вилучити запис + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToUpdateSharedResource.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToUpdateSharedResource.en-US.Designer.cs new file mode 100644 index 000000000..041acb915 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToUpdateSharedResource.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_FailedToUpdateSharedResource_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_FailedToUpdateSharedResource_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.FailedToUpdateSharedResource", typeof(SharedResource_FailedToUpdateSharedResource_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToUpdateSharedResource.en-US.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToUpdateSharedResource.en-US.resx new file mode 100644 index 000000000..bc62549ad --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToUpdateSharedResource.en-US.resx @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Failed to change status of streetcode to deleted + + + Failed to update an audio + + + Failed to update a category + + + Failed to update a fact + + + Failed to update an image + + + Failed to update news + + + Failed to update status of streetcode + + + Failed to update a streetcode + + + Failed to update a term + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToUpdateSharedResource.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToUpdateSharedResource.uk-UA.Designer.cs new file mode 100644 index 000000000..886788783 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToUpdateSharedResource.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_FailedToUpdateSharedResource_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_FailedToUpdateSharedResource_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.FailedToUpdateSharedResource", typeof(SharedResource_FailedToUpdateSharedResource_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToUpdateSharedResource.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToUpdateSharedResource.uk-UA.resx new file mode 100644 index 000000000..eccf38ed1 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.FailedToUpdateSharedResource.uk-UA.resx @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Не вдалося змінити статус стріткоду на видалений + + + Не вдалося оновити аудіо + + + Не вдалося оновити категорію + + + Не вдалося оновити факт + + + Не вдалося оновити зображення + + + Не вдалося оновити новини + + + Не вдалося оновити статус стріткоду + + + Не вдалося оновити стріткод + + + Не вдалося оновити термін + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.NoSharedResource.en-US.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.NoSharedResource.en-US.Designer.cs new file mode 100644 index 000000000..7ede0f457 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.NoSharedResource.en-US.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_NoSharedResource_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_NoSharedResource_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.NoSharedResource", typeof(SharedResource_NoSharedResource_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.NoSharedResource.en-US.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.NoSharedResource.en-US.resx new file mode 100644 index 000000000..5e08be28e --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.NoSharedResource.en-US.resx @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + No categories + + + No created record + + + No existing streetcode with id: {0} + + + No mapped created record + + + No mapped record + + + No news by entered Id - {0} + + + No news by entered Url - {0} + + + No news found by entered Id - {0} + + + No news in the database + + + No partner with such id + + + No streetcode content exist + + + No streetcodes exist now + + + No such streetcode with id: {0} + + + No team with such id + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.NoSharedResource.uk-UA.Designer.cs b/Streetcode/Streetcode.BLL/Resources/SharedResource.NoSharedResource.uk-UA.Designer.cs new file mode 100644 index 000000000..63afcd28c --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.NoSharedResource.uk-UA.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.BLL.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class SharedResource_NoSharedResource_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal SharedResource_NoSharedResource_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SharedResource.NoSharedResource", typeof(SharedResource_NoSharedResource_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Streetcode/Streetcode.BLL/Resources/SharedResource.NoSharedResource.uk-UA.resx b/Streetcode/Streetcode.BLL/Resources/SharedResource.NoSharedResource.uk-UA.resx new file mode 100644 index 000000000..196898071 --- /dev/null +++ b/Streetcode/Streetcode.BLL/Resources/SharedResource.NoSharedResource.uk-UA.resx @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Немає категорій + + + Не створено запису + + + Немає існуючого стріткоду з ідентифікатором: {0} + + + Жодного зіставленого створенного запису + + + Жодного зіставленого запису + + + Немає новин за введеним ідентифікатором - {0} + + + Немає новин за введеним Url - {0} + + + Не знайдено жодної новини введеним ідентифікатором - {0} + + + Жодних новин у базі даних + + + Жодного партнера з таким id + + + Жодного контенту стріткоду не існує + + + Жодних стріткодів зараз не існує + + + Жодного стріткоду з ідентифікатором: {0} + + + Жодної команди з таким ідентифікатором + + \ No newline at end of file diff --git a/Streetcode/Streetcode.BLL/Services/Users/TokenService.cs b/Streetcode/Streetcode.BLL/Services/Users/TokenService.cs index 3ca5746db..eab886596 100644 --- a/Streetcode/Streetcode.BLL/Services/Users/TokenService.cs +++ b/Streetcode/Streetcode.BLL/Services/Users/TokenService.cs @@ -2,6 +2,7 @@ using System.Security.Claims; using System.Text; using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Localization; using Microsoft.IdentityModel.Tokens; using Streetcode.BLL.Interfaces.Users; using Streetcode.DAL.Entities.Users; @@ -15,14 +16,16 @@ public sealed class TokenService : ITokenService private readonly string _jwtIssuer; private readonly string _jwtAudience; private readonly string _jwtKey; + private readonly IStringLocalizer _stringLocalizer; - public TokenService(IConfiguration configuration) + public TokenService(IConfiguration configuration, IStringLocalizer stringLocalizer) { _jwtIssuer = configuration["Jwt:Issuer"]; _jwtAudience = configuration["Jwt:Audience"]; _jwtKey = configuration["Jwt:Key"]; _symmetricSecurityKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_jwtKey)); _signInCridentials = new SigningCredentials(_symmetricSecurityKey, SecurityAlgorithms.HmacSha256); + _stringLocalizer = stringLocalizer; } public JwtSecurityToken GenerateJWTToken(User user) @@ -84,7 +87,7 @@ private ClaimsPrincipal GetPrinciplesFromToken(string token) var jwtSecurityToken = securityToken as JwtSecurityToken; if (jwtSecurityToken == null || !jwtSecurityToken.Header.Alg.Equals(SecurityAlgorithms.HmacSha256, StringComparison.InvariantCultureIgnoreCase)) { - throw new SecurityTokenException("Invalid token"); + throw new SecurityTokenException(_stringLocalizer["InvalidToken"].Value); } return principal; diff --git a/Streetcode/Streetcode.BLL/SharedResource/AnErrorOccurredSharedResource.cs b/Streetcode/Streetcode.BLL/SharedResource/AnErrorOccurredSharedResource.cs new file mode 100644 index 000000000..1c4b204ae --- /dev/null +++ b/Streetcode/Streetcode.BLL/SharedResource/AnErrorOccurredSharedResource.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Streetcode.BLL.SharedResource +{ + public class AnErrorOccurredSharedResource + { + } +} diff --git a/Streetcode/Streetcode.BLL/SharedResource/CannotConvertNullSharedResource.cs b/Streetcode/Streetcode.BLL/SharedResource/CannotConvertNullSharedResource.cs new file mode 100644 index 000000000..5fa779f9a --- /dev/null +++ b/Streetcode/Streetcode.BLL/SharedResource/CannotConvertNullSharedResource.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Streetcode.BLL.SharedResource +{ + public class CannotConvertNullSharedResource + { + } +} diff --git a/Streetcode/Streetcode.BLL/SharedResource/CannotCreateSharedResource.cs b/Streetcode/Streetcode.BLL/SharedResource/CannotCreateSharedResource.cs new file mode 100644 index 000000000..05c326fe7 --- /dev/null +++ b/Streetcode/Streetcode.BLL/SharedResource/CannotCreateSharedResource.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Streetcode.BLL.SharedResource +{ + public class CannotCreateSharedResource + { + } +} diff --git a/Streetcode/Streetcode.BLL/SharedResource/CannotFindSharedResource.cs b/Streetcode/Streetcode.BLL/SharedResource/CannotFindSharedResource.cs new file mode 100644 index 000000000..7e9432abc --- /dev/null +++ b/Streetcode/Streetcode.BLL/SharedResource/CannotFindSharedResource.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Streetcode.BLL.SharedResource +{ + public class CannotFindSharedResource + { + } +} diff --git a/Streetcode/Streetcode.BLL/SharedResource/CannotGetSharedResource.cs b/Streetcode/Streetcode.BLL/SharedResource/CannotGetSharedResource.cs new file mode 100644 index 000000000..38f82c7e8 --- /dev/null +++ b/Streetcode/Streetcode.BLL/SharedResource/CannotGetSharedResource.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Streetcode.BLL.SharedResource +{ + public class CannotGetSharedResource + { + } +} diff --git a/Streetcode/Streetcode.BLL/SharedResource/CannotMapSharedResource.cs b/Streetcode/Streetcode.BLL/SharedResource/CannotMapSharedResource.cs new file mode 100644 index 000000000..0c8e22f3e --- /dev/null +++ b/Streetcode/Streetcode.BLL/SharedResource/CannotMapSharedResource.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Streetcode.BLL.SharedResource +{ + public class CannotMapSharedResource + { + } +} diff --git a/Streetcode/Streetcode.BLL/SharedResource/CannotSaveSharedResource.cs b/Streetcode/Streetcode.BLL/SharedResource/CannotSaveSharedResource.cs new file mode 100644 index 000000000..63a367661 --- /dev/null +++ b/Streetcode/Streetcode.BLL/SharedResource/CannotSaveSharedResource.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Streetcode.BLL.SharedResource +{ + public class CannotSaveSharedResource + { + } +} diff --git a/Streetcode/Streetcode.BLL/SharedResource/FailedToCreateSharedResource.cs b/Streetcode/Streetcode.BLL/SharedResource/FailedToCreateSharedResource.cs new file mode 100644 index 000000000..98d7d4d78 --- /dev/null +++ b/Streetcode/Streetcode.BLL/SharedResource/FailedToCreateSharedResource.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Streetcode.BLL.SharedResource +{ + public class FailedToCreateSharedResource + { + } +} diff --git a/Streetcode/Streetcode.BLL/SharedResource/FailedToDeleteSharedResource.cs b/Streetcode/Streetcode.BLL/SharedResource/FailedToDeleteSharedResource.cs new file mode 100644 index 000000000..a4fa6e658 --- /dev/null +++ b/Streetcode/Streetcode.BLL/SharedResource/FailedToDeleteSharedResource.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Streetcode.BLL.SharedResource +{ + public class FailedToDeleteSharedResource + { + } +} diff --git a/Streetcode/Streetcode.BLL/SharedResource/FailedToUpdateSharedResource.cs b/Streetcode/Streetcode.BLL/SharedResource/FailedToUpdateSharedResource.cs new file mode 100644 index 000000000..ac7a5b317 --- /dev/null +++ b/Streetcode/Streetcode.BLL/SharedResource/FailedToUpdateSharedResource.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Streetcode.BLL.SharedResource +{ + public class FailedToUpdateSharedResource + { + } +} diff --git a/Streetcode/Streetcode.BLL/SharedResource/NoSharedResource.cs b/Streetcode/Streetcode.BLL/SharedResource/NoSharedResource.cs new file mode 100644 index 000000000..cc668ea8c --- /dev/null +++ b/Streetcode/Streetcode.BLL/SharedResource/NoSharedResource.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Streetcode.BLL.SharedResource +{ + public class NoSharedResource + { + } +} diff --git a/Streetcode/Streetcode.BLL/Streetcode.BLL.csproj b/Streetcode/Streetcode.BLL/Streetcode.BLL.csproj index 652436a04..f66b7467c 100644 --- a/Streetcode/Streetcode.BLL/Streetcode.BLL.csproj +++ b/Streetcode/Streetcode.BLL/Streetcode.BLL.csproj @@ -1,7 +1,7 @@  - net6.0 + net6.0 enable enable ../settings.ruleset @@ -43,4 +43,298 @@ + + + True + True + MediatR.Email.SendEmailHandler.en-US.resx + + + True + True + MediatR.Email.SendEmailHandler.uk-UA.resx + + + True + True + MediatR.Payment.CreateInvoiceHandler.en-US.resx + + + True + True + MediatR.Payment.CreateInvoiceHandler.uk-UA.resx + + + True + True + MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.en-US.resx + + + True + True + MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.uk-UA.resx + + + True + True + MediatR.Users.Login.LoginHandler.en-US.resx + + + True + True + MediatR.Users.Login.LoginHandler.uk-UA.resx + + + True + True + Services.Users.TokenService.en-UK.resx + + + True + True + Services.Users.TokenService.uk-UA.resx + + + True + True + SharedResource.AnErrorOccurredSharedResource.en-US.resx + + + True + True + SharedResource.AnErrorOccurredSharedResource.uk-UA.resx + + + True + True + SharedResource.CannotConvertNullSharedResource.en-US.resx + + + True + True + SharedResource.CannotConvertNullSharedResource.uk-UA.resx + + + True + True + SharedResource.CannotCreateSharedResource.en-US.resx + + + True + True + SharedResource.CannotCreateSharedResource.uk-UA.resx + + + True + True + SharedResource.CannotFindSharedResource.en-US.resx + + + True + True + SharedResource.CannotFindSharedResource.uk-UA.resx + + + True + True + SharedResource.CannotGetSharedResource.en-US.resx + + + True + True + SharedResource.CannotGetSharedResource.uk-UA.resx + + + True + True + SharedResource.CannotMapSharedResource.en-US.resx + + + True + True + SharedResource.CannotMapSharedResource.uk-UA.resx + + + True + True + SharedResource.CannotSaveSharedResource.uk-UA.resx + + + True + True + SharedResource.CannotSaveSharedResource.en-US.resx + + + True + True + SharedResource.FailedToCreateSharedResource.en-US.resx + + + True + True + SharedResource.FailedToCreateSharedResource.uk-UA.resx + + + True + True + SharedResource.FailedToDeleteSharedResource.en-US.resx + + + True + True + SharedResource.FailedToDeleteSharedResource.uk-UA.resx + + + True + True + SharedResource.FailedToUpdateSharedResource.en-US.resx + + + True + True + SharedResource.FailedToUpdateSharedResource.uk-UA.resx + + + True + True + SharedResource.NoSharedResource.en-US.resx + + + True + True + SharedResource.NoSharedResource.uk-UA.resx + + + + + + ResXFileCodeGenerator + MediatR.Email.SendEmailHandler.en-US.Designer.cs + + + ResXFileCodeGenerator + MediatR.Email.SendEmailHandler.uk-UA.Designer.cs + + + ResXFileCodeGenerator + MediatR.Payment.CreateInvoiceHandler.en-US.Designer.cs + + + ResXFileCodeGenerator + MediatR.Payment.CreateInvoiceHandler.uk-UA.Designer.cs + + + ResXFileCodeGenerator + MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.en-US.Designer.cs + + + ResXFileCodeGenerator + MediatR.Streetcode.RelatedTerm.Create.CreateRelatedTermHandler.uk-UA.Designer.cs + + + ResXFileCodeGenerator + MediatR.Users.Login.LoginHandler.en-US.Designer.cs + + + ResXFileCodeGenerator + MediatR.Users.Login.LoginHandler.uk-UA.Designer.cs + + + ResXFileCodeGenerator + Services.Users.TokenService.en-UK.Designer.cs + + + ResXFileCodeGenerator + Services.Users.TokenService.uk-UA.Designer.cs + + + ResXFileCodeGenerator + SharedResource.AnErrorOccurredSharedResource.en-US.Designer.cs + + + ResXFileCodeGenerator + SharedResource.AnErrorOccurredSharedResource.uk-UA.Designer.cs + + + ResXFileCodeGenerator + SharedResource.CannotConvertNullSharedResource.en-US.Designer.cs + + + ResXFileCodeGenerator + SharedResource.CannotConvertNullSharedResource.uk-UA.Designer.cs + + + ResXFileCodeGenerator + SharedResource.CannotCreateSharedResource.en-US.Designer.cs + + + ResXFileCodeGenerator + SharedResource.CannotCreateSharedResource.uk-UA.Designer.cs + + + ResXFileCodeGenerator + SharedResource.CannotFindSharedResource.en-US.Designer.cs + + + ResXFileCodeGenerator + SharedResource.CannotFindSharedResource.uk-UA.Designer.cs + + + ResXFileCodeGenerator + SharedResource.CannotGetSharedResource.en-US.Designer.cs + + + ResXFileCodeGenerator + SharedResource.CannotGetSharedResource.uk-UA.Designer.cs + + + ResXFileCodeGenerator + SharedResource.CannotMapSharedResource.en-US.Designer.cs + + + ResXFileCodeGenerator + SharedResource.CannotMapSharedResource.uk-UA.Designer.cs + + + ResXFileCodeGenerator + SharedResource.CannotSaveSharedResource.en-US.Designer.cs + + + ResXFileCodeGenerator + SharedResource.CannotSaveSharedResource.uk-UA.Designer.cs + + + ResXFileCodeGenerator + SharedResource.FailedToCreateSharedResource.en-US.Designer.cs + + + ResXFileCodeGenerator + SharedResource.FailedToCreateSharedResource.uk-UA.Designer.cs + + + ResXFileCodeGenerator + SharedResource.FailedToDeleteSharedResource.en-US.Designer.cs + + + ResXFileCodeGenerator + SharedResource.FailedToDeleteSharedResource.uk-UA.Designer.cs + + + ResXFileCodeGenerator + SharedResource.FailedToUpdateSharedResource.en-US.Designer.cs + + + ResXFileCodeGenerator + SharedResource.FailedToUpdateSharedResource.uk-UA.Designer.cs + + + ResXFileCodeGenerator + SharedResource.NoSharedResource.en-US.Designer.cs + + + ResXFileCodeGenerator + SharedResource.NoSharedResource.uk-UA.Designer.cs + + + diff --git a/Streetcode/Streetcode.Resources/Streetcode.Resources.csproj b/Streetcode/Streetcode.Resources/Streetcode.Resources.csproj new file mode 100644 index 000000000..9ad2a07d3 --- /dev/null +++ b/Streetcode/Streetcode.Resources/Streetcode.Resources.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/Streetcode/Streetcode.WebApi/Controllers/BaseApiController.cs b/Streetcode/Streetcode.WebApi/Controllers/BaseApiController.cs index 8e3339eca..09c850a7a 100644 --- a/Streetcode/Streetcode.WebApi/Controllers/BaseApiController.cs +++ b/Streetcode/Streetcode.WebApi/Controllers/BaseApiController.cs @@ -1,6 +1,8 @@ -using FluentResults; +using System.Resources; +using FluentResults; using MediatR; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Localization; using Streetcode.BLL.MediatR.ResultVariations; namespace Streetcode.WebApi.Controllers; @@ -9,11 +11,19 @@ namespace Streetcode.WebApi.Controllers; [Route("api/[controller]/[action]")] public class BaseApiController : ControllerBase { + private readonly IStringLocalizer _stringLocalizer; private IMediator? _mediator; + public BaseApiController(IStringLocalizer stringLocalizer) + { + _stringLocalizer = stringLocalizer; + } + + public BaseApiController() + { + } protected IMediator Mediator => _mediator ??= HttpContext.RequestServices.GetService()!; - protected ActionResult HandleResult(Result result) { if (result.IsSuccess) @@ -24,7 +34,15 @@ protected ActionResult HandleResult(Result result) } return (result.Value is null) ? - NotFound("Found result matching null") : Ok(result.Value); + NotFound(_stringLocalizer["NotFound"].Value) : Ok(result.Value); + } + + foreach (var item in result.Reasons) + { + if (item.Message.Contains(_stringLocalizer?["NotFound"].Value)) + { + return Ok(); + } } return BadRequest(result.Reasons); diff --git a/Streetcode/Streetcode.WebApi/Program.cs b/Streetcode/Streetcode.WebApi/Program.cs index be41c8300..c9cf8bc44 100644 --- a/Streetcode/Streetcode.WebApi/Program.cs +++ b/Streetcode/Streetcode.WebApi/Program.cs @@ -1,12 +1,16 @@ +using System.Globalization; using AspNetCoreRateLimit; using Hangfire; using Streetcode.BLL.Services.BlobStorageService; using Streetcode.WebApi.Extensions; using Streetcode.WebApi.Utils; +using Microsoft.AspNetCore.Localization; var builder = WebApplication.CreateBuilder(args); + builder.Host.ConfigureApplication(); +builder.Services.AddLocalization(option => option.ResourcesPath = "Resources"); builder.Services.AddApplicationServices(builder.Configuration); builder.Services.AddSwaggerServices(); builder.Services.AddCustomServices(); @@ -16,7 +20,18 @@ builder.Services.ConfigureSerilog(builder); builder.Services.ConfigureRateLimitMiddleware(builder); var app = builder.Build(); - +var supportedCulture = new[] +{ + new CultureInfo("en-US"), + new CultureInfo("uk-UA") +}; +app.UseRequestLocalization(new RequestLocalizationOptions +{ + DefaultRequestCulture = new RequestCulture("uk-UA"), + SupportedCultures = supportedCulture, + SupportedUICultures = supportedCulture, + ApplyCurrentCultureToResponseHeaders = true +}); if (app.Environment.EnvironmentName == "Local") { app.UseSwagger(); @@ -32,7 +47,6 @@ app.UseCors(); app.UseHttpsRedirection(); app.UseRouting(); - app.UseAuthentication(); app.UseAuthorization(); diff --git a/Streetcode/Streetcode.WebApi/Resources/Controllers.BaseApiController.en-US.Designer.cs b/Streetcode/Streetcode.WebApi/Resources/Controllers.BaseApiController.en-US.Designer.cs new file mode 100644 index 000000000..eebce2ce1 --- /dev/null +++ b/Streetcode/Streetcode.WebApi/Resources/Controllers.BaseApiController.en-US.Designer.cs @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Controllers_BaseApiController_en_US { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Controllers_BaseApiController_en_US() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Controllers.BaseApiController", typeof(Controllers_BaseApiController_en_US).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Found result matching null. + /// + internal static string NotFound { + get { + return ResourceManager.GetString("NotFound", resourceCulture); + } + } + } +} diff --git a/Streetcode/Streetcode.WebApi/Resources/Controllers.BaseApiController.en-US.resx b/Streetcode/Streetcode.WebApi/Resources/Controllers.BaseApiController.en-US.resx new file mode 100644 index 000000000..976a6066b --- /dev/null +++ b/Streetcode/Streetcode.WebApi/Resources/Controllers.BaseApiController.en-US.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Found result matching null + + + + + \ No newline at end of file diff --git a/Streetcode/Streetcode.WebApi/Resources/Controllers.BaseApiController.uk-UA.Designer.cs b/Streetcode/Streetcode.WebApi/Resources/Controllers.BaseApiController.uk-UA.Designer.cs new file mode 100644 index 000000000..0bb9d7f8b --- /dev/null +++ b/Streetcode/Streetcode.WebApi/Resources/Controllers.BaseApiController.uk-UA.Designer.cs @@ -0,0 +1,72 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Streetcode.Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Controllers_BaseApiController_uk_UA { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Controllers_BaseApiController_uk_UA() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Controllers.BaseApiController", typeof(Controllers_BaseApiController_uk_UA).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Знайдено результат, що відповідає null. + /// + internal static string NotFound { + get { + return ResourceManager.GetString("NotFound", resourceCulture); + } + } + } +} diff --git a/Streetcode/Streetcode.WebApi/Resources/Controllers.BaseApiController.uk-UA.resx b/Streetcode/Streetcode.WebApi/Resources/Controllers.BaseApiController.uk-UA.resx new file mode 100644 index 000000000..f86215055 --- /dev/null +++ b/Streetcode/Streetcode.WebApi/Resources/Controllers.BaseApiController.uk-UA.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Знайдено результат, що відповідає null + + \ No newline at end of file diff --git a/Streetcode/Streetcode.WebApi/Streetcode.WebApi.csproj b/Streetcode/Streetcode.WebApi/Streetcode.WebApi.csproj index 354d878d1..2b5f10895 100644 --- a/Streetcode/Streetcode.WebApi/Streetcode.WebApi.csproj +++ b/Streetcode/Streetcode.WebApi/Streetcode.WebApi.csproj @@ -64,4 +64,28 @@ + + + Controllers.BaseApiController.en-US.resx + True + True + + + Controllers.BaseApiController.uk-UA.resx + True + True + + + + + + Controllers.BaseApiController.en-US.Designer.cs + ResXFileCodeGenerator + + + Controllers.BaseApiController.uk-UA.Designer.cs + ResXFileCodeGenerator + + + diff --git a/Streetcode/Streetcode.WebApi/appsettings.Local.json b/Streetcode/Streetcode.WebApi/appsettings.Local.json index 72176d960..14b44479d 100644 --- a/Streetcode/Streetcode.WebApi/appsettings.Local.json +++ b/Streetcode/Streetcode.WebApi/appsettings.Local.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "DefaultConnection": "Server=localhost;Database=StreetcodeDb;User Id=sa;Password=Admin@1234;MultipleActiveResultSets=true" + "DefaultConnection": "Server=127.0.0.1;Database=StreetcodeDb;User Id=sa;Password=Admin@1234;MultipleActiveResultSets=true" }, "CORS": { "AllowedOrigins": [ "http://localhost:3000" ], diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/CoordinateTests/GetCoordinatesByStreetcodeIdHandlerTests.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/CoordinateTests/GetCoordinatesByStreetcodeIdHandlerTests.cs index 3623a1815..dda79c348 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/CoordinateTests/GetCoordinatesByStreetcodeIdHandlerTests.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/CoordinateTests/GetCoordinatesByStreetcodeIdHandlerTests.cs @@ -1,10 +1,13 @@ using AutoMapper; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.Extensions.Localization; using Moq; using Streetcode.BLL.DTO.AdditionalContent.Coordinates.Types; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.AdditionalContent.Coordinate.GetByStreetcodeId; +using Streetcode.BLL.SharedResource; +using Streetcode.DAL.Entities.AdditionalContent; using Streetcode.DAL.Entities.AdditionalContent.Coordinates.Types; using Streetcode.DAL.Entities.Streetcode; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -18,11 +21,13 @@ public class GetCoordinatesByStreetcodeIdHandlerTests private readonly Mock _mockRepo; private readonly Mock _mockMapper; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; public GetCoordinatesByStreetcodeIdHandlerTests() { _mockRepo = new Mock(); _mockMapper = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } private const int _streetcode_id = 1; @@ -83,7 +88,7 @@ public async Task Handler_Returns_NotEmpty_List() await SetupRepository(coordinates, new StreetcodeContent()); await SetupMapper(coordinateDTOs); - var handler = new GetCoordinatesByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetCoordinatesByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetCoordinatesByStreetcodeIdQuery(_streetcode_id), CancellationToken.None); @@ -101,7 +106,7 @@ public async Task Handler_Returns_Empty_List() await SetupRepository(new List(), new StreetcodeContent()); await SetupMapper(new List()); - var handler = new GetCoordinatesByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetCoordinatesByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetCoordinatesByStreetcodeIdQuery(_streetcode_id), CancellationToken.None); diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/SubtitleTests/GetAllSubtitlesRequestHandlerTests.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/SubtitleTests/GetAllSubtitlesRequestHandlerTests.cs index 2fb282d69..3ef99b808 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/SubtitleTests/GetAllSubtitlesRequestHandlerTests.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/SubtitleTests/GetAllSubtitlesRequestHandlerTests.cs @@ -1,10 +1,13 @@ using System.Linq.Expressions; using AutoMapper; +using Ical.Net.Serialization; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.Extensions.Localization; using Moq; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.AdditionalContent.Subtitle.GetAll; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.AdditionalContent; using Streetcode.DAL.Enums; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -17,12 +20,14 @@ public class GetAllSubtitlesRequestHandlerTests private readonly Mock _mockRepo; private readonly Mock _mockMapper; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; public GetAllSubtitlesRequestHandlerTests() { _mockRepo = new Mock(); _mockMapper = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } private readonly List subtitles = new List @@ -74,7 +79,7 @@ public async Task Handler_Returns_NotEmpty_List() await SetupRepository(subtitles); await SetupMapper(subtitleDTOs); - var handler = new GetAllSubtitlesHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetAllSubtitlesHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetAllSubtitlesQuery(), CancellationToken.None); @@ -92,7 +97,7 @@ public async Task Handler_Returns_Empty_List() await SetupRepository(new List()); await SetupMapper(new List()); - var handler = new GetAllSubtitlesHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetAllSubtitlesHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetAllSubtitlesQuery(), CancellationToken.None); diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/SubtitleTests/GetSubtitleByIdRequestHandlerTests.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/SubtitleTests/GetSubtitleByIdRequestHandlerTests.cs index 64b240df5..bf4c1933d 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/SubtitleTests/GetSubtitleByIdRequestHandlerTests.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/SubtitleTests/GetSubtitleByIdRequestHandlerTests.cs @@ -1,11 +1,13 @@ using System.Linq.Expressions; using AutoMapper; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.Extensions.Localization; using Moq; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.AdditionalContent.GetById; using Streetcode.BLL.MediatR.AdditionalContent.Subtitle.GetById; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.AdditionalContent; using Streetcode.DAL.Repositories.Interfaces.Base; using Xunit; @@ -17,12 +19,14 @@ public class GetSubtitleByIdRequestHandlerTests private readonly Mock _mockRepo; private readonly Mock _mockMapper; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; public GetSubtitleByIdRequestHandlerTests() { _mockRepo = new Mock(); _mockMapper = new Mock(); _mockLogger = new Mock(); + _mockLocalizer= new Mock>(); } private const int _id = 1; @@ -50,7 +54,7 @@ public async Task Handler_Returns_Matching_Element() await SetupRepository(subtitle); await SetupMapper(subtitleDTO); - var handler = new GetSubtitleByIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetSubtitleByIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetSubtitleByIdQuery(_id), CancellationToken.None); @@ -68,7 +72,7 @@ public async Task Handler_Returns_NoMatching_Element() await SetupRepository(new Subtitle()); await SetupMapper(new SubtitleDTO()); - var handler = new GetSubtitleByIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetSubtitleByIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetSubtitleByIdQuery(_id), CancellationToken.None); diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/SubtitleTests/GetSubtitlesByStreetcodeIdRequestHandlerTests.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/SubtitleTests/GetSubtitlesByStreetcodeIdRequestHandlerTests.cs index 8acf22be6..cfb4a0460 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/SubtitleTests/GetSubtitlesByStreetcodeIdRequestHandlerTests.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/SubtitleTests/GetSubtitlesByStreetcodeIdRequestHandlerTests.cs @@ -1,11 +1,13 @@ using System.Linq.Expressions; using AutoMapper; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.Extensions.Localization; using Moq; using Streetcode.BLL.DTO.AdditionalContent; using Streetcode.BLL.DTO.AdditionalContent.Subtitles; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.AdditionalContent.Subtitle.GetByStreetcodeId; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.AdditionalContent; using Streetcode.DAL.Repositories.Interfaces.Base; using Xunit; @@ -17,11 +19,14 @@ public class GetSubtitlesByStreetcodeIdRequestHandlerTests private readonly Mock _mockRepo; private readonly Mock _mockMapper; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; + public GetSubtitlesByStreetcodeIdRequestHandlerTests() { _mockRepo = new Mock(); _mockMapper = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } private const int _streetcode_id = 1; diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetAllTagsRequestHandlerTests.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetAllTagsRequestHandlerTests.cs index 9119e253b..6cee4694e 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetAllTagsRequestHandlerTests.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetAllTagsRequestHandlerTests.cs @@ -8,6 +8,8 @@ using Streetcode.BLL.DTO.AdditionalContent; using Streetcode.BLL.MediatR.AdditionalContent.Tag.GetAll; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.XUnitTest.MediatRTests.AdditionalContent.TagTests { @@ -16,12 +18,14 @@ public class GetAllTagsRequestHandlerTests private readonly Mock _mockRepo; private readonly Mock _mockMapper; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; public GetAllTagsRequestHandlerTests() { _mockRepo = new Mock(); _mockMapper = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } private readonly List tags = new List() @@ -72,7 +76,7 @@ public async Task Handler_Returns_NotEmpty_List() await SetupRepository(tags); await SetupMapper(tagDTOs); - var handler = new GetAllTagsHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetAllTagsHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetAllTagsQuery(), CancellationToken.None); @@ -90,7 +94,7 @@ public async Task Handler_Returns_Empty_List() await SetupRepository(new List()); await SetupMapper(new List()); - var handler = new GetAllTagsHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetAllTagsHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetAllTagsQuery(), CancellationToken.None); diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetTagByIdRequestHandlerTests.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetTagByIdRequestHandlerTests.cs index c436a5330..f87badb49 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetTagByIdRequestHandlerTests.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetTagByIdRequestHandlerTests.cs @@ -1,10 +1,12 @@ using System.Linq.Expressions; using AutoMapper; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.Extensions.Localization; using Moq; using Streetcode.BLL.DTO.AdditionalContent; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.AdditionalContent.Tag.GetById; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.AdditionalContent; using Streetcode.DAL.Repositories.Interfaces.Base; using Xunit; @@ -16,11 +18,14 @@ public class GetTagByIdRequestHandlerTests private readonly Mock _mockRepo; private readonly Mock _mockMapper; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; + public GetTagByIdRequestHandlerTests() { _mockRepo = new Mock(); _mockMapper = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } private const int _id = 1; @@ -57,7 +62,7 @@ public async Task Handler_Returns_Matching_Element() await SetupRepository(tag); await SetupMapper(tagDTO); - var handler = new GetTagByIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetTagByIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetTagByIdQuery(_id), CancellationToken.None); @@ -75,7 +80,7 @@ public async Task Handler_Returns_NoMatching_Element() await SetupRepository(new Tag()); await SetupMapper(new TagDTO()); - var handler = new GetTagByIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetTagByIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetTagByIdQuery(_id), CancellationToken.None); diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetTagByTitleRequestHandlerTests.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetTagByTitleRequestHandlerTests.cs index 0af86a0da..80695cc15 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetTagByTitleRequestHandlerTests.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetTagByTitleRequestHandlerTests.cs @@ -1,10 +1,12 @@ using AutoMapper; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.Extensions.Localization; using Moq; using Streetcode.BLL.DTO.AdditionalContent; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.AdditionalContent.Tag.GetByStreetcodeId; using Streetcode.BLL.MediatR.AdditionalContent.Tag.GetTagByTitle; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.AdditionalContent; using Streetcode.DAL.Repositories.Interfaces.Base; using System.Linq.Expressions; @@ -17,11 +19,14 @@ public class GetTagByTitleRequestHandlerTests private readonly Mock _mockRepo; private readonly Mock _mockMapper; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; + public GetTagByTitleRequestHandlerTests() { _mockRepo = new Mock(); _mockMapper = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } private static string _title = "test_title"; @@ -58,7 +63,7 @@ public async Task Handler_Returns_Matching_Element() await SetupRepository(tag); await SetupMapper(tagDTO); - var handler = new GetTagByTitleHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetTagByTitleHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetTagByTitleQuery(_title), CancellationToken.None); @@ -76,7 +81,7 @@ public async Task Handler_Returns_NoMatching_Element() await SetupRepository(new Tag()); await SetupMapper(new TagDTO()); - var handler = new GetTagByTitleHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetTagByTitleHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetTagByTitleQuery(_title), CancellationToken.None); diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetTagsByStreetcodeIdHandlerTests.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetTagsByStreetcodeIdHandlerTests.cs index 1ab5332b1..dad33ac68 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetTagsByStreetcodeIdHandlerTests.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/AdditionalContent/AdditionalContentTests/TagTests/GetTagsByStreetcodeIdHandlerTests.cs @@ -1,6 +1,7 @@ using System.Linq.Expressions; using AutoMapper; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.Extensions.Localization; using Moq; using Streetcode.BLL.DTO.AdditionalContent; using Streetcode.BLL.DTO.AdditionalContent.Tag; @@ -8,6 +9,7 @@ using Streetcode.BLL.DTO.Streetcode.Types; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.AdditionalContent.Tag.GetByStreetcodeId; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.AdditionalContent; using Streetcode.DAL.Entities.Streetcode; using Streetcode.DAL.Repositories.Interfaces.Base; @@ -20,11 +22,14 @@ public class GetTagsByStreetcodeIdHandlerTests private readonly Mock _mockRepo; private readonly Mock _mockMapper; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; + public GetTagsByStreetcodeIdHandlerTests() { _mockRepo = new Mock(); _mockMapper = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } private const int _streetcode_id = 1; @@ -101,7 +106,7 @@ public async Task Handler_Returns_NotEmpty_List() await SetupRepository(tags); await SetupMapper(tagDTOs); - var handler = new GetTagByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetTagByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetTagByStreetcodeIdQuery(_streetcode_id), CancellationToken.None); @@ -119,7 +124,7 @@ public async Task Handler_Returns_Empty_List() await SetupRepository(new List()); await SetupMapper(new List()); - var handler = new GetTagByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetTagByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetTagByStreetcodeIdQuery(_streetcode_id), CancellationToken.None); diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Art/GetAllArtTests/GetAllArtTest.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Art/GetAllArtTests/GetAllArtTest.cs index 2e1823f27..32183ee89 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Art/GetAllArtTests/GetAllArtTest.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Art/GetAllArtTests/GetAllArtTest.cs @@ -9,6 +9,8 @@ using Streetcode.DAL.Entities.Media.Images; using Streetcode.BLL.DTO.Media.Art; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.XUnitTest.MediatRTests.Media.Arts { @@ -16,12 +18,15 @@ public class GetAllArtsTest { private readonly Mock _mockRepo; private readonly Mock _mockMapper; + private readonly Mock> _mockLocalizer; + private readonly Mock _mockLogger; public GetAllArtsTest() { _mockRepo = new Mock(); _mockMapper = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } [Fact] @@ -29,7 +34,7 @@ public async Task Handle_ReturnsAllArts() { // Arrange MockRepositoryAndMapper(GetArtsList(), GetArtsDTOList()); - var handler = new GetAllArtsHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetAllArtsHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); // Act var result = await handler.Handle(new GetAllArtsQuery(), default); @@ -44,7 +49,7 @@ public async Task Handle_ReturnsZero() { //Arrange MockRepositoryAndMapper(new List(){ }, new List() { }); - var handler = new GetAllArtsHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetAllArtsHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); int expectedResult = 0; //Act @@ -60,7 +65,7 @@ public async Task Handle_ReturnsType() { //Arrange MockRepositoryAndMapper(GetArtsList(), GetArtsDTOList()); - var handler = new GetAllArtsHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetAllArtsHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetAllArtsQuery(), default); diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Art/GetById/GetArtByIdTest.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Art/GetById/GetArtByIdTest.cs index 59244a278..83738addb 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Art/GetById/GetArtByIdTest.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Art/GetById/GetArtByIdTest.cs @@ -9,6 +9,9 @@ using Streetcode.DAL.Entities.Media.Images; using Streetcode.BLL.DTO.Media.Art; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; +using Org.BouncyCastle.Asn1.Ocsp; namespace Streetcode.XUnitTest.MediatRTests.Media.Arts { @@ -17,12 +20,14 @@ public class GetArtByIdTest private readonly Mock _mockRepo; private readonly Mock _mockMapper; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizerCannotFind; public GetArtByIdTest() { _mockRepo = new Mock(); _mockMapper = new Mock(); _mockLogger = new Mock(); + _mockLocalizerCannotFind = new Mock>(); } [Theory] @@ -31,7 +36,7 @@ public async Task Handle_ReturnsArt(int id) { // Arrange GetMockRepositoryAndMapper(GetArt(), GetArtDTO()); - var handler = new GetArtByIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetArtByIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizerCannotFind.Object); // Act var result = await handler.Handle(new GetArtByIdQuery(id), CancellationToken.None); @@ -47,7 +52,7 @@ public async Task Handle_ReturnsType(int id) { // Arrange GetMockRepositoryAndMapper(GetArt(), GetArtDTO()); - var handler = new GetArtByIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetArtByIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizerCannotFind.Object); // Act var result = await handler.Handle(new GetArtByIdQuery(id), CancellationToken.None); @@ -62,7 +67,7 @@ public async Task Handle_WithNonExistentId_ReturnsError(int id) { // Arrange GetMockRepositoryAndMapper(null, null); - var handler = new GetArtByIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetArtByIdHandler(_mockRepo.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizerCannotFind.Object); var expectedError = $"Cannot find an art with corresponding id: {id}"; // Act @@ -71,7 +76,7 @@ public async Task Handle_WithNonExistentId_ReturnsError(int id) // Assert Assert.Equal(expectedError, result.Errors.First().Message); - } + } private Art GetArt() { @@ -99,6 +104,17 @@ private void GetMockRepositoryAndMapper(Art art, ArtDTO artDTO) _mockMapper.Setup(x => x.Map(It.IsAny())) .Returns(artDTO); + + _mockLocalizerCannotFind.Setup(x => x[It.IsAny(), It.IsAny()]) + .Returns((string key, object[] args) => + { + if (args != null && args.Length > 0 && args[0] is int id) + { + return new LocalizedString(key, $"Cannot find an art with corresponding id: {id}"); + } + + return new LocalizedString(key, "Cannot find an art with unknown id"); + }); } } } diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Art/GetByStreetCodeId/GetArtByStreetcodeIdTest.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Art/GetByStreetCodeId/GetArtByStreetcodeIdTest.cs index 7cc55ecd0..222e44503 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Art/GetByStreetCodeId/GetArtByStreetcodeIdTest.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Art/GetByStreetCodeId/GetArtByStreetcodeIdTest.cs @@ -1,12 +1,14 @@ using AutoMapper; using FluentResults; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.Extensions.Localization; using Moq; using Streetcode.BLL.DTO.Media.Art; using Streetcode.BLL.DTO.Media.Images; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.Media.Art.GetByStreetcodeId; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.Media.Images; using Streetcode.DAL.Repositories.Interfaces.Base; using System.Linq.Expressions; @@ -20,12 +22,15 @@ public class GetArtByStreetcodeIdTest private readonly Mock _mockMapper; private readonly Mock _blobService; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; + public GetArtByStreetcodeIdTest() { _mockRepo = new Mock(); _mockMapper = new Mock(); _blobService = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } [Theory] @@ -35,7 +40,7 @@ public async Task Handle_ReturnsArt(int streetcodeId) { // Arrange MockRepositoryAndMapper(GetArtsList(), GetArtsDTOList()); - var handler = new GetArtsByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetArtsByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); // Act var result = await handler.Handle(new GetArtsByStreetcodeIdQuery(streetcodeId), CancellationToken.None); @@ -52,7 +57,7 @@ public async Task Handle_ReturnsType(int streetcodeId) { // Arrange MockRepositoryAndMapper(GetArtsList(), GetArtsDTOList()); - var handler = new GetArtsByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetArtsByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); // Act var result = await handler.Handle(new GetArtsByStreetcodeIdQuery(streetcodeId), CancellationToken.None); @@ -68,7 +73,7 @@ public async Task Handle_WithNonExistentId_ReturnsError(int streetcodeId) { // Arrange MockRepositoryAndMapper(null, null); - var handler = new GetArtsByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetArtsByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); var expectedError = $"Cannot find any art with corresponding streetcode id: {streetcodeId}"; // Act @@ -122,6 +127,17 @@ private void MockRepositoryAndMapper(List artList, List artListDTO) _mockMapper.Setup(x => x.Map>(It.IsAny>())) .Returns(artListDTO); + + _mockLocalizer.Setup(x => x[It.IsAny(), It.IsAny()]) + .Returns((string key, object[] args) => + { + if (args != null && args.Length > 0 && args[0] is int streetcodeId) + { + return new LocalizedString(key, $"Cannot find any art with corresponding streetcode id: {streetcodeId}"); + } + + return new LocalizedString(key, "Cannot find an art with unknown streetcodeId"); + }); } } } diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Audio/GetAllAudioHandlerTests.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Audio/GetAllAudioHandlerTests.cs index b9d1d6a6f..6286e91e5 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Audio/GetAllAudioHandlerTests.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Audio/GetAllAudioHandlerTests.cs @@ -11,6 +11,8 @@ using Xunit; using Model = Streetcode.DAL.Entities.Media.Audio; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.XUnitTest.MediatRTests.Media.Audio { @@ -20,6 +22,7 @@ public class GetAllAudioHandlerTests private readonly Mock _mapper; private readonly Mock _blob; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; public GetAllAudioHandlerTests() { @@ -27,6 +30,7 @@ public GetAllAudioHandlerTests() _mapper = new Mock(); _blob = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } [Theory] @@ -48,7 +52,7 @@ public async Task Handle_ReturnsSuccess(int id, string expectedBase64) MapperSetup(testAudioListDTO); BlobSetup(expectedBase64); - var handler = new GetAllAudiosHandler(_repository.Object, _mapper.Object, _blob.Object, _mockLogger.Object); + var handler = new GetAllAudiosHandler(_repository.Object, _mapper.Object, _blob.Object, _mockLogger.Object, _mockLocalizer.Object); // act var result = await handler.Handle(new GetAllAudiosQuery(), CancellationToken.None); // assert @@ -63,7 +67,11 @@ public async Task Handle_ReturnsError() RepositorySetup(null, null); MapperSetup(null); BlobSetup(null); - var handler = new GetAllAudiosHandler(_repository.Object, _mapper.Object, _blob.Object, _mockLogger.Object); + + _mockLocalizer.Setup(localizer => localizer["CannotFindAnyAudios"]) + .Returns(new LocalizedString(expectedErrorMessage, expectedErrorMessage)); + + var handler = new GetAllAudiosHandler(_repository.Object, _mapper.Object, _blob.Object, _mockLogger.Object, _mockLocalizer.Object); // act var result = await handler.Handle(new GetAllAudiosQuery(), CancellationToken.None); // assert diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Audio/GetAudioByIdHandlerTests.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Audio/GetAudioByIdHandlerTests.cs index a515d863c..a587ab3ab 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Audio/GetAudioByIdHandlerTests.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Audio/GetAudioByIdHandlerTests.cs @@ -1,10 +1,12 @@ using AutoMapper; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.Extensions.Localization; using Moq; using Streetcode.BLL.DTO.Media.Audio; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.Media.Audio.GetById; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Repositories.Interfaces.Base; using System.Linq.Expressions; using Xunit; @@ -18,6 +20,7 @@ public class GetAudioByIdHandlerTests private readonly Mock _mapper; private readonly Mock _blobService; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; public GetAudioByIdHandlerTests() { @@ -25,6 +28,7 @@ public GetAudioByIdHandlerTests() _mapper = new Mock(); _blobService = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } [Theory] @@ -38,7 +42,7 @@ public async Task Handle_ExistingId_Succcess(int id) RepositorySetup(testAudio); MapperSetup(testAudioDTO); - var handler = new GetAudioByIdHandler(_repository.Object, _mapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetAudioByIdHandler(_repository.Object, _mapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); // act var result = await handler.Handle(new GetAudioByIdQuery(id), CancellationToken.None); // assert @@ -57,7 +61,7 @@ public async Task Handle_NonExistingId_ErrorHandling(int id) RepositorySetup(null); MapperSetup(testAudioDTO); - var handler = new GetAudioByIdHandler(_repository.Object, _mapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetAudioByIdHandler(_repository.Object, _mapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); // act var result = await handler.Handle(new GetAudioByIdQuery(id), CancellationToken.None); // assert @@ -76,7 +80,7 @@ public async Task Handle_ReturnCorrectType(int id) RepositorySetup(testAudio); MapperSetup(testAudioDTO); - var handler = new GetAudioByIdHandler(_repository.Object, _mapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetAudioByIdHandler(_repository.Object, _mapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); // act var result = await handler.Handle(new GetAudioByIdQuery(id), CancellationToken.None); // assert @@ -88,6 +92,17 @@ private void RepositorySetup(Model audio) _repository.Setup(repo => repo.AudioRepository .GetFirstOrDefaultAsync(It.IsAny>>(), It.IsAny, IIncludableQueryable>?>())) .ReturnsAsync(audio); + + _mockLocalizer.Setup(x => x[It.IsAny(), It.IsAny()]) + .Returns((string key, object[] args) => + { + if (args != null && args.Length > 0 && args[0] is int id) + { + return new LocalizedString(key, $"Cannot find an audio with corresponding id: {id}"); + } + + return new LocalizedString(key, "Cannot find an audio with unknown Id"); + }); } private void MapperSetup(AudioDTO audioDTO) diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Audio/GetAudioByStreetcodeIdHandlerTests.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Audio/GetAudioByStreetcodeIdHandlerTests.cs index 468bed814..c53d149cc 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Audio/GetAudioByStreetcodeIdHandlerTests.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Audio/GetAudioByStreetcodeIdHandlerTests.cs @@ -11,6 +11,8 @@ using Streetcode.BLL.Interfaces.Logging; using Streetcode.DAL.Entities.Streetcode; using Streetcode.DAL.Entities.Media; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.XUnitTest.MediatRTests.Media.Audio { @@ -20,6 +22,7 @@ public class GetAudioByStreetcodeIdHandlerTests private readonly Mock _mapper; private readonly Mock _blobService; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; public GetAudioByStreetcodeIdHandlerTests() { @@ -27,6 +30,7 @@ public GetAudioByStreetcodeIdHandlerTests() _mapper = new Mock(); _blobService = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } [Theory] [InlineData(1)] @@ -39,7 +43,7 @@ public async Task Handle_ExistingId_ReturnsSuccess(int id) RepositorySetup(testAudio); MapperSetup(testAudioDTO); - var handler = new GetAudioByStreetcodeIdQueryHandler(_repository.Object, _mapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetAudioByStreetcodeIdQueryHandler(_repository.Object, _mapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); // act var result = await handler.Handle(new GetAudioByStreetcodeIdQuery(id), CancellationToken.None); // assert @@ -55,12 +59,17 @@ public async Task Handle_NotExistingId_ReturnsError(int id) RepositoryResultFailed(); MapperSetup(testAudioDTO); + + var errorMessage = "Localized error message for the test."; + var localizedString = new LocalizedString("CannotFindAnAudioWithTheCorrespondingStreetcodeId", errorMessage); + _mockLocalizer.Setup(l => l["CannotFindAnAudioWithTheCorrespondingStreetcodeId", id]).Returns(localizedString); + _repository.Setup(repo => repo.StreetcodeRepository .GetFirstOrDefaultAsync(It.IsAny>>(), It.IsAny, IIncludableQueryable>?>())) .ReturnsAsync(streetcode); - var handler = new GetAudioByStreetcodeIdQueryHandler(_repository.Object, _mapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetAudioByStreetcodeIdQueryHandler(_repository.Object, _mapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); // act var result = await handler.Handle(new GetAudioByStreetcodeIdQuery(id), CancellationToken.None); // assert @@ -78,7 +87,7 @@ public async Task Handle_ReturnsCorrectType(int id) RepositorySetup(testAudio); MapperSetup(testAudioDTO); - var handler = new GetAudioByStreetcodeIdQueryHandler(_repository.Object, _mapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetAudioByStreetcodeIdQueryHandler(_repository.Object, _mapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); // act var result = await handler.Handle(new GetAudioByStreetcodeIdQuery(id), CancellationToken.None); // assert diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Image/GetAllImageTests/GetAllImageTests.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Image/GetAllImageTests/GetAllImageTests.cs index 14a2a44b6..e13b93bb4 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Image/GetAllImageTests/GetAllImageTests.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Image/GetAllImageTests/GetAllImageTests.cs @@ -10,6 +10,8 @@ using Streetcode.DAL.Entities.Media.Images; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.XUnitTest.MediatRTests.Media.Images { @@ -19,6 +21,7 @@ public class GetAllImagesTest private readonly Mock _mockMapper; private readonly Mock _blobService; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; public GetAllImagesTest() { @@ -26,6 +29,7 @@ public GetAllImagesTest() _mockMapper = new Mock(); _blobService = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } [Fact] @@ -33,7 +37,7 @@ public async Task Handle_ReturnsAllImages() { // Arrange MockRepositoryAndMapper(GetImagesList(), GetImagesDTOList()); - var handler = new GetAllImagesHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetAllImagesHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); // Act var result = await handler.Handle(new GetAllImagesQuery(), default); @@ -48,7 +52,7 @@ public async Task Handle_ReturnsZero() { //Arrange MockRepositoryAndMapper(new List() { }, new List() { }); - var handler = new GetAllImagesHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetAllImagesHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); int expectedResult = 0; //Act @@ -64,7 +68,7 @@ public async Task Handle_ReturnsType() { //Arrange MockRepositoryAndMapper(GetImagesList(), GetImagesDTOList()); - var handler = new GetAllImagesHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetAllImagesHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetAllImagesQuery(), default); diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Image/GetByIdTest/GetImageByIdTest.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Image/GetByIdTest/GetImageByIdTest.cs index c59c83b01..37931a1b0 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Image/GetByIdTest/GetImageByIdTest.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Image/GetByIdTest/GetImageByIdTest.cs @@ -10,6 +10,8 @@ using Streetcode.DAL.Entities.Media.Images; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; +using Microsoft.Extensions.Localization; +using Streetcode.BLL.SharedResource; namespace Streetcode.XUnitTest.MediatRTests.Media.Images { @@ -20,12 +22,14 @@ public class GetImageByIdTest private Mock _blobService; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; public GetImageByIdTest() { _mockRepo = new Mock(); _mockMapper = new Mock(); _blobService = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } [Theory] @@ -34,7 +38,7 @@ public async Task Handle_ReturnsImage(int id) { // Arrange GetMockRepositoryAndMapper(GetImage(), GetImageDTO()); - var handler = new GetImageByIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetImageByIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); // Act var result = await handler.Handle(new GetImageByIdQuery(id), CancellationToken.None); @@ -50,7 +54,7 @@ public async Task Handle_ReturnsType(int id) { // Arrange GetMockRepositoryAndMapper(GetImage(), GetImageDTO()); - var handler = new GetImageByIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetImageByIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); // Act var result = await handler.Handle(new GetImageByIdQuery(id), CancellationToken.None); @@ -65,7 +69,7 @@ public async Task Handle_WithNonExistentId_ReturnsError(int id) { // Arrange GetMockRepositoryAndMapper(null, null); - var handler = new GetImageByIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetImageByIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); var expectedError = $"Cannot find a image with corresponding id: {id}"; // Act @@ -104,6 +108,17 @@ private void GetMockRepositoryAndMapper(Image Image, ImageDTO ImageDTO) _mockMapper.Setup(x => x.Map(It.IsAny())) .Returns(ImageDTO); + + _mockLocalizer.Setup(x => x[It.IsAny(), It.IsAny()]) + .Returns((string key, object[] args) => + { + if (args != null && args.Length > 0 && args[0] is int id) + { + return new LocalizedString(key, $"Cannot find a image with corresponding id: {id}"); + } + + return new LocalizedString(key, "Cannot find an image with unknown Id"); + }); } } } \ No newline at end of file diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Image/GetByStreetCodeIdTest/GetImageByStreetcodeIdTest.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Image/GetByStreetCodeIdTest/GetImageByStreetcodeIdTest.cs index e1f4dfa4d..608e90d5d 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Image/GetByStreetCodeIdTest/GetImageByStreetcodeIdTest.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Image/GetByStreetCodeIdTest/GetImageByStreetcodeIdTest.cs @@ -1,11 +1,13 @@ using AutoMapper; using FluentResults; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.Extensions.Localization; using Moq; using Streetcode.BLL.DTO.Media.Images; using Streetcode.BLL.Interfaces.BlobStorage; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.Media.Image.GetByStreetcodeId; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.Media.Images; using Streetcode.DAL.Repositories.Interfaces.Base; using System.Linq.Expressions; @@ -18,6 +20,7 @@ public class GetImageByStreetcodeIdTest private Mock _mockRepo; private Mock _mockMapper; private Mock _blobService; + private readonly Mock> _mockLocalizer; private readonly Mock _mockLogger; public GetImageByStreetcodeIdTest() @@ -26,6 +29,7 @@ public GetImageByStreetcodeIdTest() _mockMapper = new Mock(); _blobService = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } [Theory] @@ -35,7 +39,7 @@ public async Task Handle_ReturnsImage(int streetcodeId) { // Arrange MockRepositoryAndMapper(GetImagesList(), GetImagesDTOList()); - var handler = new GetImageByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetImageByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); // Act var result = await handler.Handle(new GetImageByStreetcodeIdQuery(streetcodeId), CancellationToken.None); @@ -52,7 +56,7 @@ public async Task Handle_ReturnsType(int streetcodeId) { // Arrange MockRepositoryAndMapper(GetImagesList(), GetImagesDTOList()); - var handler = new GetImageByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object); + var handler = new GetImageByStreetcodeIdHandler(_mockRepo.Object, _mockMapper.Object, _blobService.Object, _mockLogger.Object, _mockLocalizer.Object); // Act var result = await handler.Handle(new GetImageByStreetcodeIdQuery(streetcodeId), CancellationToken.None); diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Video/GetAllVideosTest.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Video/GetAllVideosTest.cs index cfb0320ba..cb0d69f2f 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Video/GetAllVideosTest.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Video/GetAllVideosTest.cs @@ -1,9 +1,11 @@ using AutoMapper; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.Extensions.Localization; using Moq; using Streetcode.BLL.DTO.Media.Video; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.Media.Video.GetAll; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.Media; using Streetcode.DAL.Repositories.Interfaces.Base; using System.Linq.Expressions; @@ -16,11 +18,18 @@ public class GetAllVideosTest private Mock _mockRepository; private Mock _mockMapper; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; + public GetAllVideosTest() { _mockRepository = new Mock(); _mockMapper = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); + + _mockLocalizer + .Setup(x => x["CannotFindAnyVideos"]) + .Returns(new LocalizedString("CannotFindAnyVideos", "Cannot find any videos")); } [Fact] @@ -28,7 +37,7 @@ public async Task ShouldReturnSuccessfully_Type() { //Arrange (_mockRepository, _mockMapper) = MockRepoAndMapper(_mockRepository, _mockMapper); - var handler = new GetAllVideosHandler(_mockRepository.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetAllVideosHandler(_mockRepository.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetAllVideosQuery(), CancellationToken.None); @@ -45,7 +54,7 @@ public async Task ShouldReturnSuccessfully_CountMatch() { //Arrange (_mockRepository, _mockMapper) = MockRepoAndMapper(_mockRepository, _mockMapper); - var handler = new GetAllVideosHandler(_mockRepository.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetAllVideosHandler(_mockRepository.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetAllVideosQuery(), CancellationToken.None); @@ -74,7 +83,7 @@ public async Task ShouldThrowExeption_ReppoReturnNull() .Returns(GetVideosDTOWithNotExistingId()); var expectedError = "Cannot find any videos"; - var handler = new GetAllVideosHandler(_mockRepository.Object, _mockMapper.Object, _mockLogger.Object); + var handler = new GetAllVideosHandler(_mockRepository.Object, _mockMapper.Object, _mockLogger.Object, _mockLocalizer.Object); //Act var result = await handler.Handle(new GetAllVideosQuery(), CancellationToken.None); diff --git a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Video/GetVideoByIdTest.cs b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Video/GetVideoByIdTest.cs index 702c6ae7f..4a7ffb384 100644 --- a/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Video/GetVideoByIdTest.cs +++ b/Streetcode/Streetcode.XUnitTest/MediatRTests/Media/Video/GetVideoByIdTest.cs @@ -1,9 +1,11 @@ using AutoMapper; using Microsoft.EntityFrameworkCore.Query; +using Microsoft.Extensions.Localization; using Moq; using Streetcode.BLL.DTO.Media.Video; using Streetcode.BLL.Interfaces.Logging; using Streetcode.BLL.MediatR.Media.Video.GetById; +using Streetcode.BLL.SharedResource; using Streetcode.DAL.Entities.Media; using Streetcode.DAL.Repositories.Interfaces.Base; using System.Linq.Expressions; @@ -16,12 +18,14 @@ public class GetVideoByIdTest private readonly Mock _mockRepository; private readonly Mock _mockMapper; private readonly Mock _mockLogger; + private readonly Mock> _mockLocalizer; public GetVideoByIdTest() { _mockMapper = new Mock(); _mockRepository = new Mock(); _mockLogger = new Mock(); + _mockLocalizer = new Mock>(); } [Theory] @@ -41,7 +45,7 @@ public async Task ShouldReturn_SuccessfullyExistingId(int id) .Map(It.IsAny