Bug 291764 - Set spellchecking language per contact instead of per tab
Summary: Set spellchecking language per contact instead of per tab
Alias: None
Product: telepathy
Classification: Frameworks and Libraries
Component: text-ui (show other bugs)
Version: git-latest
Platform: Unlisted Binaries Linux
: NOR wishlist
Target Milestone: Future
Assignee: Telepathy Bugs
: 303649 (view as bug list)
Depends on:
Reported: 2012-01-17 11:53 UTC by Elias Probst
Modified: 2013-12-28 10:25 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:
ddomenichelli: Usability+
ddomenichelli: Decision-Required+


Note You need to log in before you can comment on or make changes to this bug.
Description Elias Probst 2012-01-17 11:53:23 UTC
Version:           git-latest
OS:                Linux

Make it possible to set the language per contact (persistent) instead of per chat tab.
This should only apply to 1:1 chats, but not to group chats.

See also the following IRC log for some discussion details:
<alin> drf__: you remember sometime ago d_ed martin helped to get my idea about tab based spelling in...
<alin> drf__: now what do you think about extending this to something like a setting for the contact... we can have some property in the contact model... with the language which we shall use for spelling for each contact
<alin> is this difficult to implement?
<eliasp> alin: good idea, as currently I'm using multiple languages within a single account and simply setting a language for a contact would be way better
<alin_> eliasp: by the way at the moment you can set the spelling language for each tab
<eliasp> alin_: yes, I know... but it isn't sticky, isn't it?
<alin_> eliasp: of course this will not work for group chats...
<alin_> eliasp: but to be sincere I did not manage to start a group chat yet
<eliasp> alin_: sure, group chats need to stay as it currently is
<eliasp> alin_: the question is just: to which component does this wish go? common-internals? where does the contacts model reside?
<alin_> eliasp: text-ui
<alin_> eliasp: this is where the user sees it
<eliasp> alin_: ok
<alin_> eliasp: the implementation we still have to decide it...
<alin_> eliasp: I do not know exactly what data is stored in these models we may already have this field
<alin_> drdanz: do you know the model for a contact?

Reproducible: Didn't try

Expected Results:  
See initial description
Comment 1 Martin Klapetek 2012-01-17 12:25:30 UTC
This should be fairly easy and does not really involve models.

You can just save the dict-contact pair into config file and simply load it and set it while opening chats.
Comment 2 Daniele E. Domenichelli 2012-01-17 13:19:42 UTC
That should do the trick for now, but it would be really interesting to support this in the ontology and have an accessor method on the aggregation library...
Comment 3 Elias Probst 2012-01-17 14:18:11 UTC
I'm wondering what happened to the automatic language detection in the Sonnet library? If I remember this was nearly finished ~5 years ago or so and it looked really good, but then Jacob Rideout suddenly disappeared.

With language detection, all this wouldn't be needed anymore, correct?
Comment 4 Daniele E. Domenichelli 2012-07-19 06:27:31 UTC
*** Bug 303649 has been marked as a duplicate of this bug. ***
Comment 5 Martin Klapetek 2012-07-19 09:06:57 UTC
@Elias - tbh, I have no clue. I also have a feeling that several languages in one message could easily confuse it (for example czech language uses quite some words from english, german, polish or slovak..furthermore consider all slavic languages, which are very similar).

However I still maintain the statement that his is easy to do, I'll even mark it as JJ. Maybe I'll get around doing it myself ;)
Comment 6 nickl 2012-09-17 22:32:13 UTC
To avoid confusion there can be one or more algorithms:
One possible approach:
if you detect a word that can be in different languages, you could parse and check the language of other words in the same sentence to find out.
You have the word "Bravo". This word might be considered as English, Italian or German, or part of even more languages.
You could check other words in the sentence: 
f.e: "Bravo, you are smart"- language detection:English
If there are not any other words, you make detection based on previous possible language detections.
If this is the first message, you spellcheck in English.
Of course, this is just an idea.
Comment 7 Martin Klapetek 2012-09-17 22:40:52 UTC
I'm happy to review any patches doing this (though I believe the proper place for this is Sonnet), but please start any further discussion about auto-spellcheck-language detection in a new, separate bug. Thanks.
Comment 8 nickl 2012-09-22 16:36:49 UTC
Ok Martin, there can be a big discussion about auto spell-checking after all!!
As about this specific bug here,I am working on this right now, trying to fix it.
Comment 9 nickl 2012-09-24 15:42:18 UTC
The code for this one is ready.I will send it for review probably today or tomorrow.
I am saving the pair <targetId,option> to avoid that two contacts have the same name.
Comment 10 nickl 2012-09-25 19:57:13 UTC
Code is now sent for review (in git reviewboard).
Comment 11 m.wege 2012-09-27 21:04:43 UTC
Does this solution store the spell checking in the contact so that this could be used for determining the spell checking language in Kmail too? Would be cool, if the solution for telepathy contacts could also solve this for Kmail.
Comment 12 Martin Klapetek 2012-09-27 21:08:41 UTC
Not really, no. KMail can load it up though, but at the moment there doesn't exist any connection between KMail's contacts and Telepathy contacts. There will be however in the future. But that's for another bug report (against not-yet existing component ;)
Comment 13 Daniele E. Domenichelli 2012-09-28 07:21:47 UTC
Actually before we can do anything, it should be supported by PIMO/Shared Desktop Ontology. So the component already exists ;)
I opened a ticket upstream: https://sourceforge.net/apps/trac/oscaf/ticket/142
Comment 14 David Edmundson 2012-09-28 11:08:21 UTC
> Git commit 0e7a48a466f93e3e1732b10e136fc044eecec201 by David Edmundson, on behalf of Nick Lou.
> Committed on 28/09/2012 at 01:20.
> Pushed by davidedmundson into branch 'master'.
> Save and restore spell check language used.
> Save and restore the spell check language for a particular contact if different to the system default
> REVIEW: 106575
> M  +33   -2    lib/chat-widget.cpp
> M  +6    -0    lib/chat-widget.h
Comment 15 Daniele E. Domenichelli 2012-10-11 20:19:10 UTC
I made a proposal here [1], but we need to decide whether we need what we want to achieve before closing this bug, so I'm reopening it

Method 1: The user sets the language manually and we store it in Nepomuk so that we can use it in ktp and in kmail

Method 2: We use an automatic detection of the language (I believe that Sonnet can do that already) and we don't store it. I think that Kopete used this approach.

Method 3: We use an automatic detection of the language and store it in Nepomuk anyway so that the next time we start with the right language (possibly). We can combine this with the dropdown menu to choose the language manually.

Methods 1 and 3 require extra stuff in the ontology therefore we need to discuss the required changes upstream (see [1]).

What do you think?

Comment 16 David Edmundson 2012-10-26 06:50:51 UTC
Can we not reopen bug reports to discuss new things, it breaks the changelogs.

Thanks for chasing this up, please open a new bug on kpeople instead
(FYI, auto detection of language was something promised, but never materialised)
Comment 17 Martin Klapetek 2013-12-28 10:25:52 UTC
Some news about Sonnet's language detection --> http://lists.kde.org/?l=kde-core-devel&m=138808061808894&w=2