Re: Use of #define statements with translatable strings

Derek Atkins derek at
Sun Mar 31 17:28:08 EDT 2013

Perhaps you need _() instead of N_()?


Sent from my HTC smartphone

----- Reply message -----
From: "Alex Aycinena" <alex.aycinena at>
To: "gnucash-devel" <gnucash-devel at>
Subject: Use of #define statements with translatable strings
Date: Sun, Mar 31, 2013 5:22 PM

I have prepared a small patch to modify the menu/toolbar labels and
tooltipsfor registers depending on whether the current cursor class is
transaction or a split: if the cursor is on a transaction, the Transaction
Menu items are labelled 'Cut Transaction', 'Copy Transaction' etc., as has
always been the case, but if it is on a split, the labels change to 'Cut
Split', 'Copy Split' etc. which better describes what the menu item
actually does (I recall confusion about this on the lists in the past).

In order to not duplicate the translatable strings in more than one place
in the code, I used define statements such as:

#define CUT_TRANSACTION_LABEL         N_("Cu_t Transaction")
#define COPY_TRANSACTION_LABEL        N_("_Copy Transaction")
#define CUT_SPLIT_LABEL               N_("Cu_t Split")
#define COPY_SPLIT_LABEL              N_("_Copy Split")

This worked fine in my environment, which is English, and I was ready to
commit the change when it occurred to me to check other languages. So I
started gnucash in German and all the text was in German except these were
in English.

I'm not sure how the translation process works (gettext?) in the build
process but I was expecting to see 'Cut Transaction', 'Copy Transaction'
etc. in German, since translations already exist for them and 'Cut Split',
'Copy Split' etc. in English, since they are new strings and there probably
would not be German translations for them already in the system (po files?).

So I assumed that #define statements with translatable strings are not to
be used.

I replaced the defines for just 'Cut Transaction' and 'Copy Transaction'
back to the way it was before to confirm my suspicion and when I recompiled
and reinstalled and ran it in German, I still got the menu affected items
in English, including these two. So I am confused. Perhaps since these
strings are in the code twice, the translation works on a 'per copy' basis
and the first instance, which is when the menu item is defined, is
translated, and the second, which is in my new code after determining the
cursor type, is not and overwrites the first so that I never see it in

Can anyone help me out here? I'm not sure how to proceed.

gnucash-devel mailing list
gnucash-devel at

More information about the gnucash-devel mailing list