#Is there a way to translate multiple headers with 1 translation
1 messages · Page 1 of 1 (latest)
Make one header that #includes all other headers and translate that
It's not necessary when you can write a trivial file that's just the #includes you want. If you have a use case that can't be solved any other way, then you have a compelling argument. Otherwise it's just multiplying the number of ways to achieve the same thing -- adding complexity to the system (= risk of bugs and corner cases) for vanishingly small benefit.
const think its a risk of bugs when they thing they would need is an array of paths instead
I dont really see any downsides to having the addTranslateC to take in multiple paths
the order of the include some times is important, some custom macros being defined before or after the include statements are important also, so basically there are lots of small cases which can all be solved by just creating a header file and write what you want there instead of creating a niche feature
this is what I do:
const c_translate = b.addTranslateC(.{
.root_source_file = b.addWriteFiles().add("stub.h",
\\#include <SDL3/SDL.h>
\\#include <SDL3/SDL_vulkan.h>
\\#include <vk_mem_alloc.h>
\\#include <dcimgui.h>
\\#include <dcimgui_impl_sdl3.h>
\\#include <dcimgui_impl_vulkan.h>
),
.target = target,
.optimize = optimize,
});