[Gnucash-changes] More work with German tax categories.
Christian Stimming
cstim at cvs.gnucash.org
Mon Jan 10 16:38:55 EST 2005
Log Message:
-----------
More work with German tax categories.
2005-01-10 Christian Stimming <stimming at 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.
Tags:
----
gnucash-1-8-branch
Modified Files:
--------------
gnucash:
ChangeLog
gnucash/src/report/locale-specific/us:
gncmod-locale-reports-us.c
gnucash/src/tax/us:
gncmod-tax-us.c
Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1461.2.382
retrieving revision 1.1461.2.383
diff -LChangeLog -LChangeLog -u -r1.1461.2.382 -r1.1461.2.383
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,10 @@
+2005-01-10 Christian Stimming <stimming at 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-29 Christian Stimming <stimming at tuhh.de>
* src/tax/us/txf-de_DE.scm: Add Tax TXF categories for the de_DE
Index: gncmod-locale-reports-us.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/locale-specific/us/gncmod-locale-reports-us.c,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -Lsrc/report/locale-specific/us/gncmod-locale-reports-us.c -Lsrc/report/locale-specific/us/gncmod-locale-reports-us.c -u -r1.7.2.1 -r1.7.2.2
--- src/report/locale-specific/us/gncmod-locale-reports-us.c
+++ src/report/locale-specific/us/gncmod-locale-reports-us.c
@@ -32,7 +32,11 @@
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 *
@@ -42,8 +46,22 @@
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;
}
@@ -52,21 +70,10 @@
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(gh_eval_str(report_taxtxf)
== SCM_BOOL_F) {
- printf("failed to load (gnucash report taxtxf)\n");
+ printf("failed to load %s\n", report_taxtxf);
return FALSE;
}
Index: gncmod-tax-us.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/tax/us/gncmod-tax-us.c,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -Lsrc/tax/us/gncmod-tax-us.c -Lsrc/tax/us/gncmod-tax-us.c -u -r1.3.2.1 -r1.3.2.2
--- src/tax/us/gncmod-tax-us.c
+++ src/tax/us/gncmod-tax-us.c
@@ -32,7 +32,11 @@
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 *
More information about the gnucash-changes
mailing list