[goffice] Formats: fix localization bug. #586567.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Subject: [goffice] Formats: fix localization bug. #586567.
- Date: Sun, 21 Jun 2009 17:16:43 -0400 (EDT)
commit 118d30867905902f11fae2093940481b041c414c
Author: Morten Welinder <terra gnome org>
Date: Sun Jun 21 17:16:08 2009 -0400
Formats: fix localization bug. #586567.
ChangeLog | 9 +++++++++
NEWS | 3 +++
goffice/gtk/go-format-sel.c | 12 +++++++++---
goffice/utils/go-format.c | 19 +++++++++++++------
4 files changed, 34 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 586a7bc..b94bf6d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-06-21 Morten Welinder <terra gnome org>
+
+ * goffice/gtk/go-format-sel.c (fmt_dialog_enable_widgets): Warn if
+ localization fails.
+
+ * goffice/utils/go-format.c (go_format_parse_color): Add
+ is_localized parameter and handle it. Caller changed. Fixes
+ #586567.
+
2009-06-20 Morten Welinder <terra gnome org>
* configure.in: Post-release bump.
diff --git a/NEWS b/NEWS
index 5b12bf2..0887b3a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
goffice 0.7.9:
+Morten:
+ * Fix format localization problem. [#586567]
+
--------------------------------------------------------------------------
goffice 0.7.8:
diff --git a/goffice/gtk/go-format-sel.c b/goffice/gtk/go-format-sel.c
index 989a4e4..219df9d 100644
--- a/goffice/gtk/go-format-sel.c
+++ b/goffice/gtk/go-format-sel.c
@@ -569,9 +569,15 @@ stays:
* the std formats and the custom formats in the GOFormat hash.
*/
if (page == FMT_CUSTOM && select.stamp == 0) {
- char *tmp = go_format_str_localize (go_format_as_XL (gfs->format.spec));
- format_entry_set_text (gfs, tmp);
- g_free (tmp);
+ const char *fmtstr = go_format_as_XL (gfs->format.spec);
+ char *tmp = go_format_str_localize (fmtstr);
+ if (tmp) {
+ format_entry_set_text (gfs, tmp);
+ g_free (tmp);
+ } else {
+ g_warning ("Localization of %s failed.",
+ fmtstr);
+ }
} else if (select.stamp == 0)
if (!gtk_tree_model_get_iter_first (
GTK_TREE_MODEL (gfs->format.formats.model),
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 2e7eceb..c9cadea 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -561,10 +561,12 @@ static struct {
**/
static gboolean
go_format_parse_color (char const *str, GOColor *color,
- int *n, gboolean *named)
+ int *n, gboolean *named, gboolean is_localized)
{
char const *close;
unsigned int ui;
+ const char *color_txt = N_("color");
+ gsize len;
*color = 0;
@@ -577,8 +579,9 @@ go_format_parse_color (char const *str, GOColor *color,
for (ui = 0; ui < G_N_ELEMENTS (format_colors); ui++) {
const char *name = format_colors[ui].name;
- gsize len = strlen (name);
- if (g_ascii_strncasecmp (str, format_colors[ui].name, len) == 0) {
+ if (is_localized)
+ name = _(name);
+ if (g_ascii_strncasecmp (str, name, strlen (name)) == 0) {
*color = format_colors[ui].go_color;
if (n)
*n = ui;
@@ -588,9 +591,12 @@ go_format_parse_color (char const *str, GOColor *color,
}
}
- if (g_ascii_strncasecmp (str, "color", 5) == 0) {
+ if (is_localized)
+ color_txt = _(color_txt);
+ len = strlen (color_txt);
+ if (g_ascii_strncasecmp (str, color_txt, len) == 0) {
char *end;
- guint64 ull = g_ascii_strtoull (str + 5, &end, 10);
+ guint64 ull = g_ascii_strtoull (str + len, &end, 10);
if (end == str || errno == ERANGE || ull > 56)
return FALSE;
if (n)
@@ -1021,7 +1027,8 @@ go_format_preparse (const char *str, GOFormatParseState *pstate,
if (pstate->have_color ||
!go_format_parse_color (tstr, &pstate->color,
&pstate->color_n,
- &pstate->color_named))
+ &pstate->color_named,
+ is_localized))
goto error;
pstate->have_color = TRUE;
if (all_tokens)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]