cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The 2025 Technology Preview Program is now live. Join today!

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

Best way to localize addons?

Carrast
Contributor

Hello everyone,

 

I was always thinking if there's a better way to do this.. I have 2 versions of my addon, international and german. I have the two .grc files:

 

Resources\RINT\addon_int.grc

Resources\RGER\addon_ger.grc

 

You cannot set up preprocessor definitions in .grc files neither in your Resources\RFIX-win\AddOn_Main.rc2 file, it simply doesn't work. However the here included ("#include "addon_int.grc.rc2") file will be later built in your addon. So you have to open this AddOn_Main.rc2 every time and comment out/set up your desired .grc.rc2 file:

 

it has to be look like this:

#include "addon_int.grc.rc2"
//#include "addon_ger.grc.rc2"

#include "addon_fix.grc.rc2"

If you include both, your resources will conflict each other.

 

Manually change lines in your "addon.vcxproj" where your resources will compile help you neither.

 

Any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Hi Carrast,

 

I also have most of my Add-Ons in English & German. I'm using this CMake template (but forked a few years ago and adapted since): https://github.com/GRAPHISOFT/archicad-addon-cmake

 

The CMakeLists.txt sets the resource path to a language specific directory "RINT" / "RGER" as you have it. But in this directories, the resource file has the same name! So it's "RINT/addon.grc" and "RGER/addon.grc" then in the "RFIX.win/AddOnMain.rc2" the file is included as "addon.grc.rc2".

 

Maybe adapting this to your setup could work too?

 

Hope that helps,

Bernd

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com

View solution in original post

3 REPLIES 3
Oleg
Expert

Just a remark not about localization, but about preprocessor definitions of the resource compiler.
Actually I think rc.exe supports preprocessor definitions in a command line.


It should work, for commanf line of AddOn_Main.rc2, like
rc /dGER  (+ other options)


#if defined (GER)
#include "addon_ger.grc.rc2"

#else 
#include "addon_int.grc.rc2"
#endif

Solution

Hi Carrast,

 

I also have most of my Add-Ons in English & German. I'm using this CMake template (but forked a few years ago and adapted since): https://github.com/GRAPHISOFT/archicad-addon-cmake

 

The CMakeLists.txt sets the resource path to a language specific directory "RINT" / "RGER" as you have it. But in this directories, the resource file has the same name! So it's "RINT/addon.grc" and "RGER/addon.grc" then in the "RFIX.win/AddOnMain.rc2" the file is included as "addon.grc.rc2".

 

Maybe adapting this to your setup could work too?

 

Hope that helps,

Bernd

Automating Archicad with Add-Ons, GDL-Objects & Python Archi-XT.com
Carrast
Contributor

Thank you Bernd!

 

This was the solution!

You have to configure your .vcxproj a bit (change the ..\ComplieResources.py INT to GER) but then it's working!

 

Best regards!