2023-11-23 09:54 AM - last edited on 2024-09-17 01:17 PM by Doreena Deng
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?
Solved! Go to Solution.
2023-11-23 08:33 PM
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
2023-11-23 08:33 PM
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
2023-11-26 11:35 AM
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.
2023-12-18 11:36 AM
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?
2023-12-18 05:56 PM
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.