Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for translating the output messages #52

Open
andy5995 opened this issue Dec 8, 2017 · 1 comment
Open

Adding support for translating the output messages #52

andy5995 opened this issue Dec 8, 2017 · 1 comment

Comments

@andy5995
Copy link
Contributor

andy5995 commented Dec 8, 2017

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
Copy link
Contributor Author

andy5995 commented Sep 3, 2018

Some additional info on this LQ forum thread:

[C++] marking keywords for use with xgettext

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant