mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 09:37:26 +00:00
20 lines
598 B
PHP
20 lines
598 B
PHP
<?php
|
|
|
|
|
|
class Transifex
|
|
{
|
|
public static function isConfigured()
|
|
{
|
|
return (bool)Config::get(Config::TRANSIFEX_API_KEY);
|
|
}
|
|
|
|
public static function getTranslationResourceFile($project, $resource, $language, $cache = true)
|
|
{
|
|
$url = "https://www.transifex.com/api/2/project/$project/resource/$resource/translation/$language?file=1";
|
|
return json_decode(CurlWithCache::get($url, [], [
|
|
'password' => 'api:' . Config::get(Config::TRANSIFEX_API_KEY),
|
|
'cache' => $cache ? 1000 * 60 * 60 * 8 : false,
|
|
'timeout' => 15
|
|
]), true);
|
|
}
|
|
}
|