Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

import for non-en entries #18

Closed
gour opened this issue Apr 12, 2015 · 11 comments
Closed

import for non-en entries #18

gour opened this issue Apr 12, 2015 · 11 comments

Comments

@gour
Copy link

gour commented Apr 12, 2015

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
Copy link
Collaborator

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
Copy link
Author

gour commented Apr 12, 2015

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
Copy link
Collaborator

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
Copy link
Author

gour commented Apr 12, 2015

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
Copy link
Author

gour commented Apr 12, 2015

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Collaborator

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
Copy link
Author

gour commented Apr 13, 2015

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
Copy link
Author

gour commented Apr 13, 2015

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
Copy link
Collaborator

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. :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants