We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Multi language Add-On

Martin Walter
Enthusiast

Actually my Addon only supports german. I'd like to recognize the language of ArchiCAD and to adjust the Addon-menu entries to that language.

Is this possible or do I need different installers for each language?

How do I recognize the language of ArchiCAD with the API?

How can I change the menu text during runtime with the API?

AC22-27, Windows 11, i7-1355U, 32GB RAM, 2TB SSD
1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Hi Martin,


You don't necessarily need a different installer for each language.

You can use the function ACAPI_AddOnIdentification_Application which returns the language as one of the response fields.

And to change the menu text you can use: ACAPI_MenuItem_SetMenuItemText

 

Hope that helps,

Bernd

View solution in original post

4 REPLIES 4
Solution

Hi Martin,


You don't necessarily need a different installer for each language.

You can use the function ACAPI_AddOnIdentification_Application which returns the language as one of the response fields.

And to change the menu text you can use: ACAPI_MenuItem_SetMenuItemText

 

Hope that helps,

Bernd

kolioi
Booster

You can get the language from CheckEnvironment() like this:

GS::UniString ArchicadLanguage;
API_AddonType __ACDLL_CALL CheckEnvironment(API_EnvirParams* envir)
{
	RSGetIndString(&envir->addOnInfo.name, ID_ADDON_INFO, 1, ACAPI_GetOwnResModule());
	RSGetIndString(&envir->addOnInfo.description, ID_ADDON_INFO, 2, ACAPI_GetOwnResModule());

	ArchicadLanguage = envir->serverInfo.language;

	return APIAddon_Preload;
}

Then you can have separate resource files for each language.

 

Thanks a lot, that works fine!

One thing is missing now:

When I register a menu via

ACAPI_MenuItem_RegisterMenu(ID_MENU_STRINGS_CREATE, ID_STATUS_STRINGS_CREATE, MenuCode_UserDef, MenuFlag_Default);

I like to change the text of the status string too: ID_STATUS_STRINGS_CREATE

It seems that this does not work with the ACAPI_MenuItem_SetMenuItemText command.

How can I change the text of status strings? 

AC22-27, Windows 11, i7-1355U, 32GB RAM, 2TB SSD

I couldn't find a command to do this either. It might actually not be possible to change the status string after registering the menu item.