@@ -82,7 +82,7 @@ function doTranslate() {
8282 // Input
8383 items . push ( {
8484 title : fromText ,
85- subtitle : `Phonetic: ${ fromPhonetic || '' } ` ,
85+ subtitle : `Phonetic: ${ fromPhonetic } ` ,
8686 quicklookurl : `${ g_config . domain } /#view=home&op=translate&sl=${ g_config . from . lang } &tl=${ g_config . to . lang } &text=${ encodeURIComponent ( fromText ) } ` ,
8787 arg : fromArg ,
8888 text : {
@@ -100,7 +100,7 @@ function doTranslate() {
100100 // Translation
101101 items . push ( {
102102 title : toText ,
103- subtitle : `Phonetic: ${ toPhonetic || '' } ` ,
103+ subtitle : `Phonetic: ${ toPhonetic } ` ,
104104 quicklookurl : `${ g_config . domain } /#view=home&op=translate&sl=${ g_config . to . lang } &tl=${ g_config . from . lang } &text=${ encodeURIComponent ( toText ) } ` ,
105105 arg : toArg ,
106106 text : {
@@ -113,33 +113,28 @@ function doTranslate() {
113113 } ) ;
114114
115115 // Definitions
116- if ( res . to . definitions . length > 0 ) {
117- res . to . definitions . forEach ( definition => {
118- items . push ( {
119- title : `Definition[${ definition . partsOfSpeech } ]: ${ definition . value } ` ,
120- subtitle : `Example: ${ definition . example || '' } ` ,
121- quicklookurl : `${ g_config . domain } /#view=home&op=translate&sl=${ g_config . from . lang } &tl=${ g_config . to . lang } &text=${ encodeURIComponent ( fromText ) } ` ,
122- text : {
123- copy : definition . value ,
124- largetype : `Definitions: ${ definition . value } \n\nExample: ${ definition . example || '' } `
125- }
126- } ) ;
116+ res . to . definitions . forEach ( definition => {
117+ items . push ( {
118+ title : `Definition[${ definition . partsOfSpeech } ]: ${ definition . value } ` ,
119+ subtitle : `Example: ${ definition . example } ` ,
120+ text : {
121+ copy : definition . value ,
122+ largetype : `Definition: ${ definition . value } \n\nExample: ${ definition . example } `
123+ }
127124 } ) ;
128- }
125+ } ) ;
129126
130127 // Translation Of
131- if ( res . to . translations . length > 0 ) {
132- res . to . translations . forEach ( translation => {
133- items . push ( {
134- title : `Translation[${ translation . partsOfSpeech } ]: ${ translation . value } ` ,
135- subtitle : `Frequency: ${ translation . frequency ? translation . frequency . toFixed ( 4 ) : '0.0000' } Synonyms: ${ translation . synonyms ? translation . synonyms . join ( ', ' ) : '' } ` ,
136- text : {
137- copy : translation . value ,
138- largetype : `${ translation . value } \n\nSynonyms: ${ translation . synonyms ? translation . synonyms . join ( ', ' ) : '' } `
139- }
140- } ) ;
128+ res . to . translations . forEach ( translation => {
129+ items . push ( {
130+ title : `Translation[${ translation . partsOfSpeech } ]: ${ translation . value } ` ,
131+ subtitle : `Frequency: ${ translation . frequency . toFixed ( 4 ) } Synonyms: ${ translation . synonyms } ` ,
132+ text : {
133+ copy : translation . value ,
134+ largetype : `Translation: ${ translation . value } \n\nSynonyms: ${ translation . synonyms } `
135+ }
141136 } ) ;
142- }
137+ } ) ;
143138 }
144139
145140 alfy . output ( items ) ;
0 commit comments