diff --git a/Google Translate.alfredworkflow b/Google Translate.alfredworkflow index 96cac38..2f98e9d 100644 Binary files a/Google Translate.alfredworkflow and b/Google Translate.alfredworkflow differ diff --git a/README.md b/README.md index 0a369d5..7a4bef3 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,16 @@ Google Translate Alfred Workflow ============================= -# Version 3.1.2 +# Version 3.2.0 ## Changelog +### 3.2.0 + + * Makes the workflow compatible to Alfred 2 and 3. + +### 3.1.2 + * This integrates a library to get Google results without the problem of running into the request limit (see https://github.com/Stichoza/google-translate-php). The only downside I see at the moment, is that the used API only returns one result and no alternatives. But I guess it's better than not working at all. diff --git a/src/workflows.php b/src/workflows.php index 936b309..dd59c05 100644 --- a/src/workflows.php +++ b/src/workflows.php @@ -38,8 +38,17 @@ function __construct( $bundleid=null ) $this->bundle = $bundleid; endif; - $this->cache = $this->home. "/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/".$this->bundle; - $this->data = $this->home. "/Library/Application Support/Alfred 2/Workflow Data/".$this->bundle; + if (isset($_ENV['alfred_workflow_cache'])) { + $this->cache = $_ENV['alfred_workflow_cache']; + } else { + $this->cache = $this->home. "/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/".$this->bundle; + } + + if (isset($_ENV['alfred_workflow_data'])) { + $this->data = $_ENV['alfred_workflow_data']; + } else { + $this->data = $this->home. "/Library/Application Support/Alfred 2/Workflow Data/".$this->bundle; + } if ( !file_exists( $this->cache ) ): exec("mkdir '".$this->cache."'"); @@ -480,4 +489,4 @@ public function result( $uid, $arg, $title, $sub, $icon, $valid='yes', $auto=nul return $temp; } -} \ No newline at end of file +}