Created
April 28, 2022 13:46
-
-
Save Char0394/7d37f85a21b8f021f5808b2e2544a1b4 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
[ContentProperty("Text")] | |
public class TranslateExtension : IMarkupExtension<bindingbase> | |
{ | |
public string Text { get; set; } | |
object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider, ILocalizer localizer) | |
{ | |
return ProvideValue(serviceProvider, localizer); | |
} | |
public BindingBase ProvideValue(IServiceProvider serviceProvider, ILocalizer localizer) | |
{ | |
var binding = new Binding | |
{ | |
Mode = BindingMode.OneWay, | |
Path = localizer.GetTranslation("<language here>") | |
Source = ResourceManagerHelper.Instance, | |
}; | |
return binding; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment