bitwarden-android/src/Core/Utilities/I18nExtension.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
987 B
C#
Raw Normal View History

2019-04-11 22:33:10 +03:00
using System;
using Bit.Core.Abstractions;
using Bit.Core.Utilities;
2023-09-29 17:02:19 +03:00
using Microsoft.Maui.Controls.Xaml;
using Microsoft.Maui.Controls;
using Microsoft.Maui;
2019-04-11 22:33:10 +03:00
namespace Bit.App.Utilities
{
2019-04-11 22:43:13 +03:00
[ContentProperty("Id")]
2019-04-22 20:47:45 +03:00
public class I18nExtension : IMarkupExtension
2019-04-11 22:33:10 +03:00
{
private II18nService _i18nService;
2019-04-22 20:47:45 +03:00
public I18nExtension()
2019-04-11 22:33:10 +03:00
{
_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; }
2019-06-21 00:05:28 +03:00
public bool Header { get; set; }
2019-04-11 22:33:10 +03:00
public object ProvideValue(IServiceProvider serviceProvider)
{
2019-06-21 00:05:28 +03:00
var val = _i18nService.T(Id, P1, P2, P3);
2019-06-21 00:26:42 +03:00
/*
if (Header && Device.RuntimePlatform == Device.iOS)
2019-06-21 00:05:28 +03:00
{
return val.ToUpper();
}
2019-06-21 00:26:42 +03:00
*/
2019-06-21 00:05:28 +03:00
return val;
2019-04-11 22:33:10 +03:00
}
}
}