problem in changing locale of an expression.

problem in changing locale of an expression.


I have a problem, when i change the page locale from my dropdown it dose't translate the items inside the webblock...In my webblock i have put below code in expression to create a Menu..
<ul class='menu'>
                        <li class='selected'> <a href='Exceptions.aspx'>"+Exceptions+"</a></li>
                        <li " + If(MenuId>=2, "class='selected'" ,"") + "><a href= " + If(MenuId>=2, "'Initialization.aspx'" ,"'#'") + ">"+InitiateBilling+"</a></li>
                        <li " + If(MenuId>=3, "class='selected'" ,"") + "><a href="+ If(getMenuEnableDisable(GetBillingID(),"'F','B'",GetLoggedinUserId()).Current.count.count>0,"'PreBilling.aspx'","#") + ">"+PreBilling+"</a></li>
                        <li " + If(MenuId>=4, "class='selected'" ,"") + "><a href="+ If(getMenuEnableDisable(GetBillingID(),"'B'",GetLoggedinUserId()).Current.count.count>0,"'Billing.aspx'","#") + ">"+Billing+"</a></li>
                        <li " + If(MenuId>=5, "class='selected'" ,"") + "><a href='#'>"+ConfirmedBilling+"</a></li>
                        <li " + If(MenuId=6, "class='selected'" ,"") + "><a href='BillingAudit.aspx'>"+BillingAudit+"</a></li>
when i translated this code it changes the HTML of menu but i only want to change the Menu Names.. i also tried to take Menu Names as local variables but it dose't work for me.

Does any of you know what i need to change if i want to change the language of my menu items aslo?
Hi Pratik,

Have you marked the strings with the 'Translate' behavior in the translations window?

By the way, I see you are doing stuff like MenuId=6. In the OutSystems Platform you can use Static Entities for that purpose. Take a look at this video at the Academy. They allow writing easy to read code and have the benefits inherent to strong typing.
Hi Joao,

Thanx for reply, i had also tried taking static entity instead of variables in expression and also translated them in the translation window, but when i change language from dropdown language all other elements of the page are converted but Menu Items are not converted.
My Expression is placed inside a web block contains below code inside an expression and refreshed through a Ajax refresh method.

"<ul class='menu'>
                        <li class='selected'> <a href='Exceptions.aspx'>"+ Entities.StaticMultilingualText.Exceptions +"</a></li>
                        <li " + If(MenuId>=2, "class='selected'" ,"") + "><a href= " + If(MenuId>=2, "'Initialization.aspx'" ,"'#'") + ">"+ Entities.StaticMultilingualText.InitiateBilling+"</a></li>
                        <li " + If(MenuId>=3, "class='selected'" ,"") + "><a href="+ If(getMenuEnableDisable(GetBillingID(),"'F','B'",GetLoggedinUserId()).Current.count.count>0,"'PreBilling.aspx'","#") + ">"+ Entities.StaticMultilingualText.PreBilling +"</a></li>
                        <li " + If(MenuId>=4, "class='selected'" ,"") + "><a href="+ If(getMenuEnableDisable(GetBillingID(),"'B'",GetLoggedinUserId()).Current.count.count>0,"'Billing.aspx'","#") + ">"+ Entities.StaticMultilingualText.Billing +"</a></li>
                        <li " + If(MenuId>=5, "class='selected'" ,"") + "><a href='#'>"+ Entities.StaticMultilingualText.ConfirmBilling +"</a></li>
                        <li " + If(MenuId=6, "class='selected'" ,"") + "><a href='BillingAudit.aspx'>"+ Entities.StaticMultilingualText.Billing Audit+"</a></li>
Hi Pratik,

Did you checked if inside the WebBlock you have
something that is overriding the locale or running in another context?
As a test you can also pass by input parameter the current locale and in the WebBlock Preparation use the SetLocale to force it, ensuring that you have done the translations in the translations window.
I just wanted to say that you are not the only one on this issue. I also have the same localization problem in menu item coming from static entity. That's the only place I still cannot localize by using OutSystems. Judging from the location info on the translation table, I believe I did translate the value for the static entity, but it never comes up on the menu item. Everything else worked fine. So, I am wondering what is missing.

Check if your Static Entities are set to use the translations:
Static Entity Properties > More... > Advanced > Use Translations
Hi Joao,

Thanks a lot for your help.
It worked.
I am using Service Studio Community
Double clicking on the static entity, there was a tab "Advanced", and a check box on the tab for localization.
I should have paied attention to this Advanced tab. Sorry.
Hi Joao,

Thanks a lot for your help.
It worked.