/**
  * TransifexLib::putTranslations()
  *
  * @param string $resource
  * @param string $language
  * @param string $file
  * @throws \RuntimeException
  * @return mixed
  * @author Gustav Wellner Bou <*****@*****.**>
  */
 public function putTranslations($resource, $language, $file)
 {
     $url = static::BASE_URL . 'project/{project}/resource/' . $resource . '/translation/' . $language;
     if (function_exists('curl_file_create') && function_exists('mime_content_type')) {
         $body = ['file' => curl_file_create($file, $this->_getMimeType($file), pathinfo($file, PATHINFO_BASENAME))];
     } else {
         $body = ['file' => '@' . $file];
     }
     try {
         return $this->_post($url, $body, 'PUT');
     } catch (RuntimeException $e) {
         /* Handling a very specific exception due to a Transifex bug */
         // Exception is thrown maybe just because the file only has empty translations
         if (strpos($e->getMessage(), "We're not able to extract any string from the file uploaded for language") !== false) {
             $catalog = I18n::loadPo($file);
             unset($catalog['']);
             if (count($catalog)) {
                 if (count(array_filter($catalog)) === 0) {
                     // PO file contains empty translations
                     // In that case Transifex throws an error although its not.
                     // Then we could just append one non empty translation to that file and send it again
                     // But apart from successfully sending this file again, it wont affect the remote translations
                     return ['strings_added' => 0, 'strings_updated' => 0, 'strings_delete' => 0];
                 }
                 throw new RuntimeException(sprintf('Could not extract any string from %s. Whereas file contains non-empty translation(s) for following key(s): %s.', $file, '"' . implode('", "', array_keys(array_filter($catalog))) . '"'));
             } else {
                 throw new RuntimeException(sprintf('Could not extract any string from %s. File seems empty.', $file));
             }
         } else {
             throw $e;
         }
     }
 }