This is a migrated thread and some comments may be shown as answers.

RadTimePicker Localization Close Button Text

12 Answers 357 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Peter
Top achievements
Rank 1
Peter asked on 27 Apr 2012, 08:32 AM
Hi,

I use the RadControls for WinForms Q1 2012 SP1. I've localized my RadTimePicker Strings in C# exactly as you recommended it here. But the close button doesn't change to the localized string. Can you help me? 

Best, 

Peter 

12 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 27 Apr 2012, 09:59 AM
Hi Peter, 

Using version 2012.1.321.40 this all seems to be working as expected. If you are not on the latest version, I would suggest upgrading. Can you please try this sample. 

public Form1()
{
    InitializeComponent();
    RadTimePickerLocalizationProvider.CurrentProvider = new MyTimePickerLocalizationProvider();
}

class MyTimePickerLocalizationProvider : RadTimePickerLocalizationProvider
 {
     public override string GetLocalizedString(string id)
     {
         switch (id)
         {
             case RadTimePickerStringId.HourHeaderText: return "Hours (local)";
             case RadTimePickerStringId.MinutesHeaderText: return "Minutes (local)";
             case RadTimePickerStringId.CloseButtonText: return "Close (local)";
             default: return string.Empty;
         }
     }
 }

If this resolves your issue, please remember to mark as answer. If you need further help, please let me know
Richard
0
Peter
Top achievements
Rank 1
answered on 27 Apr 2012, 12:46 PM
The Mistake was to do it like this: 

static Form1()
{
    RadTimePickerLocalizationProvider.CurrentProvider = new MyTimePickerLocalizationProvider();
}
 
public Form1()
{
    InitializeComponent();
}

Also this doesn't work (close button doesn't get localized):

public Form1()
{
    RadTimePickerLocalizationProvider.CurrentProvider = new MyTimePickerLocalizationProvider();
    InitializeComponent();
}

Just this version works fine (everything localized):

public Form1()
{
    InitializeComponent();
    RadTimePickerLocalizationProvider.CurrentProvider = new MyTimePickerLocalizationProvider();
}


Thank you for your help.

Best,

Peter
0
Stefan
Telerik team
answered on 02 May 2012, 07:53 AM
Hello Peter,

That is correct. You need to set the localization provider after the InitializeComponent call because before this call the control is not yet initialized.

I hope this helps.
 
All the best,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
acasegra
Top achievements
Rank 1
answered on 25 May 2012, 04:48 PM
hello,
can you help to me?
  hi, im test it but close button
  case RadTimePickerStringId.HourHeaderText: return "Hora"; >>>>>>its ok
  case RadTimePickerStringId.MinutesHeaderText: return "Minutos";>>>>>>its ok
  case RadTimePickerStringId.CloseButtonText: return "Cerrar";>>>>>>don't  work
best regards.
Alfonso
0
Peter
Telerik team
answered on 30 May 2012, 11:56 AM
Hi Peter,

Thank you for contacting Telerik support.

We are aware of this issue and we provided a fix for it in our latest internal release (v2012.1.517)
As a workaround in your version you can set the localization provider after the InitializeComponent method, for example:

public partial class Form1 : Form
   {
       public Form1()
       {
           InitializeComponent();
 
           RadTimePickerLocalizationProvider.CurrentProvider = new MyRadTimePickerLocalizationProvider();
       }
   }

I hope this helps. Greetings,
Peter
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
acasegra
Top achievements
Rank 1
answered on 30 May 2012, 01:02 PM
i do it and so
the 2 first line work fine
case RadTimePickerStringId.HourHeaderText: return "Hora"; //its ok
  case RadTimePickerStringId.MinutesHeaderText: return "Minutos";//ts ok

but the 3rd dont work

  case RadTimePickerStringId.CloseButtonText: return "Cerrar"; //don't  work

best regards Alfonso
0
Peter
Telerik team
answered on 31 May 2012, 01:38 PM
Hello,

As I mentioned before, we provided a fix for it in our latest internal build (v2012.1.517)

I hope this helps.

Greetings,
Peter
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Matthew Compton
Top achievements
Rank 1
answered on 13 Jul 2012, 04:11 PM
Is there any way around upgrading the controls?  We are at a point in our dev cycle where it is not feasible. 

I was able to translate content in the CellEditorInitialized event for a RadDateTimePicker.   Is there a way to do the same with the RadTimePicker. 

I am on version v2012.1.12.215
        
RadDateTimeEditorElement editorElement = (RadDateTimeEditorElement)editor.EditorElement;
RadDateTimePickerCalendar calenderBehaviour = (RadDateTimePickerCalendar)editorElement.GetCurrentBehavior();
RadCalendar calendar = (RadCalendar)calenderBehaviour.Calendar;
calendar.TodayButton.Text = LocSystemLabels.GetString("Today");
calendar.ClearButton.Text = LocSystemLabels.GetString("Clear");
0
Stefan
Telerik team
answered on 16 Jul 2012, 01:20 PM
Hello Matthew,

Yes, there is a way. Here is how to do that:
void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e)
{
    if (e.EditorType == typeof(RadDateTimeEditor))
    {
        e.Editor = new RadTimePickerElement();
    }
}
 
void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    RadTimePickerElement el = e.ActiveEditor as RadTimePickerElement;
    if (el != null)
    {
        el.PopupOpened -= new EventHandler(el_PopupOpened);
        el.PopupOpened += new EventHandler(el_PopupOpened);
         
    }
}
 
void el_PopupOpened(object sender, EventArgs e)
{
    RadTimePickerElement el = sender as RadTimePickerElement;
    el.PopupContentElement.HoursTable.TableHeader.HeaderElement.Text = "your text here";
    el.PopupContentElement.MinutesTable.TableHeader.HeaderElement.Text = "your text here";
    el.PopupContentElement.FooterPanel.ButtonElement.Text = "your text here";
}

I hope this helps.

Kind regards,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Matthew Compton
Top achievements
Rank 1
answered on 16 Jul 2012, 07:00 PM
Great, thanks Stefan.  That does help, although I am experiencing a little different behaviour when changing this code.  When using the TimePickerEditor I am able to use the arrow keys to change the time without loading the TimePicker.  Is there a way to have the best of both worlds?

void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e)
{
    if (e.EditorType == typeof(RadDateTimeEditor))
    {
        //e.Editor = new RadTimePickerElement();
        e.Editor = new TimePickerEditor();
    }
}
0
Matthew Compton
Top achievements
Rank 1
answered on 18 Jul 2012, 05:33 PM
You can disregard this.  I am overloading the timepicker already and moved the localization code in there.   thanks for your help.
0
Stefan
Telerik team
answered on 19 Jul 2012, 12:22 PM
You are welcome. Should you have any other questions, do not hesitate to contact us.

Greetings,
Stefan
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Peter
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Peter
Top achievements
Rank 1
Stefan
Telerik team
acasegra
Top achievements
Rank 1
Peter
Telerik team
Matthew Compton
Top achievements
Rank 1
Share this question
or