hldig icon indicating copy to clipboard operation
hldig copied to clipboard

Adding support for translating the output messages

Open andy5995 opened this issue 6 years ago • 1 comments

Although I've added some support for translating the output messages using gettext, I haven't completed the process yet. Now I wonder if a different method should be used. I have used used gettext before with a C program, but not a C++ program. I wonder if there are alternate solutions that should be considered. Does anyone have suggestions about this?

I've done some searching, but haven't found answers yet to how this would be done

Using gettext with a C program, a string would be marked like this:

printf (_("I am %d years old and my zipcode is %d\n"), age, zipcode);

But that wouldn't work with a C++ cout string.

cout << "I am " << age << " years old and my zipcode is " << zipcode;

There would have to be marks around each string within the quotation marks... or would there? I couldn't find any info about it that made sense.

Or maybe implementing tinyformat.h should be an option.

tinyformat.h is a type safe printf replacement library in a single C++ header file. If you've ever wanted printf("%s", s) to just work regardless of the type of s, tinyformat might be for you.

andy5995 avatar Dec 08 '17 21:12 andy5995