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

List of default target languages based on determined source languages #12

Open
Rom888 opened this issue Sep 13, 2019 · 10 comments
Open
Labels
enhancement New feature or request

Comments

@Rom888
Copy link

Rom888 commented Sep 13, 2019

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.

@echuraev
Copy link
Owner

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?

@Rom888
Copy link
Author

Rom888 commented Sep 17, 2019

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.

@echuraev
Copy link
Owner

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 echuraev added the enhancement New feature or request label Sep 18, 2019
@Rom888
Copy link
Author

Rom888 commented Sep 19, 2019

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>

@LeoSol56
Copy link

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

@echuraev
Copy link
Owner

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.

@LeoSol56
Copy link

LeoSol56 commented Mar 21, 2021 via email

@LeoSol56
Copy link

LeoSol56 commented Mar 22, 2021 via email

@echuraev
Copy link
Owner

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.

@LeoSol56
Copy link

LeoSol56 commented Mar 22, 2021 via email

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

No branches or pull requests

3 participants