Change language to Spanish
Hi all,
How can I change the language of the colors displayed in the ColorPickerButton to Spanish?
I tried changing the language in the parent form, but that didn't work.
Thanks in advance,
Daniel P.
SIGN IN To post a reply.
5 Replies
1 reply marked as answer
NI
Ninja
Syncfusion Team
September 14, 2020 12:06 PM UTC
Hi Daniel,
Thanks for contacting Syncfusion support.
We have checked your requirement “Need to customize the color names in ColorPickerButton” and it can be achieved by using the ILocalizationProvider as shown in below documentation, sample and screenshot. Please refer the below for same.
Documentation: https://help.syncfusion.com/windowsforms/localization?cs-save-lang=1&cs-lang=csharp#using-ilocalizationprovider
Sample : https://www.syncfusion.com/downloads/support/forum/157828/ze/ColorPickerButton_Winforms2123549425
Screenshot :
Regards,
Niranjan Kumar Gopalan
Marked as answer
DP
daniel peña
September 15, 2020 04:03 AM UTC
Hi Niranjan,
Thanks for pointing me in the right direction, I am almost there but I still have an issue, after I select the color 'Negro' I need to save it in the database, but the value I get from the the SelectedColor.Name property is still 'Black', how can I get the translated color name?
Thanks in advance,
Daniel P.
NI
Ninja
Syncfusion Team
September 15, 2020 10:18 AM UTC
Hi Daniel,
Thanks for your update.
We have checked your requirement and it can be achieved by using the below method in Localizer class and below code in ColorPickerButton ColorSelected event as shown below. Please refer the below screenshot and sample for same.
C#:
Localizer class:
|
public string LocalizatedName(string name)
{
switch (name)
{
case ResourceIdentifiers.White:
return "schließen";
case ResourceIdentifiers.Silver:
return "finden";
case ResourceIdentifiers.DarkRed:
return "markieren Sie alle";
case ResourceIdentifiers.Red:
return "übereinstimmen Fall";
case ResourceIdentifiers.Yellow:
return "Suche hidden";
case ResourceIdentifiers.Black:
return "negro";
default:
return string.Empty;
}
} |
Form.cs:
|
private void ColorPickerButton_ColorSelected(object sender, EventArgs e)
{
var obj = sender as ColorPickerButton;
obj.BackColor = obj.SelectedColor;
obj.Text = new Localizer().LocalizatedName(obj.SelectedColor.Name.ToString());
obj.ForeColor = Color.White;
} |
Sample : https://www.syncfusion.com/downloads/support/forum/157828/ze/ColorPickerButton_Check2062809524
Screenshot :
Regards,
Niranjan Kumar Gopalan
DP
daniel peña
September 15, 2020 05:18 PM UTC
Thanks Niranjan,
It worked like a charm :).
Best regards,
Daniel P.
NI
Ninja
Syncfusion Team
September 16, 2020 05:44 AM UTC
Hi Daniel,
Thanks for your update.
We are glad to know the reported query has been resolved at your end. We are happy to assist you always.
Regards,
Niranjan Kumar Gopalan
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
- Marked answer
-
DP daniel peña
- Sep 13, 2020 06:19 PM UTC
- Sep 16, 2020 05:44 AM UTC