GnuCash
Contact   Instructions
Bug 797850 - Account register credit/debit column headings untranslated
Summary: Account register credit/debit column headings untranslated
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Engine (show other bugs)
Version: 4.0
Hardware: PC All
: Normal normal
Target Milestone: ---
Assignee: core
QA Contact: core
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-07 14:22 EDT by Christian Stimming
Modified: 2020-07-08 07:27 EDT (History)
4 users (show)

See Also:


Attachments

Description Christian Stimming 2020-07-07 14:22:12 EDT
In 4.0 (and for some time), the credit/debit column headings in the register are untranslated / missing translation. It's only the credit/debit columns, not any other columns.

Turns out these strings come from libgnucash/engine/Account.cpp and there the static variables 

std::map<GNCAccountType, const char*> gnc_acct_debit_strs = {
    { ACCT_TYPE_BANK,       _("Deposit") }, ...

and gnc_acct_credit_strs. The cause of the error is the "static initialization order fiasco" of C++. Now it is ok in C++ to call functions in the initialization of the static variables. However, those function calls apparently occur before the actual translation system has been set up and is pointing to the correct translation catalogs. Hence they just return the untranslated strings, store those in the static variables, and those are never changed again.

My proposed fix: Make the translation in the actual accessor function gnc_account_get_debit_string()  and get_credit_string, and not in the initialization of the static variable.

Sounds ok?
Comment 1 John Ralls 2020-07-07 15:36:53 EDT
Good catch. Hardly a fiasco, static initialization is done before startup so it's expected behavior.

Fixed, just as you proposed.
Comment 2 Christian Stimming 2020-07-08 07:27:26 EDT
The wording referred to this explanation of the issue https://isocpp.org/wiki/faq/ctors#static-init-order

Thanks for fixing it!

Note You need to log in before you can comment on or make changes to this bug.