Created
May 29, 2020 19:34
-
-
Save Char0394/cabb32e3eef90ffc0b8ee2cf82b41aeb to your computer and use it in GitHub Desktop.
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