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.

5 Replies 1 reply marked as answer

UN Unknown 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. 



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.


UN Unknown 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; 
        } 


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.


UN Unknown 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 


Loader.
Up arrow icon