List translations for a specific key.

@param string $projectKey
@param string $keyId
@param array  $params

@return Index|ResponseInterface
4708
public function indexKey(string $projectKey, string $keyId, array $params = [])
    {
        if (isset($params['tags'])) {
            $params['q'] = 'tags:'.$params['tags'];
            unset($params['tags']);
        }

        $response = $this->httpGet(sprintf('/api/v2/projects/%s/keys/%s/translations', $projectKey, $keyId), $params);

        if (!$this->hydrator) {
            return $response;
        }

        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
            $this->handleErrors($response);
        }

        return $this->hydrator->hydrate($response, Index::class);
    }
1257967
private static function trans($key, array $params = [], $domain = 'messages', $locale = null, $default = null)
    {
        $app = AppSingleton::get();

        // Handle default parameter
        if (isset($params['DEFAULT'])) {
            if ($default === null) {
                $default = $params['DEFAULT'];
            }
            unset($params['DEFAULT']);
        }

        // Handle number parameter
        if (isset($params['NUMBER'])) {
            $number = $params['NUMBER'];
            unset($params['NUMBER']);
        } else {
            $number = null;
        }

        // Translate
        try {
            if ($number === null) {
                $trans = $app['translator']->trans($key, $params, $domain, $locale);
            } else {
                $trans = $app['translator']->transChoice($key, $number, $params, $domain, $locale);
            }

            return ($trans === $key && $default !== null) ? $default : $trans;
        } catch (InvalidResourceException $e) {
            if (!isset($app['translationyamlerror']) && $app['request']->isXmlHttpRequest() === false) {
                $app['logger.flash']->danger('Error: You should fix this now, before continuing!<br>' . $e->getMessage());
                $app['translationyamlerror'] = true;
            }

            return strtr($key, $params);
        }
    }
545707
private function translate($key, $translations)
    {
        if (!is_null($translations) && isset($translations[$key])) {
            return $translations[$key];
        }

        return $key;
    }
912518
private function translate($key, $translations)
    {
        if ($translations != null && isset($translations[$key])) {
            return $translations[$key];
        }

        return $key;
    }
257813
public function locale(string $projectKey, string $locale, string $ext, array $params)
    {
        $params['key'] = $projectKey;
        $response = $this->httpGet(sprintf('/api/export/locale/%s.%s?%s', $locale, $ext, http_build_query($params)));

        if (!$this->hydrator) {
            return $response;
        }

        if (200 !== $response->getStatusCode()) {
            $this->handleErrors($response);
        }

        return (string) $response->getBody();
    }
56482
public function get(string $projectKey, string $id, string $locale)
    {
        $response = $this->httpGet(sprintf('/api/translations/%s/%s?key=%s', rawurlencode($id), $locale, $projectKey));

        if (!$this->hydrator) {
            return $response;
        }

        if (200 !== $response->getStatusCode()) {
            $this->handleErrors($response);
        }

        return $this->hydrator->hydrate($response, TranslationModel::class);
    }
1237871
public function getTranslations($id, $parameters = [])
    {
        $messages = [];

        foreach ($this->supportedLocales as $locale) {
            $message = $this->getTranslation($id, $parameters, $locale);
            $messages[] = [
                "Lang" => lcfirst($locale),
                "Text" => $message,
            ];
        }

        return $messages;
    }
372202
public function builds($projectId)
    {
        $branch = $this->getParam('branch', '');
        $builds = $this->getLatestBuildsHtml($projectId, urldecode($branch));

        $this->response->disableLayout();
        $this->response->setContent($builds[0]);
        return $this->response;
    }
271523
public function get_key($keyid)
    {
        $list = $this->list_keys($keyid);

        if (is_array($list)) {
            return $list[key($list)];
        }

        // error
        return $list;
    }
634789
public function update(string $key, array $params = [])
    {
        $path = $this->buildBuildPath(...explode('/', $key));

        return $this->put($path, $params);
    }
997580
public function create(string $projectKey, string $localeId, string $keyId, string $content, array $params = [])
    {
        $params['locale_id'] = $localeId;
        $params['key_id'] = $keyId;
        $params['content'] = $content;

        $response = $this->httpPost(sprintf('/api/v2/projects/%s/translations', $projectKey), $params);

        if (!$this->hydrator) {
            return $response;
        }

        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
            $this->handleErrors($response);
        }

        return $this->hydrator->hydrate($response, TranslationCreated::class);
    }
92570
public function getIronMQ($projectId, $token, array $options)
    {
        if (!class_exists(IronMQ::class)) {
            throw new \DomainException('Please install iron-io/iron_mq first.');
        }

        $defaultOptions = [
            'project_id' => $projectId,
            'token' => $token,
        ];

        $options = array_merge($defaultOptions, $options);

        return new IronMQ($options);
    }
171461
public function api_keys($apiKey = null)
    {
        $api_keys = self::all_api_keys();
        $my_api_keys = null;

        if ($api_keys->id == $this->id) {
            $my_api_keys = $api_keys->keys;
        }
        if (is_null($my_api_keys)) {
            foreach($api_keys->children as $children_keys) {
                if ($children_keys->id == $this->id) {
                    $my_api_keys = $children_keys->keys;
                }
            }
        }

        if (is_null($my_api_keys)) {
            return null;
        } else {
            $response = array();
            foreach($my_api_keys as $key) {
                $response[$key->mode] = $key->key;
            }
            return $response;
        }
    }
126553
public List<ComponentDto> selectAllComponentsFromProjectKey(DbSession session, String projectKey) {
    return mapper(session).selectComponentsFromProjectKeyAndScope(projectKey, null, false);
  }
843090
public function getMessage($bundle, $key, $locale, $projectId = null)
    {
        $projectId = $projectId ?: $this->project_id;

        return $this->callService($this->url_plan['get_message'], array(
                'project_id' => $projectId,
                'bundle'     => $bundle,
                'key'        => $key,
                'language'   => $locale,
            )
        );
    }
909422
public function create($projectId,$taskId,array $params = array())
    {
        $defaults = array(
            'text'      => null,
            'user_id'     => null,
            'user_email'  => null
        );
        $params = array_filter(array_merge($defaults, $params));
        
        $data = array('comment'=>$params);

        $path = '/projects/'.urlencode($projectId).'/tasks/'.urlencode($taskId).'/comments.json';
        return $this->post($path,$data);
    }
383534
public function getMessage($bundle, $key, $locale, $projectId = null)
    {
        $url = str_replace(
            array(':projectId',                     ':bundle', ':key', ':locale' ),
            array($projectId ?: $this->project_id,   $bundle,   urlencode($key),  $locale),
            $this->url_plan['get_message']);

        return $this->callService($url);
    }