localization in a web form


Author
Message
Eric Leissler
Eric Leissler
StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)
Group: StrataFrame Users
Posts: 0, Visits: 527
i forget

the result on www.tfi-rd.com

Verry thank's

eric

Eric Leissler
Eric Leissler
StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)
Group: StrataFrame Users
Posts: 0, Visits: 527
Verry thank's  Mike

It s running verry well

Il made in applicationbasepage.vb

Protected Sub LocalizeControls(ByVal root As Control)

For Each control As Control In root.Controls

If control.Controls.Count > 0 Then

LocalizeControls(control)

End If

If TypeOf control Is ILocalizable Then

Localization.SetLocalizationOnControl(DirectCast(control, ILocalizable))

End If

Next

End Sub

Protected Sub LocalizeControls()

LocalizeControls(Page)

End Sub

 

 

and  in my default page

Protected Sub ImageButton2_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton2.Click

If MicroFour.StrataFrame.UI.Localization.MessageLocaleID = 1036 Then

MicroFour.StrataFrame.UI.Localization.MessageLocaleID = 1033

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink1)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink2)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink3)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink4)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink5)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink6)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink7)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink0)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.Label1)

Me.Page_Load(sender, e)

End If

End Sub

Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click

If MicroFour.StrataFrame.UI.Localization.MessageLocaleID = 1033 Then

MicroFour.StrataFrame.UI.Localization.MessageLocaleID = 1036

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink1)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink2)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink3)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink4)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink5)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink6)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink7)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink0)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.HyperLink)

MicroFour.StrataFrame.UI.Localization.SetLocalizationOnControl(Me.Label1)

Me.Page_Load(sender, e)

End If

End Sub

 

Verry thanks

Best regards

Eric Smile


Eric Leissler
Eric Leissler
StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)
Group: StrataFrame Users
Posts: 0, Visits: 527
Hi, Mike

Verry thank's for your answer.

My web site is in Vb

I try to translate your solution   and i will saitd the result

best regards

Eric

Mike Carter
Mike Carter
StrataFrame Team Member (4 reputation)StrataFrame Team Member (4 reputation)StrataFrame Team Member (4 reputation)StrataFrame Team Member (4 reputation)StrataFrame Team Member (4 reputation)StrataFrame Team Member (4 reputation)StrataFrame Team Member (4 reputation)StrataFrame Team Member (4 reputation)StrataFrame Team Member (4 reputation)
Group: Forum Members
Posts: 2, Visits: 15
Hi Eric,

We are working on enhancing some of the StrataFrame functionality for the web (new features and framework enhancements). 

The issue you are facing is a result of when StrataFrame is populating the controls with localized strings (Page_Load).

There are a couple of things you can do to work-around this problem for now:

1) call this static method on all your localized controls after setting Localization.MessageLocaleID = ####; (in my case, a Label named lblHello):

Localization.SetLocalizationOnControl(lblHello);

2) To solve this more generically, in your page implement the Page_PreRender method and call a method in your ApplicationBasePage.cs to loop through all controls, and for ones that implement ILocalizable call the SetLocalizationOnControl(control) as done above

 

Example ApplicationBasePage.cs:

using MicroFour.StrataFrame.Tools;

using System.Web.Configuration;

using System.Web.UI;

using MicroFour.StrataFrame.UI;

public class ApplicationBasePage : MicroFour.StrataFrame.UI.Web.BasePage, ITypeResolver

{

protected void LocalizeControls(Control root)

{

foreach (Control control in root.Controls)

{

if (control.Controls.Count > 0)

{

LocalizeControls(control);

}

if (control is ILocalizable)

{

Localization.SetLocalizationOnControl((ILocalizable)control);

}

}

}

protected void LocalizeControls()

{

LocalizeControls(Page);

}

}

Does that help?  I can send you a working sample, if that helps.


Eric Leissler
Eric Leissler
StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)
Group: StrataFrame Users
Posts: 0, Visits: 527
HELLO

here is sombody ?

I dont have any aswer from my question

thank's

Best regard

Eric

Eric Leissler
Eric Leissler
StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)StrataFrame User (215 reputation)
Group: StrataFrame Users
Posts: 0, Visits: 527
Hi,

Well, i have a web form and on this web from i have two  imagebutton

one with french flac on the second with UK flag

i have this code  on click event

Protected Sub ImageButton2_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton2.Click

If MicroFour.StrataFrame.UI.Localization.MessageLocaleID = 1036 Then

MicroFour.StrataFrame.UI.Localization.MessageLocaleID = 1033

End If

End Sub

Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click

If MicroFour.StrataFrame.UI.Localization.MessageLocaleID = 1033 Then

MicroFour.StrataFrame.UI.Localization.MessageLocaleID = 1036

End If

End Sub

when i running this web site, i have to click   first, and i have to click a second time on the same immagebutton. After the second click,  the localization is made.

Look its not a double click but on click and after on click.

If i juste made on click, the localization does'nt running

What's the mater.??

What il forgget ?? 

Thanks 

Best regard

Eric

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search