Translate the Tab-Menue

Mar 30, 2009 at 1:45 PM
Hi,
i want to translate the TabMenue (The Menu you'll get when you click an the little Arrow next to the pinning-button) into german language.
Is there any simple way to do this or is the only way to recompile the whole control ?

Thanks
Mar 30, 2009 at 2:23 PM
Hi,
use ContextMenuElement to override default context menus.
Put a resource like this in a dictionary visible from AvalonDock (change Prova1,2 etc with your entries):
<ContextMenu
x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:ContextMenuElement.DockablePane}}"
>
<MenuItem Header="Prova1"
Command="ad:DockableContent.FloatingCommand" />
<MenuItem Header="Prova2"
Command="ad:DockableContent.ShowAsDocumentCommand" />
<MenuItem Header="Prova3"
Command="ad:DockablePane.ToggleAutoHideCommand" />
<MenuItem Header="Prova4"
Command="ad:DockableContent.HideCommand" />
</ContextMenu>
Starting from v.1.2 AD will support also ContextMenuElement.DocumentPane and ContextMenuElement.FloatingWindow, to customize DocumentContent/FloatingWindow context menus respectively.
In the near future I'm planning to add globalization feature to AvalonDock, so it will automatically recognize the culture from the system.
Ado

From: [email removed]
Sent: Monday, March 30, 2009 2:46 PM
To: [email removed]
Subject: Translate the Tab-Menue [AvalonDock:51706]

From: meisteralex

Hi,
i want to translate the TabMenue (The Menu you'll get when you click an the little Arrow next to the pinning-button) into german language.
Is there any simple way to do this or is the only way to recompile the whole control ?

Thanks
Mar 30, 2009 at 3:14 PM
Great !

Thank you very much !
Sep 16, 2009 at 5:22 AM

For Russian ContextMenu I create this resources:

<ContextMenu x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:ContextMenuElement.DockablePane}}">
            <MenuItem Header="Открепить"
                      Command="ad:DockableContent.FloatingCommand" />
            <MenuItem Header="Вложить в закладки"
                      Command="ad:DockableContent.ShowAsDocumentCommand" />
            <MenuItem Header="Авто сокрытие"
                      Command="ad:DockablePane.ToggleAutoHideCommand" />
            <MenuItem Header="Скрыть"
                      Command="ad:DockableContent.HideCommand" />
        </ContextMenu>
        <ContextMenu x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:ContextMenuElement.FloatingWindow}}">
            <MenuItem Header="Сделать плавающим"
                      Command="ad:FloatingWindow.SetAsFloatingWindowCommand" />
            <MenuItem Header="Сделать прикрепляемым"
                      Command="ad:FloatingWindow.SetAsDockableWindowCommand" />
            <MenuItem Header="Сделать как закладка"
                      Command="ad:FloatingWindow.TabbedDocumentCommand" />
            <MenuItem Header="Закрыть"
                      Command="ad:FloatingWindow.CloseCommand" />
        </ContextMenu>
        <ContextMenu x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type ad:DockingManager}, ResourceId={x:Static ad:ContextMenuElement.DocumentPane}}">
            <MenuItem Header="Закрыть"
                      Command="ApplicationCommands.Close" />
            <MenuItem Header="Закрыть все кроме этого"
                      Command="ad:DocumentPane.CloseAllButThisCommand" />
            <Separator />
            <MenuItem Header="Разделить окно горизонтально"
                      Command="ad:DocumentPane.NewHorizontalTabGroupCommand">
                <MenuItem.Icon>
                    <ad:AlignedImage VerticalAlignment="Center"
                                     HorizontalAlignment="Center">
                        <Image Source="/AvalonDock;component/resources/Images/HTabGroup.png"
                               Width="13"
                               Height="14" />
                    </ad:AlignedImage>
                </MenuItem.Icon>
            </MenuItem>
            <MenuItem Header="Разделить окно вертикально"
                      Command="ad:DocumentPane.NewVerticalTabGroupCommand">
                <MenuItem.Icon>
                    <ad:AlignedImage VerticalAlignment="Center"
                                     HorizontalAlignment="Center">
                        <Image Source="/AvalonDock;component/resources/Images/VTabGroup.png"
                               Width="13"
                               Height="14" />
                    </ad:AlignedImage>
                </MenuItem.Icon>
            </MenuItem>
        </ContextMenu>
Sep 16, 2009 at 9:12 PM

Ado,

 

I just downloaded 1.2.  Would you please show an example on how to translate the the menu items using ContextMenuElement.DocumentPane and ContextMenuElement.FloatingWindow?

 

Thanks.

 

PS.  I ran AvalonDockTest as is, clicked on File --> Reset and the "Home" tab disappeared.  Oops.  Something is not right there.

Sep 17, 2009 at 7:54 AM

Hi acohen,

take look at russian translation of Calabonga just above your question, He is already using ContextMenuElement.DocumentPane and ContextMenuElement.FloatingWindow :)

Regarding the Reset menu item, if you see the code behind, it close the active document (the home) and reset current color schema, its a just a simple test of the ColorFactory class.

 

Ado

 

 

Sep 17, 2009 at 7:20 PM

Thanks, Ado.

I'm only having one problem.  I'm able to override the DockablePane and the DocumentPane context menus, but not the FloatingWindow.  If I put Calabonga's FloatingWindow menu into your Demo.xaml's resources (right after your sample commented-out ContextMenu), it does not seem to override the context menu using my text.  If I uncomment your sample, that works fine.

The context menu I'm looking at is after I make the dockable pane a floating window, and then right click on the title bar.  This context menu always seems to show up in your text, unless I'm doing something wrong. 

Sep 10, 2012 at 11:32 AM

Hello,

I work with the lasted version and I search for translate context menu in French..

Have you found the solution for this translation ?

Thanks you advance for your help.