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

hc:Localization design time error #67

Closed
GF-Huang opened this issue May 21, 2021 · 9 comments
Closed

hc:Localization design time error #67

GF-Huang opened this issue May 21, 2021 · 9 comments
Labels
bug Something isn't working Fixed

Comments

@GF-Huang
Copy link
Contributor

GF-Huang commented May 21, 2021

Run time no error, just design time. Refresh and rebuild not fix.

image

@ghost1372
Copy link
Owner

ghost1372 commented May 23, 2021

Thank you I will solve the problem soon

@ghost1372 ghost1372 added the bug Something isn't working label May 23, 2021
@ghost1372
Copy link
Owner

@GF-Huang Please test beta 11 to see if the issue is fixed or not

@GF-Huang
Copy link
Contributor Author

Where's the beta 11?

@ghost1372
Copy link
Owner

@GF-Huang
Copy link
Contributor Author

BTW, why not push nightly or preview version to nuget?

@GF-Huang
Copy link
Contributor Author

@GF-Huang Please test beta 11 to see if the issue is fixed or not

Beta 11 works well.

@ghost1372
Copy link
Owner

BTW, why not push nightly or preview version to nuget?

https://stackoverflow.com/a/23754621/3690982

@GF-Huang
Copy link
Contributor Author

And what these mean? Could you give some examples/usage?

image

@ghost1372
Copy link
Owner

ghost1372 commented May 24, 2021

use this type of localization if you want to use key with arguments

Argument Binding Localization

First Create two Key in Resx file.

Name: SomeKey
Value: Hello {0}, {1}

Name: SomeKey2
Value: HandyControl

Then create a string Property

private string _SomeProperty = "Bye!";
public string SomeProperty
{
    get { return _SomeProperty; }
    set { _SomeProperty = value;}
}

Now

 <TextBlock> 
    <TextBlock.Text> 
        <hc:Localization Key="SomeKey"> 
            <Binding Source="{hc:Localization SomeKey2}"/> 
            <Binding Path="SomeProperty" /> 
        </hc:Localization> 
    </TextBlock.Text> 
</TextBlock> 

Animation2

OR

Create a Key in Resx file.

Name: SomeKey
Value: Hello {0}

Then create a string Property

private string _SomeProperty = "HandyControl";
public string SomeProperty
{
    get { return _SomeProperty; }
    set { _SomeProperty = value;}
}

Now

<TextBlock> 
    <TextBlock.Text> 
         <hc:Localization Key="SomeKey">
            <Binding Path="SomeProperty" />
         </hc:Localization>
    </TextBlock.Text> 
</TextBlock>

Argument3

Static Arguments Localization

First Create a SomeKey Key with Alphabet {0}, {1}, {2} value in Resx file.

Name: SomeKey
Value: Alphabet {0}, {1}, {2}

Then Create an array in Xaml

<x:Array x:Key="SomeArray" Type="system:String" xmlns:system="clr-namespace:System;assembly=mscorlib">
    <system:String>A</system:String>
    <system:String>B</system:String>
    <system:String>C</system:String>
</x:Array>

Now we can use our array in our localization

 <TextBlock> 
    <TextBlock.Text> 
      <hc:Localization Key="SomeKey" Arguments="{StaticResource SomeArray}" />
    </TextBlock.Text>
 </TextBlock> 

Argument

I will update docs tonight

@ghost1372 ghost1372 added the Fixed label Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed
Projects
None yet
Development

No branches or pull requests

2 participants