Automatic Menu Creation

Automatic Menu Creation

Kyudos
Collaborator Collaborator
219 Views
4 Replies
Message 1 of 5

Automatic Menu Creation

Kyudos
Collaborator
Collaborator

I'm about to start localising my ARX, which is pretty straightforward from the "application" side (resources, string tables etc.) but honestly dealing with multiple CUIX files and having to keep them aligned and updated, plus needing to keep translations in more than one place is a bit of a PITA.

 

I'm toying with the idea of writing code to create our menus / toolbars / ribbons etc.  - basically all the CUI stuff. That way the 'translation' is handle automatically on the 'easy' app side of things. I'm not familiar with the relevant APIs though - so if anyone IS more conversant with them - is this even a practical idea?  Can everything CUI even be done in code (e.g., double-click actions, shortcut menus etc.)

0 Likes
220 Views
4 Replies
Replies (4)
Message 2 of 5

daniel_cadext
Advisor
Advisor

I think the ribbon API is .NET only. Menus and toolbars are accessible VIA ActiveX. I just got finished wrapping these for Python and I gotta say, C++ and Automation is so eeewwwww!

 

A CUIx is just a zip file of XML files. I would consider a building a base CUIx, possibly with the strings to be translated tagged/marked that I could use to find a replace. Then make a script to generate CUIx for all the languages you would like to support

 

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 3 of 5

Kyudos
Collaborator
Collaborator

Yeah that seems to be the potential best way forward - a set of "template" CUI files with strings I can find-and-replace to generate each language version automatically. I'm a bit surprised that there are no tools for this already though, especially since I see xlate="true" and xlate="false" attributes in the AutoCAD CUI files - suggests someone was thinking about it at least!

0 Likes
Message 4 of 5

daniel_cadext
Advisor
Advisor

I’ve use wxWidgets translation stuff in the past, it’s based off gettext

https://docs.weblate.org/en/latest/devel/gettext.html

 

in C++ you just wrap the strings to be translated in _(“ translate me”)

you would also be able to use the same translation libraries in whatever scripting language you choose.

 

might be too much of a hassle depending on the size of your project

Python for AutoCAD, Python wrappers for ARX https://github.com/CEXT-Dan/PyRx
0 Likes
Message 5 of 5

Kyudos
Collaborator
Collaborator

A question more for the AutoDesk people....given that the CUI system can already use resources from a DLL for command icons, could CUI also use resource IDs from the string table in the resource DLL? That would definitely make localising a whole lot simpler.

0 Likes