diff --git a/include/Main.awk b/include/Main.awk index c85bd772..0a437907 100644 --- a/include/Main.awk +++ b/include/Main.awk @@ -24,6 +24,7 @@ function init() { # Display Option["verbose"] = 1 + Option["compact"] = 0 Option["show-original"] = 1 Option["show-original-phonetics"] = 1 Option["show-translation"] = 1 @@ -344,6 +345,13 @@ BEGIN { continue } + # -compact + match(ARGV[pos], /^--?(c|compact)$/) + if (RSTART) { + Option["compact"] = 1 + continue + } + # -b, -brief match(ARGV[pos], /^--?b(r(i(ef?)?)?)?$/) if (RSTART) { diff --git a/include/Translators/GoogleTranslate.awk b/include/Translators/GoogleTranslate.awk index 8f506e2f..a9edde57 100644 --- a/include/Translators/GoogleTranslate.awk +++ b/include/Translators/GoogleTranslate.awk @@ -89,7 +89,7 @@ function googleTranslate(text, sl, tl, hl, wShowTranslation, wShowTranslationPhonetics, wShowPromptMessage, wShowLanguages, wShowOriginalDictionary, wShowDictionary, - wShowAlternatives, + wShowDictionaryCompact, wShowAlternatives, genderedTrans, hasWordClasses, hasAltTranslations, i, j, k, group, temp, saveSortedIn) { isPhonetic = match(tl, /^@/) @@ -235,6 +235,7 @@ function googleTranslate(text, sl, tl, hl, wShowLanguages = Option["show-languages"] wShowOriginalDictionary = Option["show-original-dictionary"] wShowDictionary = Option["show-dictionary"] + wShowDictionaryCompact = Option["compact"] wShowAlternatives = Option["show-alternatives"] if (!anything(oPhonetics)) wShowOriginalPhonetics = 0 @@ -429,10 +430,17 @@ function googleTranslate(text, sl, tl, hl, } r = r RS prettify("dictionary-word", ins(1, (article ? "(" article ") " : "") word, tl)) - if (isRTL(il)) - r = r RS prettify("dictionary-explanation-item", ins(2, explanation, il)) - else - r = r RS ins(2, explanation) + if (wShowDictionaryCompact) { + if (isRTL(il)) + r = r " - " prettify("dictionary-explanation-item", ins(0, explanation, il)) + else + r = r " - " ins(0, explanation) + } else { + if (isRTL(il)) + r = r RS prettify("dictionary-explanation-item", ins(2, explanation, il)) + else + r = r RS ins(2, explanation) + } } } } diff --git a/man/trans.1 b/man/trans.1 index 6172db88..70cb50d9 100644 --- a/man/trans.1 +++ b/man/trans.1 @@ -85,6 +85,13 @@ This option is unnecessary in most cases since verbose mode is enabled by default. .RE .TP +.B \f[B]\-c\f[R], \f[B]\-compact\f[R] +Compact mode. +.RS +.PP +Show one translate dictionary entry per line instead of splitting it into two lines. +.RE +.TP .B \f[B]\-b\f[R], \f[B]\-brief\f[R] Brief mode. .RS diff --git a/man/trans.1.md b/man/trans.1.md index 847d64e6..e735469c 100644 --- a/man/trans.1.md +++ b/man/trans.1.md @@ -72,6 +72,11 @@ If neither *TEXT* nor the input file is specified by command-line arguments, the This option is unnecessary in most cases since verbose mode is enabled by default. +**-c**, **-compact** +: Compact mode. + + Show one translate dictionary entry per line instead of splitting it into two lines. + **-b**, **-brief** : Brief mode. diff --git a/man/trans.1.template.md b/man/trans.1.template.md index 1e378f20..8b031f68 100644 --- a/man/trans.1.template.md +++ b/man/trans.1.template.md @@ -72,6 +72,11 @@ If neither *TEXT* nor the input file is specified by command-line arguments, the This option is unnecessary in most cases since verbose mode is enabled by default. +**-c**, **-compact** +: Compact mode. + + Show one translate dictionary entry per line instead of splitting it into two lines. + **-b**, **-brief** : Brief mode.