Skip to content

Instantly share code, notes, and snippets.

@Char0394
Created May 29, 2020 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Char0394/cabb32e3eef90ffc0b8ee2cf82b41aeb to your computer and use it in GitHub Desktop.
Save Char0394/cabb32e3eef90ffc0b8ee2cf82b41aeb to your computer and use it in GitHub Desktop.
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