List of default target languages based on determined source languages
Opened this issue · 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.
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
?
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.
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?
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>
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 (debian-kernel@lists.debian.org) (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 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 (debian-kernel@lists.debian.org) (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
.
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 useg:trans_bin
.