Skip to content

Display the translated text in a dialog window #1

@windirt

Description

@windirt

Thank you for making such a good plug-in, it is really fast, but when a large amount of text is translated at once, the content displayed will be particularly long, even beyond the width of the screen, I tried to make some changes on the codes via applescript to display a dialog window. I am not very familiar with the php language. The syntax may be wrong, but basically there is not much problem. Hope you can understand my intention and add it to the new version.

known issue: If there are double quotes in the translated text, the output will be empty, I don’t know how to deal with this issue.

below is the sample of dialog window and code
截屏2020-04-21 下午6 40 12

  $result = array_reduce($json[0], function($carry, $item) {
   if (isset($item[0])) {
     $carry .= $item[0];
     return $carry;
   }
  }, '');
  $cmd = "/usr/bin/osascript -e \"display dialog \\\" {$result} \\\"\"";
  exec($cmd);
  echo " ";

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions