.NET

Reply
Contributor
tbrammer
Posts: 18
Registered: ‎07-20-2011
Message 1 of 8 (256 Views)
Accepted Solution

Modify Tooltips of RibbonItems

256 Views, 7 Replies
01-09-2014 08:08 AM

We want to deliver a language independend CUIX-File and translate the UI at runtime after loading the CUIX like this:

 

foreach (RibbonTab tab in ComponentManager.Ribbon.Tabs)

{

       foreach (RibbonPanel panel in tab.Panels)

       {

             foreach (RibbonItem item in panel.Source.Items)

              {

                    TransRibbonItem(item);

              }

       }

}

 

TransRibbonItem(item)should translate the Item text displayed in the UI as well as the tooltip text.

I found a good way to translate RibbonItem texts. But the only solution I found to translate tooltips is the approach that Kean Walmsley posted in his blog here and here.

 

This solution has some drawbacks:

  • It uses Autodesk.Internal.Windows.ToolTip, which Kean rates as "risky".
  • It can not be used in my TransRibbonItem(item) function because it uses an ToolTipOpened event-handler that modifies a tooltip just when it is created.
  • I found that this mechanism does not work very well in AutoCAD 2014: When a tooltip is created the first time, the handler is called before it is completely initialized. The posted solution reloads the tooltip in this case - which leads to a delay and display flash.

Any Ideas?

 

Cheers

--Thomas

*Expert Elite*
dgorsman
Posts: 5,145
Registered: ‎10-12-2006
Message 2 of 8 (243 Views)

Re: Modify Tooltips of RibbonItems

01-09-2014 12:14 PM in reply to: tbrammer

Users aren't switching languages frequently, if ever past the installation.  That makes real-time translation each time, every time unnecessary.  You might want to consider something that makes the translation *once*, then does something like re-points/re-loads the CUIx with a translated copy, if not using it as an internal development tool to quickly generate language specific CUIx files for distribution.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
Adopt. Adapt. Overcome. Or be overcome.
A good question will be halfway to a good answer.


Contributor
tbrammer
Posts: 18
Registered: ‎07-20-2011
Message 3 of 8 (223 Views)

Re: Modify Tooltips of RibbonItems

01-10-2014 12:36 AM in reply to: dgorsman
I agree. This is exactly what I told our product manager.
This issue is not about "switching languages at runtime" but about language independend setup and deployment.
And our setup guys insist upon this approach.

So I still need a solution.

--Thomas
*Expert Elite*
dgorsman
Posts: 5,145
Registered: ‎10-12-2006
Message 4 of 8 (187 Views)

Re: Modify Tooltips of RibbonItems

01-13-2014 07:50 AM in reply to: tbrammer

*facepalm*  Good luck.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
Adopt. Adapt. Overcome. Or be overcome.
A good question will be halfway to a good answer.


Contributor
tbrammer
Posts: 18
Registered: ‎07-20-2011
Message 5 of 8 (182 Views)

Re: Modify Tooltips of RibbonItems

01-13-2014 08:46 AM in reply to: tbrammer

(In the meantime this has been escalated to DevSup. But the link to DevSup doesn't work and I can't find it in my "Cases". So I add here...)

 

I have an additional question:

As for ribbonitems and tooltips I need to translate toolbars. Toolbars have names that are displayed as tooltip if you hover the mousepointer over the toolbar. See attached screenshot. The names are also visible in the list of available toolbars that pops up when you click on the “AcToolbarsCheckList” ribbon-button.

 

How can I translate these toolbar names at runtime?

 

 Toolbars.png

 

Note: This screenshot was taken after a test-version of my translation function was run. It replaces each item's UI-text with the item's ID.

ADN Support Specialist
Balaji_Ram
Posts: 669
Registered: ‎03-21-2011
Message 6 of 8 (159 Views)

Re: Modify Tooltips of RibbonItems

01-15-2014 10:24 PM in reply to: tbrammer

Hi Thomas,

 

Sorry, there is no inbuilt mechanism in the API to do such runtime translation.

 

As you may be aware, AutoCAD also does not permit switching languages at runtime.

 

Regards,

Balaji



Balaji
Developer Technical Services
Autodesk Developer Network

Contributor
tbrammer
Posts: 18
Registered: ‎07-20-2011
Message 7 of 8 (149 Views)

Re: Modify Tooltips of RibbonItems

01-16-2014 01:08 AM in reply to: Balaji_Ram

@Balaji_Ram:

 

  > Sorry, there is no inbuilt mechanism in the API to do such runtime translation.

 

Your statement is very general. Do you mean that there is

 

  1. no _other_ mechanism to translate tootips 
  2. absolutely no mechanism to translate toolbars at all

at runtime?

 

I have attached a test project. If you want to try it:

 

Build the project, netload the RibbonTranslate.dll in AutoCAD.

Enter command “TRANSRIB”

Press RETURN at the „Messagefile:“ prompt.

Enter “ID” at the “Language:” prompt.

The function will translate the ribbon menu items and tooltips with the approach pointed out in my first posting.

 

--Thomas

ADN Support Specialist
Balaji_Ram
Posts: 669
Registered: ‎03-21-2011
Message 8 of 8 (137 Views)

Re: Modify Tooltips of RibbonItems

01-16-2014 01:20 AM in reply to: tbrammer

There may be workarounds to do this but I am not aware of it.

 

What I meant in my previous reply was that there is no direct way designed right into the API to do such translation.

 

What you are using is a workaround and can stop working / behave differently in any of the AutoCAD releases as that event handler was not specifically meant for such runtime translation.

 

Regards,

Balaji



Balaji
Developer Technical Services
Autodesk Developer Network

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community