-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
PlatformsThis issue is platforms project partThis issue is platforms project part
Milestone
Description
Ideas
Add easy localise message infrastructure with message-content styles and arguments support with easy to use api.
The localisation infrastructure should have ability to support custom localisation provider.
Project will be independent library in talkie-framework solution with name Falko.Talkie.Platforms.Localization.
Features
- Localisation should support message styles and arguments;
- Localisation should work from
ISignalContextor directly; - Localisation can have many localisation providers;
- Different localisation providers (or factory of that) should support different localisation layouts;
- Localisation context contains localisation layout and localisation provider, you put that into
Localizemethod.
Examples
The perfect examples of localisation infrastructure stored at the @busquita-bot.
But that's is static one... We need to inspire by that and create own.
¡Important!
That task not include providers implementation, only infrastructure for that.
The task should created in spitted branch that are @message-content-localization. Cuz that's will be added in future releases, when providers with be implemented in other tasks.
Usages
{
"Introduction": "I'm **{first_name}** (@{user_name})"
}public sealed class MyLocalizationLayout : ILocalizationLayout
{
ILocalizationContent Introduction { get; }
}public sealed class MyLocalizationContext(MyLocalizationLayout layout, JsonLocalizationProvider provider)
: LocalizationContext<MyLocalizationLayout, JsonLocalizationProvider>(layout, provider);await new HostBuilder()
// ...
.UseLocalization((services, builder) => builder
.AddProvider<JsonLocalizationProvider>()
.AddLayout<MyLocalizationLayout>()
.AddContext<MyLocalizationContext>())
// ...
.RunConsoleAsync();MyLocalizationContext localization = //* ... *//;
await context
.ToMessageController()
.PublishMessageAsync(context
.Localize(localization, localization => localization.Introduction)
.Where("first_name", "rima")
.Where("user_name", "fembina"));Metadata
Metadata
Assignees
Labels
PlatformsThis issue is platforms project partThis issue is platforms project part
Type
Projects
Status
Do