| | | 1 | | using TeleFlow.Telegram.Formatting; |
| | | 2 | | |
| | | 3 | | namespace TeleFlow.Telegram.I18n.Fluent.Internal; |
| | | 4 | | |
| | | 5 | | /// <summary> |
| | | 6 | | /// Binds the explicit-locale formatter to the locale resolved once for the current Telegram update scope. |
| | | 7 | | /// </summary> |
| | | 8 | | internal sealed class FluentLocalizer( |
| | | 9 | | ILocaleAccessor localeAccessor, |
| | | 10 | | IFluentTextFormatter formatter) : IFluentLocalizer |
| | | 11 | | { |
| | | 12 | | public string Format(string messageId, params ReadOnlySpan<I18nArgument> arguments) |
| | | 13 | | { |
| | 6 | 14 | | return formatter.Format(localeAccessor.Current, messageId, arguments); |
| | | 15 | | } |
| | | 16 | | |
| | | 17 | | public TelegramFormattedText FormatHtml( |
| | | 18 | | string messageId, |
| | | 19 | | params ReadOnlySpan<I18nArgument> arguments) |
| | | 20 | | { |
| | 1 | 21 | | return formatter.FormatHtml(localeAccessor.Current, messageId, arguments); |
| | | 22 | | } |
| | | 23 | | |
| | | 24 | | public TelegramFormattedText FormatMarkdownV2( |
| | | 25 | | string messageId, |
| | | 26 | | params ReadOnlySpan<I18nArgument> arguments) |
| | | 27 | | { |
| | 1 | 28 | | return formatter.FormatMarkdownV2(localeAccessor.Current, messageId, arguments); |
| | | 29 | | } |
| | | 30 | | } |