User Control Localization

  • Thread starter Thread starter Horatiu Ripa
  • Start date Start date
H

Horatiu Ripa

I have a control that has some localizable stuff on it (i.e a GroupBox.Text property).
I'm exposing this property of myGroupBox for the container designer through:
public string The_Caption
{
get {return myGroupBox.Text;}
set {myGroupBox.Text = value;}
}

Now:
I can see/modify this the text from the userControls properties designer (The_Caption property) but when it comes to Localization, I can't assign different values for different localizations to The_Caption.

I don't see a line in the container form like:
this.theuserControl.The_Caption = ((string)(resources.GetObject("$this.theuserControl.The_Caption")));

It does not depend on the Localizable property of the user control, I've tried it with both, but there's no reason for the control to be localizable, as long as I don't have inner properties that I want to localize, the only properties that I want to be localized are exposed. Anyhow I've tried with/without it and, for the property The_Caption, with none, either or both attributes: [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [Localizable(true)]
Nothing worked.

So, is it a (and which is the) way of having the container of an user control to manage at Localization the exposed property value of the contained control?
Please no silly answers.
 
Horatio,

Change your property declareation to:

[Localizable(true)]
public string The_Caption
{
get {return myGroupBox.Text;}
set {myGroupBox.Text = value;}
}


"Horatiu Ripa" <[email protected]> skrev i en meddelelse I have a control that has some localizable stuff on it (i.e a GroupBox.Text property).
I'm exposing this property of myGroupBox for the container designer through:
public string The_Caption
{
get {return myGroupBox.Text;}
set {myGroupBox.Text = value;}
}

Now:
I can see/modify this the text from the userControls properties designer (The_Caption property) but when it comes to Localization, I can't assign different values for different localizations to The_Caption.

I don't see a line in the container form like:
this.theuserControl.The_Caption = ((string)(resources.GetObject("$this.theuserControl.The_Caption")));

It does not depend on the Localizable property of the user control, I've tried it with both, but there's no reason for the control to be localizable, as long as I don't have inner properties that I want to localize, the only properties that I want to be localized are exposed. Anyhow I've tried with/without it and, for the property The_Caption, with none, either or both attributes: [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [Localizable(true)]
Nothing worked.

So, is it a (and which is the) way of having the container of an user control to manage at Localization the exposed property value of the contained control?
Please no silly answers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top