Files
PlantBox/PlantBox.Client/PlantBox.Client/Extensions/LocaleExtension.cs
Eveldee 7e7109d609 Change Settings and About pages
Added Media tab in About
Language and notifications settings
2019-03-16 22:11:47 +01:00

29 lines
697 B
C#

using PlantBox.Client.Resources;
using System;
using System.Collections.Generic;
using System.Resources;
using System.Text;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;
namespace PlantBox.Client.Extensions
{
[ContentProperty(nameof(Name))]
public class LocaleExtension : IMarkupExtension
{
public string Name { get; set; }
private static ResourceManager _resourceManager;
static LocaleExtension()
{
_resourceManager = Locale.ResourceManager;
}
public object ProvideValue(IServiceProvider serviceProvider)
{
return _resourceManager.GetString(Name, Locale.Culture) ?? $"#{Name}";
}
}
}