Can you Localize menuitems in xaml?

6 posts, 1 answers
  1. Alex
    Alex avatar
    141 posts
    Member since:
    Mar 2010

    Posted 31 Mar 2010 Link to this post

    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)
  2. Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 01 Apr 2010 Link to this post

    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.
  3. DevCraft banner
  4. Alex
    Alex avatar
    141 posts
    Member since:
    Mar 2010

    Posted 06 Apr 2010 Link to this post

    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?
  5. Answer
    Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 09 Apr 2010 Link to this post

    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.
  6. Alex
    Alex avatar
    141 posts
    Member since:
    Mar 2010

    Posted 11 Apr 2010 Link to this post

    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)?
  7. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 15 Apr 2010 Link to this post

    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.
Back to Top
DevCraft banner