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 Text, X0..X9 bindable parameters #34

Open
stephenquan opened this issue Oct 21, 2024 · 0 comments
Open

Translate Text, X0..X9 bindable parameters #34

stephenquan opened this issue Oct 21, 2024 · 0 comments

Comments

@stephenquan
Copy link
Contributor

stephenquan commented Oct 21, 2024

Enhance Translate markup extension by:

  • Text can be a localize string resource or a binding to a localize string resource
  • X0 is a value of binding to a value that replaces {0} in the localize string resource
  • X1 is a value of binding to a value that replaces {1} in the localize string resource
  • X2 is a value of binding to a value that replaces {2} in the localize string resource
  • X3 is a value of binding to a value that replaces {3} in the localize string resource
  • X4 is a value of binding to a value that replaces {4} in the localize string resource
  • X5 is a value of binding to a value that replaces {5} in the localize string resource
  • X6 is a value of binding to a value that replaces {6} in the localize string resource
  • X7 is a value of binding to a value that replaces {7} in the localize string resource
  • X8 is a value of binding to a value that replaces {8} in the localize string resource
  • X9 is a value of binding to a value that replaces {9} in the localize string resource

Examples:

<!-- Weather is the string resource "The weather today is {0}." -->
<!-- Temperature is from your view model, e.g. "32 degrees celsius" -->
<!-- Outputs "The weather today is 32 degrees celsius."
<Label Text={localization:Translate Weather, X0={Binding Temperature}} />

<!-- Greeting is the string resource "Hello {0}, the answer to life the universe and everything is {1}!" -->
<!-- Name is "Arthur Dent" -->
<!-- Answer is 42 -->
<!-- Outputs "Hello Arthur Dent, the answer to life the universe and everything is 42! -->
<Label Text="{localization:Translate Greeting, X0={Binding Name}, X1={Binding Answer}}" />

N.B. These changes supersede the TranslateBinding markup extension introduced in https://github.com/SirJohnK/LocalizationResourceManager.Maui/pull/16
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

No branches or pull requests

1 participant