up translation timeout to 15s

This commit is contained in:
Jeremy Kauffman 2019-12-16 16:58:17 -05:00
parent 50838df8f6
commit b974351d07

View file

@ -3,16 +3,18 @@
class Transifex class Transifex
{ {
public static function isConfigured() { public static function isConfigured()
return (boolean)Config::get(Config::TRANSIFEX_API_KEY); {
return (boolean)Config::get(Config::TRANSIFEX_API_KEY);
} }
public static function getTranslationResourceFile($project, $resource, $language, $cache = true) public static function getTranslationResourceFile($project, $resource, $language, $cache = true)
{ {
$url = "https://www.transifex.com/api/2/project/$project/resource/$resource/translation/$language?file=1"; $url = "https://www.transifex.com/api/2/project/$project/resource/$resource/translation/$language?file=1";
return json_decode(CurlWithCache::get($url, [], [ return json_decode(CurlWithCache::get($url, [], [
'password' => 'api:' . Config::get(Config::TRANSIFEX_API_KEY), 'password' => 'api:' . Config::get(Config::TRANSIFEX_API_KEY),
'cache' => $cache ? 1000 * 60 * 60 * 8 : false 'cache' => $cache ? 1000 * 60 * 60 * 8 : false,
'timeout' => 5
]), true); ]), true);
} }
} }