1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-06-25 10:26:02 +02:00
bitwarden-mobile/src/Core/Utilities/I18nExtension.cs
2023-09-29 11:02:19 -03:00

39 lines
987 B
C#

using System;
using Bit.Core.Abstractions;
using Bit.Core.Utilities;
using Microsoft.Maui.Controls.Xaml;
using Microsoft.Maui.Controls;
using Microsoft.Maui;
namespace Bit.App.Utilities
{
[ContentProperty("Id")]
public class I18nExtension : IMarkupExtension
{
private II18nService _i18nService;
public I18nExtension()
{
_i18nService = ServiceContainer.Resolve<II18nService>("i18nService");
}
public string Id { get; set; }
public string P1 { get; set; }
public string P2 { get; set; }
public string P3 { get; set; }
public bool Header { get; set; }
public object ProvideValue(IServiceProvider serviceProvider)
{
var val = _i18nService.T(Id, P1, P2, P3);
/*
if (Header && Device.RuntimePlatform == Device.iOS)
{
return val.ToUpper();
}
*/
return val;
}
}
}