Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate with bindable properties. SetTranslate extension method. #33

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

stephenquan
Copy link
Contributor

@stephenquan stephenquan commented Oct 21, 2024

Summary:

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

@SirJohnK
Copy link
Owner

@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! 👍

@stephenquan
Copy link
Contributor Author

stephenquan commented Oct 29, 2024

@SirJohnK it is no problem. For your info, the TranslateBinding came up in this dotnet/maui community discussion dotnet/maui#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 dotnet/maui#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants