mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
cache i18n strings
This commit is contained in:
parent
1bc15aad39
commit
9a070c7b3f
2 changed files with 5 additions and 7 deletions
|
@ -29,8 +29,11 @@ class i18nActions extends Actions
|
||||||
throw new Exception('Please set Config::TRANSIFEX_API_KEY in your configuration.');
|
throw new Exception('Please set Config::TRANSIFEX_API_KEY in your configuration.');
|
||||||
}
|
}
|
||||||
|
|
||||||
Response::setHeader(Response::HEADER_CROSS_ORIGIN, "*");
|
$json = Transifex::getTranslationResourceFile($project, $resource, $language);
|
||||||
|
|
||||||
return View::renderJson(Transifex::getTranslationResourceFile($project, $resource, $language));
|
Response::setHeader(Response::HEADER_CROSS_ORIGIN, "*");
|
||||||
|
Response:setHeader(Response::HEADER_ETAG, md5(static::getContent($json)));
|
||||||
|
|
||||||
|
return View::renderJson($json);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,11 +192,6 @@ class Response
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setContentEtag()
|
|
||||||
{
|
|
||||||
static::setHeader(static::HEADER_ETAG, md5(static::getContent()));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function enableHttpCache(int $seconds = 300)
|
public static function enableHttpCache(int $seconds = 300)
|
||||||
{
|
{
|
||||||
static::addCacheControlHeader('max-age', $seconds);
|
static::addCacheControlHeader('max-age', $seconds);
|
||||||
|
|
Loading…
Add table
Reference in a new issue