translate-shell.vim icon indicating copy to clipboard operation
translate-shell.vim copied to clipboard

List of default target languages based on determined source languages

Open Rom888 opened this issue 4 years ago • 10 comments

Hi Egor,

I translate some phrases from English into Russian and from Russian into English. And I have to use :Trans :ru and :Trans :en

Is there an option to specify a list of default target languages based on determined source languages? So I would have to use only :Trans command for both cases.

Rom888 avatar Sep 13 '19 10:09 Rom888

Hi @Rom888!

For this case you can use :TransSelectDirection or :TransInteractive. These functions are more comfortable when you are using them with bindings or with fzf.

For case to determine target language based on source language. It won't work every time. For example: word "gift" has another meaning in German. It means "poison". In this case using :TransSelectDirection will be more right approach.

What's wrong with using :TransSelectDirection or :TransInteractive?

echuraev avatar Sep 16 '19 08:09 echuraev

With :TransSelectDirection I have to select languages for each translation, this is not convenient. In the case of ru-en, en-ru pairs, it is easy to determine source language, because the characters are completely different. It would be nice, if the plugin could determine a source language using the characters from the selection and automatically select a direction from g:trans_directions_list.

Rom888 avatar Sep 17 '19 09:09 Rom888

I think, it could work only with direction from variable g:trans_default_direction and only if both directions were determined e.g. let g:trans_default_direction = 'en:ru'.

In this case it will be easy to make an assumption about translate direction. But in case if there are several languages e.g. 'en:ru+de' maybe it just necessary to change order of languages. In case of translating Russian text it will be something like that: 'ru:en+de'.

I don't think that it will be a good idea to use g:trans_directions_list for determining translate direction because it can be many almost the same options there such as: 'en:ru', 'de:ru', 'en:ru+de'. And in this case if you would like to translate something from Russian, it will be difficult to make the right choice automatically.

Finally, thank you for very nice idea for feature. Personally, I usually use automatic determining of source language and just specify the target language. I'll take a look what can I do for this issue. Also, if you will have a time, you could try to do this feature and create a pull request.

Now maybe the better approach (till this feature is done) is using FZFTransSelectDirection or just change default direction for session by using :FZFTransChangeDefaultDirection when you want mostly translate from one specific language to another. I use :FZFTransChangeDefaultDirection mostly when I need to translate many Russian words to another language during one session. Did you try to use FZF functions?

echuraev avatar Sep 18 '19 05:09 echuraev

Egor, I agree that using g: trans_default_direction will be better than g: trans_directions_list, for reasons that have been voiced. Today I installed and tried fzf for the shell and for Vim, these are really cool products! I also tried the FZF functions of your plugin, but to be honest, it’s more convenient to use these keyboard layouts:

inoremap <silent> <leader>tr <ESC>:Trans :ru<CR>
nnoremap <silent> <leader>tr :Trans :ru<CR>
vnoremap <silent> <leader>tr :Trans :ru<CR>
inoremap <silent> <leader>te <ESC>:Trans :en<CR>
nnoremap <silent> <leader>te :Trans :en<CR>
vnoremap <silent> <leader>te :Trans :en<CR>

Rom888 avatar Sep 19 '19 18:09 Rom888

Hello Egor,

Using PlugInstall, I installed " translate-shell.vim " in my NeoVim (NVIM v0. 3. 4). The installation was successful.

Now I want an open terminal with interactive translate-shell. To do this in nvim, I use the following command: : TransTerm In response from nvim, I get the following: "Trans unavailable! CMD: trans". I do not know what to do next. I will be grateful for your help. Thanks.

PS. 1. My OS is Linux version 4.19.0-14-amd64 ([email protected]) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.171-2 (2021-01-30) 2. In Linux, I am an unprofessional (5 months of experience). Therefore, I will be grateful for detailed explanations. Thanks.

Kind regards, Leonid

LeoSol56 avatar Mar 20 '21 12:03 LeoSol56

Hello Egor,

Using PlugInstall, I installed " translate-shell.vim " in my NeoVim (NVIM v0. 3. 4). The installation was successful.

Now I want an open terminal with interactive translate-shell. To do this in nvim, I use the following command: : TransTerm In response from nvim, I get the following: "Trans unavailable! CMD: trans". I do not know what to do next. I will be grateful for your help. Thanks.

PS. 1. My OS is Linux version 4.19.0-14-amd64 ([email protected]) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.171-2 (2021-01-30) 2. In Linux, I am an unprofessional (5 months of experience). Therefore, I will be grateful for detailed explanations. Thanks.

Kind regards, Leonid

Hello Leonid,

It looks like you didn't install translate-shell on your system. Please take a look on this section: https://github.com/echuraev/translate-shell.vim#installation-with-vim-plug

You must download translate shell to your system: wget -O ~/.vim/trans git.io/trans && chmod +x ~/.vim/trans And after that, specify the directory with executable file: let g:trans_bin = "~/.vim"

Also, there is another option, you can specify path to executable in your PATH environment variable and in this case it won't be necessary to use g:trans_bin.

echuraev avatar Mar 21 '21 17:03 echuraev

Hello Egor,

Thank you for your answer and your recommendations, according to which I will do everything. I hope for success. I will inform you about the results of my work.

Kind regards, Leonid

вс, 21 мар. 2021 г. в 20:26, Egor Churaev @.***>:

