More work with German tax categories.

2005-01-10  Christian Stimming  <stimming@tuhh.de>

	* src/report/locale-specific/us/gncmod-locale-reports-us.c,
	src/tax/us/gncmod-tax-us.c: For German tax categories, make sure
	the module name will match the de_DE locale or will fall back to
	us module name all the time.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@10408 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2005-01-10 21:37:19 +00:00
parent 353ad4978a
commit fed6508cbf
3 changed files with 34 additions and 16 deletions

View File

@ -1,3 +1,10 @@
2005-01-10 Christian Stimming <stimming@tuhh.de>
* src/report/locale-specific/us/gncmod-locale-reports-us.c,
src/tax/us/gncmod-tax-us.c: For German tax categories, make sure
the module name will match the de_DE locale or will fall back to
us module name all the time.
2004-12-31 Derek Atkins <derek@ihtfp.com>
John Ellson's patch to fix some gcc4 warnings (bug #162582).

View File

@ -33,7 +33,11 @@ int libgncmod_locale_reports_us_LTX_gnc_module_end(int refcount);
char *
libgncmod_locale_reports_us_LTX_gnc_module_path(void) {
return g_strdup("gnucash/report/locale-specific/us");
const char *thislocale = setlocale(LC_ALL, NULL);
if (strncmp(thislocale, "de_DE", 5) == 0)
return g_strdup("gnucash/report/locale-specific/de_DE");
else
return g_strdup("gnucash/report/locale-specific/us");
}
char *
@ -43,8 +47,22 @@ libgncmod_locale_reports_us_LTX_gnc_module_description(void) {
int
libgncmod_locale_reports_us_LTX_gnc_module_init(int refcount) {
/* load us tax info */
if(!gnc_module_load("gnucash/tax/us", 0)) {
/* load the tax info */
const char *thislocale = setlocale(LC_ALL, NULL);
/* This is a very simple hack that loads the (new, special) German
tax definition file in a German locale, or (default) loads the
previous US tax file. */
gboolean is_de_DE = (strncmp(thislocale, "de_DE", 5) == 0);
const char *tax_module = is_de_DE ?
"gnucash/tax/de_DE" :
"gnucash/tax/us";
const char *report_taxtxf = is_de_DE ?
"(use-modules (gnucash report taxtxf-de_DE))" :
"(use-modules (gnucash report taxtxf))";
/* The gchar* cast is only because the function declaration expects
a non-const string -- probably an api error. */
if(!gnc_module_load((gchar*)tax_module, 0)) {
return FALSE;
}
@ -53,21 +71,10 @@ libgncmod_locale_reports_us_LTX_gnc_module_init(int refcount) {
return FALSE;
}
const char *report_taxtxf;
/* This is a very simple hack that loads the (new, special) German
tax definition file in a German locale, or (default) loads the
previous US tax file. */
const char *thislocale = setlocale(LC_ALL, NULL);
if (strncmp(thislocale, "de_DE", 5) == 0) {
report_taxtxf = "(use-modules (gnucash report taxtxf-de_DE))";
} else {
report_taxtxf = "(use-modules (gnucash report taxtxf))";
}
/* load the report generation scheme code */
if(scm_c_eval_string(report_taxtxf)
== SCM_BOOL_F) {
printf("failed to load (gnucash report taxtxf)\n");
printf("failed to load %s\n", report_taxtxf);
return FALSE;
}

View File

@ -33,7 +33,11 @@ int libgncmod_tax_us_LTX_gnc_module_end(int refcount);
char *
libgncmod_tax_us_LTX_gnc_module_path(void) {
return g_strdup("gnucash/tax/us");
const char *thislocale = setlocale(LC_ALL, NULL);
if (strncmp(thislocale, "de_DE", 5) == 0)
return g_strdup("gnucash/tax/de_DE");
else
return g_strdup("gnucash/tax/us");
}
char *