Translate with bindable properties. SetTranslate extension method.
Summary:
- Implement Translate new Text, X0, X1, ... X9 bindable properties #34
- Implement SetTranslate extension method #35
Description of files changed:
- MainPage.xaml
- Add ContentPage.Title so that we can see dynamic title changes
- Revert CounterBtn to use Translate instead of TranslateBinding (closer to stock .NET MAUI program)
- MainPage.xaml.cs
- Revert MainPage.xaml.cs so it's closer to stock .NET MAUI program
- Demonstrate new SetTranslate extension method
- TranslateExtension.cs
- Rewrite to use a MultiBinding instead of Building to support Text and variable parameters expressed in X0..X9
- TranslateExtensionConverter.cs
- An internal class for reducing the MultiBinding created by TranslateExtension to a localized string
- TranslateExtensionMethod.cs
- New static class with static method implementing SetTranslate extension method
@stephenquan , I am in the final testing phase of the 1.3.0 release of this library and it's very overdue... I think this is really interesting proposal and will look into it as soon the new version is out!
I really appreciate that you take the time to make this a better library! 👍
@SirJohnK it is no problem. For your info, the TranslateBinding came up in this dotnet/maui community discussion https://github.com/dotnet/maui/discussions/25329 but it is okay. The TranslateBinding wasn't the cause. The underlying problem was a MVVM and Picker problem which is now documented in this issue https://github.com/dotnet/maui/issues/25634. Since the Picker workaround required some C#, I thought it was a good opportunity bring the C# side of your library in parity with the XAML markup extension.
No rush with this PR.
N.B. I like these new bindable features in the Translate markup extension so much that I use it often. In many cases, I can use it instead of the TranslateBinding.