soimort / translate-shell

:speech_balloon: Command-line translator using Google Translate, Bing Translator, Yandex.Translate, etc.
https://www.soimort.org/translate-shell
The Unlicense
6.83k stars 387 forks source link

Separation '══════': now exists only for non-interactive mod, please add to the REPL (-I) also #515

Closed vitaly-zdanevich closed 3 months ago

vitaly-zdanevich commented 3 months ago

This is good - we have ====== separator here:

$ trans :ru
hi
привет

Definitions of hi
[ English → Русский ]

abbreviation
    Гавайи
        HI

hi
    привет, Здравствуй, Здравствуйте
hi
═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
привет

Definitions of hi
[ English → Русский ]

abbreviation
    Гавайи
        HI

hi
    привет, Здравствуй, Здравствуйте
hi
═════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
привет

Definitions of hi
[ English → Русский ]

abbreviation
    Гавайи
        HI

hi
    привет, Здравствуй, Здравствуйте

This is what this issue about - no separator when -I is used:

$ trans :ru -I
hi
привет

Definitions of hi
[ English → Русский ]

abbreviation
    Гавайи
        HI

hi
    привет, Здравствуй, Здравствуйте

hi
привет

Definitions of hi
[ English → Русский ]

abbreviation
    Гавайи
        HI

hi
    привет, Здравствуй, Здравствуйте

hi
привет

Definitions of hi
[ English → Русский ]

abbreviation
    Гавайи
        HI

hi
    привет, Здравствуй, Здравствуйте
soimort commented 3 months ago

This is the intended default behavior. When you use shell or a Python REPL, there is no extra separator between the output and the next input prompt. Neither should trans have that.

With that being said, you can easily configure the prompt to include a separator and a newline to achieve this:

{  
  :fmt-prompt "=================\n> "
}
vitaly-zdanevich commented 3 months ago

Thanks, I tried your config, but still no separator in -I mode :(

My full config:

{
    :show-original false
    :show-translation-phonetics false
    :theme         "happiness.trans"
    :no-warn true
    :fmt-prompt "=================\n> "
}
soimort commented 3 months ago

I think when you have set a theme, it will always override the :fmt-prompt setting. So the only working way is to directly change the definition :fmt-prompt in the theme file happiness.trans. Let me know if it works.

vitaly-zdanevich commented 3 months ago

I tried in theme file - still no separation on -I :(