* Moved source code projects directory to 'src'
* Updatedt Solution format
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
using Microsoft.Extensions.Localization;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegrator.Handlers.Components;
|
||||
|
||||
namespace Telegrator.Localized
|
||||
{
|
||||
public interface ILocalizedHandler<T> : IAbstractUpdateHandler<Message> where T : class
|
||||
{
|
||||
public IStringLocalizer LocalizationProvider { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using Telegram.Bot.Types;
|
||||
using Telegrator.Handlers.Components;
|
||||
|
||||
namespace Telegrator.Localized
|
||||
{
|
||||
public interface ILocalizedMessageHandler : ILocalizedHandler<Message>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using Microsoft.Extensions.Localization;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegrator.Handlers;
|
||||
|
||||
namespace Telegrator.Localized
|
||||
{
|
||||
public static class LocalizedMessageHandlerExtensions
|
||||
{
|
||||
public static async Task<Message> ResponseLocalized(this ILocalizedHandler<Message> localizedHandler, string localizedReplyIdentifier, params IEnumerable<string> formatArgs)
|
||||
{
|
||||
LocalizedString localizedString = localizedHandler.LocalizationProvider[localizedReplyIdentifier, formatArgs];
|
||||
return await localizedHandler.Container.Responce(localizedString.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Localization.Abstractions" Version="10.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Telegrator\Telegrator.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user