Hello Egor,

Using PlugInstall, I installed " translate-shell.vim " in my NeoVim (NVIM v0. 3. 4). The installation was successful.

Now I want an open terminal with interactive translate-shell. To do this in nvim, I use the following command: : TransTerm In response from nvim, I get the following: "Trans unavailable! CMD: trans". I do not know what to do next. I will be grateful for your help. Thanks.

PS. 1. My OS is Linux version 4.19.0-14-amd64 ( @.***) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 https://github.com/echuraev/translate-shell.vim/pull/1 SMP Debian 4.19.171-2 (2021-01-30) 2. In Linux, I am an unprofessional (5 months of experience). Therefore, I will be grateful for detailed explanations. Thanks.

Kind regards, Leonid

Hello Leonid,

It looks like you didn't install translate-shell on your system. Please take a look on this section: https://github.com/echuraev/translate-shell.vim#installation-with-vim-plug

You must download translate shell to your system: wget -O ~/.vim/trans git.io/trans && chmod +x ~/.vim/trans And after that, specify the directory with executable file: let g:trans_bin = "~/.vim"

Also, there is another option, you can specify path to executable in your PATH environment variable and in this case it won't be necessary to use g:trans_bin.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/echuraev/translate-shell.vim/issues/12#issuecomment-803627791, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATJNO6B4JHU4Z77XQ47GGETTEYT23ANCNFSM4IWOTPXQ .

LeoSol56 avatar Mar 21 '21 17:03 LeoSol56

Hello Egor,

Please, excuse me to bother you. But your help is very necessary.

According to your recommendations, I did the following:

  1. wget -O ~/. vim/trans git.io/trans && chmod +x ~/.vim/trans
  2. @.***:~# nvim
  3. :PlugInstall echuraev/translate-shell.vim
  4. :PlugUpdate
  5. :PlugUpgrade 6.: PlugStatus (The attached file contains a screenshot) 7.: TransTerm (Nvim reports the following: Trans unavailable! CMD: trans) Again, Translate-Shell does not start. I understand that I am making a mistake(s) somewhere. But, unfortunately, I have little knowledge and experience and therefore my repeated attempts to find and correct my mistakes on my own have not been successful. I will be very grateful for your help. Thanks.

PS For you, probably, my problem seems ridiculous. But for me, this problem is unsolvable. I hope for your understanding.

Kind regards, Leonid

вс, 21 мар. 2021 г. в 20:26, Egor Churaev @.***>:

Hello Egor,

Using PlugInstall, I installed " translate-shell.vim " in my NeoVim (NVIM v0. 3. 4). The installation was successful.

Now I want an open terminal with interactive translate-shell. To do this in nvim, I use the following command: : TransTerm In response from nvim, I get the following: "Trans unavailable! CMD: trans". I do not know what to do next. I will be grateful for your help. Thanks.

PS. 1. My OS is Linux version 4.19.0-14-amd64 ( @.***) (gcc version 8.3.0 (Debian 8.3.0-6)) #1 https://github.com/echuraev/translate-shell.vim/pull/1 SMP Debian 4.19.171-2 (2021-01-30) 2. In Linux, I am an unprofessional (5 months of experience). Therefore, I will be grateful for detailed explanations. Thanks.

Kind regards, Leonid

Hello Leonid,

It looks like you didn't install translate-shell on your system. Please take a look on this section: https://github.com/echuraev/translate-shell.vim#installation-with-vim-plug

You must download translate shell to your system: wget -O ~/.vim/trans git.io/trans && chmod +x ~/.vim/trans And after that, specify the directory with executable file: let g:trans_bin = "~/.vim"

Also, there is another option, you can specify path to executable in your PATH environment variable and in this case it won't be necessary to use g:trans_bin.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/echuraev/translate-shell.vim/issues/12#issuecomment-803627791, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATJNO6B4JHU4Z77XQ47GGETTEYT23ANCNFSM4IWOTPXQ .

LeoSol56 avatar Mar 22 '21 09:03 LeoSol56

You forgot to specify path to executable of translate-shell.

And after that, specify the directory with executable file: let g:trans_bin = "~/.vim"

Also, there is another option, you can specify path to executable in your PATH environment variable and in this case it won't be necessary to use g:trans_bin.

echuraev avatar Mar 22 '21 10:03 echuraev

Dear Egor,

Thank you for your quick response.

I tried for a very long time to do everything you said, but due to lack of knowledge and experience, I could not do it. I understand that I can't and shouldn't bother you with my stupid questions anymore. So thank you for your help and I wish you success. But I still need a translation program, so I have to look for another program that I can install and use. I hope for your understanding and again apologize for the trouble.

Kind regards, Leonid

пн, 22 мар. 2021 г. в 13:33, Egor Churaev @.***>:

You forgot to specify path to executable of translate-shell.

And after that, specify the directory with executable file: let g:trans_bin = "~/.vim"

Also, there is another option, you can specify path to executable in your PATH environment variable and in this case it won't be necessary to use g:trans_bin.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/echuraev/translate-shell.vim/issues/12#issuecomment-803956233, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATJNO6GOVTWTKHXRJEWZ2Q3TE4MGZANCNFSM4IWOTPXQ .

LeoSol56 avatar Mar 22 '21 12:03 LeoSol56