Hi Geert,

I have some experience in this area. I'm not fully up to date since I haven't done it for a while.

Please see below.

Graham

On 23/04/2017 02:43, Geert Janssens wrote:
1. is there a c++ way to handle translations ? As far as I'm aware gettext
can't handle std::string objects directly, so we have to pass it the ->c_str()
function result. This is not always very nice.

Agreed - not nice. As David says, Boost.Locale is what you want. It handles std::string and, more importantly, std::wstring. There are others too.

2. c++ makes it very easy to compose strings by either summing them (strA +
strB) or streaming them (strA << strB).

Don't do this! Some things we say in English are idiomatically structured in a different way in other languages. As a very simple example, in English we might say "There are %d items in this %s". In another language, they would say "in this %s there are %d items". If you concatenate strings, this doesn't work.

4. When we throw exceptions, we pass a message explaining the reason the
exception was thrown. I have been leveraging these messages to inform the

I wouldn't worry about translating exception messages. Firstly, users should never see them. Secondly, even if they do see them, it's usually easy enough to get their meaning - most people (especially ones likely to be using GnuCash) have at least a rudimentary understanding of English. Lastly, it makes reporting of bugs more difficult. If a German user reports that they've seen error "XXX", it won't match any reports of English users seeing "YYY" even though it's the same error.

Another consideration is the set of tools to allow translations by third parties. As a developer, you want to be able to ship a set of translatable strings to a native speaker who isn't familiar with software development or GnuCash. They have to translate using some tool and ship the translated strings back to you. There are third party (some non-free) tools to do this but I can't give any recommendations there.
_______________________________________________
gnucash-devel mailing list
[email protected]
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to