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

Can you Localize menuitems in xaml?

5 Answers 153 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 31 Mar 2010, 11:48 PM
Is it possible to localize menu item's in XAML?

I tried doing:
<telerikNavigation:RadContextMenu.ContextMenu> 
                                        <telerikNavigation:RadContextMenu Opened="RadContextMenu_Opened" Name="cm_cashsale_item"  
                                                                          ItemClick="cm_cashsale_item_ItemClick"
                                            <telerikNavigation:RadContextMenu.Items> 
                                                <telerikNavigation:RadMenuItem Header="Add" telerik:LocalizationManager.ResourceKey="cm_add"/> 
                                                <telerikNavigation:RadMenuItem Header="Edit" telerik:LocalizationManager.ResourceKey="cm_edit"/> 
                                                <telerikNavigation:RadMenuItem Header="Delete" telerik:LocalizationManager.ResourceKey="cm_delete"/> 
                                            </telerikNavigation:RadContextMenu.Items> 
                                        </telerikNavigation:RadContextMenu> 
                                    </telerikNavigation:RadContextMenu.ContextMenu> 
But to no avail.

What would be the best way to apply localization to the menu? (Preferably in XAML, as I don't particularly want to use LocalizationManager.GetString("cm_add") repeatedly in code)

5 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 01 Apr 2010, 11:58 AM
Hi Alexander Sun,

It is possible to use our localization manager to localize your string. First you should create your localization manager that knows how to get the keys. You can read how to create one from here:
http://www.telerik.com/help/silverlight/common-localization.html

Then you use it as in the code you pasted but remove the Header="Add" setter.

Let us know if you need more information.

Greetings,
Hristo
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Alex
Top achievements
Rank 1
answered on 06 Apr 2010, 05:02 AM
Hi Hristo,

I've managed to localize many other parts of my application fine, and I've checked that my resource keys are correct (they are).
Your suggestion (to remove the header) didn't work, all that happens is that the menu item becomes textless, with 0 height.


Do you have any other advice to get this working?
0
Accepted
Konstantina
Telerik team
answered on 09 Apr 2010, 08:38 AM
Hi Alexander,

Thank you for contacting us.

Attached you will find a sample project in which is illustrated how you can localize the MenuItems using CustomLocalizationManager.

If you have further questions let us know.

Regards,
Konstantina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Alex
Top achievements
Rank 1
answered on 12 Apr 2010, 12:08 AM
Hi Konstantina,

Thanks for the demo, I see what you mean now and I should be able to get it working.

I don't suppose that in future versions of the localization-manager/menu-control, there will be default support for this (with out the need for a custom localization manager)?
0
Konstantina
Telerik team
answered on 15 Apr 2010, 08:40 AM
Hi Alexander,

Thank you for your question.

Unfortunately, this cannot be implemented since there are no fixed text in the Menu control which can be localized.

If you have any other questions regarding our controls please feel free to ask again.

All the best,
Konstantina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Menu
Asked by
Alex
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Alex
Top achievements
Rank 1
Konstantina
Telerik team
Share this question
or