Omnis Technical Note TNGI0024 June 2008

Translating and/or Replacing Built-in Omnis Menus

For Omnis Studio
By Götz Krija

Although the Omnis Studio development environment itself is completely in English, it is possible to build applications with Omnis in multiple languages. Most elements in your Omnis application can be switched dynamically using string tables (such tables contain a matrix of language strings). Some internal Omnis settings such as separators, weeks and month names can be stored in the Omnisloc.df1 (Omnis local datafile), and it is also possible to replace the built-in menus, such as the Edit menu, using the Replace standard menu command (run it from the Startup task). For example:

Replace standard Edit menu {mEdit}

In this case, mEdit is a new custom menu which contains entries in the required language for each corresponding option in the standard Edit menu. For example, a replacement Edit menu in German would have the following options, with the $event method for each menu line having the standard menu command as shown (double-click the menu line in design mode to open the method editor for $event):

&Edit (menu title)

Menu line text $event method for menu line
Zurueck Standard menu command *Edit/11001 {Undo}
Auschneiden Standard menu command *Edit/11002 {Cut}
Kopieren Standard menu command *Edit/11003 {Copy}
Einfügen Standard menu command *Edit/11004 {Paste}
Löschen Standard menu command *Edit/11005 {Clear}
Alles Auswählen Standard menu command *Edit/11006 {Select All}
Von Datei Einfügen Standard menu command *Edit/11065 {Paste From File...}
Link Einfügen Standard menu command *Edit/20000 {Paste Link}

 
Gives you the following menu class:

Replacement Edit menu

To test the replacement menu in the development environment, you can switch to runtime mode using green traffic light icon. The command Replace standard Edit menu with no parameters puts the system Edit menu back. You can add a Short cut key for each menu line option using the $winshortcutkey property, or the alternative property for the other platforms.

Download a library from Github: https://github.com/OmnisStudio/Omnis-ReplaceMenu (Studio 8.1.2 or above)
(or an archive: replace_menu.zip for Studio 4.1 or above)

Search Omnis Developer Resources

 

Hit enter to search

X