cerebroapp / cerebro

🔵 Cerebro is an open-source launcher to improve your productivity and efficiency
https://www.cerebroapp.com/
MIT License
8.35k stars 455 forks source link

Add default language to settings #102

Open KELiON opened 7 years ago

KELiON commented 7 years ago

Translate plugin uses default system language as default target. We should add a language dropdown in settings to allow changing this language.

Kageetai commented 7 years ago

Wonderful idea :) The default target language is for me always russian btw. Seems like it does not use the system language...

maximbaz commented 7 years ago

@Kageetai it's a bug, the workaround is to open Cerebro config file (~/.config/Cerebro/config.json on linux) and set lang property to the desired default language, then it will work. Whatever you change with Cerebro Settings only affects country, but not lang.

Kageetai commented 7 years ago

@maximbaz I did not know about this settings file and just tried it on my windows, but it was already set to en ´en´ but still translates to russian on default. I will check on my work Mac tomorrow...

maximbaz commented 7 years ago

Okay, are you trying to translate from english, and russian kicks in as a target language by default? If so, that is a bit different issue, explained in #5.

As of today, this lang setting only matters if you are translating from another language, so if you type "привет", the default language (which is english in your case) will be used as the target language.

This is how I understand it, at least :)

Kageetai commented 7 years ago

Hmm okay, understood, but how do I translate something to English? For example I am trying to translate something from Spanish, because I am currently learning it, and therefore type for example novia in en but that just shows me the English -> English

screen shot 2017-02-08 at 11 03 41
maximbaz commented 7 years ago

This is yet another issue in my mind, it's a problem of the service that is trying to guess the "source" language, and there is no way to enforce source language, so far as I can tell, maybe @KELiON can correct me.

KELiON commented 7 years ago

@Kageetai you described another problem. API of yandex.translate, that is used for translation, tries to guess source language automatically. Based on this language Cerebro tries to guess, what is target language. Examples:

Source: English System Language: English Target: Russian (just because Russian set in code as language with second priority after English)

Source: Spanish System Language: English Target: English

Source: Spanish System Language: Spanish Target: English

Problem is that API is not so good in guessing source language. I also learn Spanish and noticed that it is detected only when the input contains accents or ñ so in most cases, I have to change source language from English. The fastest way to do it just with keyboard (focus on translate results → arrow right → spa → enter).

maximbaz commented 7 years ago

Just like cerebro parses "in" to get the target language, can it also parse "from" to enforce the source language? novia in en from spani should work.

Kageetai commented 7 years ago

@KELiON hmm your last point about just changing the source language works, but I also just noticed a wrong translation from Yandex apparently with that :D I like @maximbaz 's idea

KELiON commented 7 years ago

+1, I'd add it. I just tried other language detection APIs (https://detectlanguage.com/, https://languagelayer.com/) and they also can't detect them properly in most cases

omartin commented 7 years ago

What would be the workaround on Mac to make it use another language than Russian as a translation options ?

davebrny commented 7 years ago

there might be times when you want to use a different language as the source, but if the default is set in the settings then each time you start a new search it would switch back to that default. so remembering the last used language might be a better option? that way you could use spanish as the source for a while, then switch back to your default language once you are done.

it would be good if the target language would remember its last language as well