pinoaffe / org-vcard

Export and import vCards from within GNU Emacs' Org mode.
61 stars 7 forks source link

import for non-en entries #18

Closed gour closed 9 years ago

gour commented 9 years ago

Hello,

in Org-vCard menu there is option to select amongst {en,en_AU,en_US}, but I wonder what to do if I have to deal with entries having entries in Croatian language?

I did import and sort my contacts list, but the sort is not according to the rules for Croatian alphabet.

flexibeast commented 9 years ago

I did import and sort my contacts list, but the sort is not according to the rules for Croatian alphabet.

Assuming you've used Emacs' built-in sorting functionality, this is not related to org-vcard, but the collation settings being used for sorting. Could you please provide an example of a few things you've tried to sort: the unsorted list, the command you used to do the sorting, the result you expected, and the result you actually got?

More generally, the locale settings provided by org-vcard relate to what Org properties map to which vCard properties. So in the en_AU locale, the Org property MOBILE is what maps to e.g. the vCard 4.0 property TEL;TYPE="cell", but in the en_US locale, the Org property CELL maps to that same vCard property. The mappings for each locale are defined per-style; cf. the locale files for the flat style and the locale files for the tree style.

Thus, say you wanted to use the Org properties MOBITEL to map to the vCard 4.0 property TEL;TYPE="cell", ROĐENDAN to the vCard 4.0 property BDAY, etc., you'd could create a new locale file for the contacts style you're using, called 'hr_HR' and specify all the appropriate mappings accordingly. And if you would be willing to submit your locale file(s) for inclusion in the org-vcard package, that would be most welcome. :-)

gour commented 9 years ago

Could you please provide an example of a few things you've tried to sort: the unsorted list, the command you used to do the sorting, the result you expected, and the result you actually got?

Well, I wanted to sort the whole list of my contacts, so, select-all --> org-sort commands and it's sorted, I assume, according to the English alphabet rules where the contact entries which start with Croatian characters (Č,Ć,Đ,Š,Ž) are at the end of the list, iow. after 'Z' entries, although it should go like this:

A,B,C,Č,Ć,D,Dž,Đ,..S,Š,..Z,Ž
flexibeast commented 9 years ago

Well, I wanted to sort the whole list of my contacts, so, select-all --> org-sort commands

nod i'm not familiar with how org-sort works, so my suggestion would be to ask the emacs-orgmode list about how to get org-sort to use the Croatian collation rules for sorting.

Does what i wrote above about org-vcard locale mappings between Org properties and vCard properties make sense? If so, would you be willing to provide hr_HR mappings files for all three supported versions of vCard?

gour commented 9 years ago

Assuming you've used Emacs' built-in sorting functionality, this is not related to org-vcard, but the collation settings being used for sorting.

Does Emacs have support for sorting built-in?

Thus, say you wanted to use the Org properties MOBITEL to map to the vCard 4.0 property TEL;TYPE="cell", ROĐENDAN to the vCard 4.0 property BDAY, etc., you'd could create a new locale file for the contacts style you're using, called 'hr_HR' and specify all the appropriate mappings accordingly.

OK, that's how to map properties and I'll try to do that for hr_HR, but in my case I was just trying to sort the topmost entry since I can live with English mappings for a while :-)

And if you would be willing to submit your locale file(s) for inclusion in the org-vcard package, that would be most welcome. :-)

I'll certainly do that. The prospect of being able to handle/sync my contacts without the need for Evolution (now I'm back to Xfce) is too good to miss opportunity to give something back to org-vcard. ;)

gour commented 9 years ago

Does what i wrote above about org-vcard locale mappings between Org properties and vCard properties make sense?

Yep, thank you.

If so, would you be willing to provide hr_HR mappings files for all three supported versions of vCard?

Will do...just give me some time. After embracing Emacs/org-mode/mu4e there are plenty of things to learn and I've also become interested to learn Racket. :-)

flexibeast commented 9 years ago

Does Emacs have support for sorting built-in?

In various ways, yes. For example: the sort-lines command. i don't know the extent to which Emacs' built-in sorting functionality handles non-en locales though; it might be best to ask on the help-gnu-emacs list.

OK, that's how to map properties and I'll try to do that for hr_HR, but in my case I was just trying to sort the topmost entry since I can live with English mappings for a while :-)

Okay, fair enough.

I'll certainly do that. The prospect of being able to handle/sync my contacts without the need for Evolution (now I'm back to Xfce) is too good to miss opportunity to give something back to org-vcard. ;)

:-) Excellent, thank you! i've just opened a new issue specifically about adding hr_HR support.

just give me some time. After embracing Emacs/org-mode/mu4e there are plenty of things to learn and I've also become interested to learn Racket. :-)

No worries. :-)

flexibeast commented 9 years ago

Out of interest, i looked into how org-sort works, and underneath it all, in this context, it makes use of Emacs' string-lessp function. Unfortunately, this function doesn't seem to respect the value of the LC_COLLATE environment variable, such that setting it to e.g. "hr_HR.UTF-8" on my system still doesn't result in correct lexicographic sorting for Croatian. i've filed a bug about this.

flexibeast commented 9 years ago

Unfortunately, it seems you won't be able to get locale-dependent sorting until at least Emacs 25.1: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20316#17

gour commented 9 years ago

Unfortunately, this function doesn't seem to respect the value of the LC_COLLATE environment variable, such that setting it to e.g. "hr_HR.UTF-8" on my system still doesn't result in correct lexicographic sorting for Croatian.

I must say I'm a bit surprised that such mature piece of software as Emacs is failing with such basic stuff I was fighting with many years ago (era of handling text by using codepages) during my beginning years of Linux.

gour commented 9 years ago

Unfortunately, it seems you won't be able to get locale-dependent sorting until at least Emacs 25.1:

Thanks a lot for taking trouble on my behalf!!

flexibeast commented 9 years ago

Oh you're most welcome! i must say i'm surprised by the situation as well; Emacs handles so many other aspects of i18n and m17n that i initially assumed the problem was simply "finding the right setting(s)". i'm sad that's not so. :-(