Created
May 29, 2020 19:34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace WhiteLabelingXFSample.Resources | |
{ | |
[ContentProperty("Text")] | |
public class TranslateExtension : IMarkupExtension | |
{ | |
static string ResourceId = WhiteLabelingConfig.Instance.AppResourceFile; | |
public string Text { get; set; } | |
public object ProvideValue(IServiceProvider serviceProvider) | |
{ | |
if (Text == null) | |
return null; | |
return GetValue(Text); | |
} | |
public static string GetValue(string text) | |
{ | |
ResourceManager resourceManager = new ResourceManager(ResourceId, typeof(TranslateExtension).GetTypeInfo().Assembly); | |
return resourceManager.GetString(text, CultureInfo.CurrentCulture); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment