Hello, I want to localize a program I already written.. It's fairly big (almost 50k lines) and ideally I want a system that allows me (the programmer) to do the least amount of work possible, and without major changes to the program - if possible none at all.
I looked at gettext() and liked it a lot, but it's unclear to me how it would translate strings such as these:
const char *Colors[] = {
{ "Red" },
{ "Blue" },
{ "Yellow" },
....
};
which are VERY common in my program.. Here replacing "Red" with gettext("Red") would obviously not work.
So I thought I would do something like, OutputFunction(gettext(Colors[Id])), but then how can I get a list of strings to localize? I doubt any program is smart enough to be able to get "Red", "Blue", "Yellow" from that in a to-localize list statically.
Since it's basically a server there is no need for the ability to change the language without recompiling (I can compile it for every supported language without any major problem or annoyance), I thought about C++0x's constexpr, which would be perfect! It would work in arrays/etc and I would easily get a list of strings to localize at compile time.. Too bad that no compiler implemented it yet.
Changing all the strings to an ID is not an option since it would require a massive amount of work on my part and especially creating a new id for every new string would be annoying as hell. The same applies to converting all the arrays like the one above to something else.
So, any ideas? :/