Bug 1604

Summary: found_in_addressbook "From" in "Any" in non english local
Product: Claws Mail (GTK 2) Reporter: Paul CtrlAltBs <nrzi>
Component: FilteringAssignee: wwp <wwp>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 3.3.1   
Hardware: PC   
OS: Linux   
Attachments:
Description Flags
patch_one
none
patch rev1 (core and core plugins)
none
patch rev1 (non-core plug-ins) none

Description Paul CtrlAltBs 2008-05-07 16:12:33 UTC
(found_in_addressbook "From" in "Any") don't work when local isn't en_EN.

(found_in_addressbook "From" in "") work normal in any local.
(found_in_addressbook "From" in "some_book") work normal in any local.

Why? I think this is gettext().
In config "Any" stored as "Any". But then is _("Any") in some place!

I make patch. And now work normal in my local. See, please.

Oh! This bug maybe in some other place. Search _("Any") in src/.
Some plugin this contain. But not anythere is bug.
Example, prefs_matcher.c is good.

I don't know about:
addressbook_foldersel.c (391)
plugins bogofilter,dillo_viewer,spamassassing
Comment 1 Paul CtrlAltBs 2008-05-07 16:14:25 UTC
Created attachment 581 [details]
patch_one
Comment 2 wwp 2008-05-07 17:01:41 UTC
Would you mind describing a simple scenario that would explain what you mean by "don't work", because it don't see what's wrong. And even with your patch applied (which sounds incomplete anyway) I see no behaviour change.

Note that by design the word "Any" has to remain untranslated (i.e. in en_US) in the condition string as well as when it's stored in the config file. "Any" is a reserved keyword in the matcher expression language. Otherwise it would not be possible to swap the locale and make the Condition Configuration dialog updated from the condition string correctly.
Comment 3 Paul CtrlAltBs 2008-05-08 11:22:18 UTC
"don't work" == don't filtering

I'm make rule
(found_in_addressbook "From" in "Any" move #mh/mail/KNOWN)
and this is don't work. In log write - don't mathed,
in debug some GTK error.

_("Any") in my local return "&#1051;&#1102;&#1073;&#1086;&#1081;". And in some place don't work test:

if (action->destination == NULL ||
   strcasecmp(action->destination, _("Any")) == 0 ||
   *(action->destination) == '\0')
   path = NULL;

action->destination = "Any", but _("Any") = "&#1051;&#1102;&#1073;&#1086;&#1081;".

Excuse, now I very busy. I think this bug many users see.
Well, I write detailed later (~1 month). And my English very bad.

If who have some bug - write (found_in_addressbook "From" in "").
Comment 4 wwp 2008-05-09 09:27:44 UTC
I see. What is your locale exactly? (output of the command `locale`)
Comment 5 Paul CtrlAltBs 2008-05-09 09:56:21 UTC
> I see. What is your locale exactly? (output of the command `locale`)

LANG=ru_RU.UTF-8

And i think problem in this (or _("Any")):

ru.po:
msgid "Any"
msgstr "&#1051;&#1102;&#1073;&#1086;&#1081;"

fr.po:
msgid "Any"
msgstr "Quelconque"
Comment 6 Paul CtrlAltBs 2008-05-09 10:00:38 UTC
Of course, &#1051;&#1102;&#1073;&#1086;&#1081; == Luboy in russian.
This site don't correctly output UTF.
Comment 7 wwp 2008-05-09 14:19:39 UTC
Created attachment 582 [details]
patch rev1 (core and core plugins)
Comment 8 wwp 2008-05-09 14:20:27 UTC
Created attachment 583 [details]
patch rev1 (non-core plug-ins)
Comment 9 wwp 2008-05-09 14:21:44 UTC
Here's a patch candidate (rev1), would you mind testing it please? It's based on your patch, slightly modified (use of g_utf8_collate when comparing _("Any") is necessary, also fixes comparing header "All"), including plug-ins changes.
Comment 10 Paul CtrlAltBs 2008-05-09 16:28:23 UTC
Yes, work. But I use claws-mail and trayicon only. Not other
plugins (spam don't disturb).
And on bogofilter patch that say:

patching file src/plugins/bogofilter/bogofilter.c
Hunk #1 succeeded at 214 (offset -2 lines).
patching file src/plugins/bogofilter/bogofilter_gtk.c
Hunk #1 FAILED at 299.
Hunk #2 succeeded at 365 with fuzz 2 (offset -12 lines).
1 out of 2 hunks FAILED -- saving rejects to file src/plugins/bogofilter/bogofilter_gtk.c.rej

Because my version of src 3.3.1.
In other respects there are normal, work.
I make, edit and test new rule with found_in_addresbook.

---

And some more. In editor "found_in_addresbook" value of field "Header"
are untranslate. I'm not how true:
prefs_matcher.c 652
	header_addr_combo = combobox_text_new(TRUE,
			      Q_("Filtering Matcher Menu|All"), _("Any"),
			      "From", "To", "Cc", "Reply-To", "Sender", NULL);

Oh, Stop! This is add new bug. Some time later.
Comment 11 wwp 2008-05-09 16:40:57 UTC
Thanks for testing, patch will land to CVS soon.

And for:

> And some more. In editor "found_in_addresbook" value of field "Header"
> are untranslate. I'm not how true:
> prefs_matcher.c 652
>         header_addr_combo = combobox_text_new(TRUE,
>                               Q_("Filtering Matcher Menu|All"), _("Any"),
>                               "From", "To", "Cc", "Reply-To", "Sender", NULL);
> 
> Oh, Stop! This is add new bug. Some time later.

yes a new bug is welcome but keep in mind that only "All" and "Any" will be translated, not "From" and other header values.